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

(-)a/C4/CourseReserves.pm (-41 / +66 lines)
Lines 298-304 sub EnableOrDisableCourseItem { Link Here
298
298
299
    my $course_item = GetCourseItem( ci_id => $ci_id );
299
    my $course_item = GetCourseItem( ci_id => $ci_id );
300
300
301
    my $info = GetItemCourseReservesInfo( itemnumber => $course_item->{itemnumber} );
301
    my $info = $course_item->{itemnumber} ? GetItemCourseReservesInfo( itemnumber => $course_item->{itemnumber} ) : GetItemCourseReservesInfo( biblionumber => $course_item->{biblionumber} );
302
302
303
    my $enabled = any { $_->{course}->{enabled} eq 'yes' } @$info;
303
    my $enabled = any { $_->{course}->{enabled} eq 'yes' } @$info;
304
    $enabled = $enabled ? 'yes' : 'no';
304
    $enabled = $enabled ? 'yes' : 'no';
Lines 424-434 sub GetCourseItem { Link Here
424
424
425
    my $ci_id      = $params{'ci_id'};
425
    my $ci_id      = $params{'ci_id'};
426
    my $itemnumber = $params{'itemnumber'};
426
    my $itemnumber = $params{'itemnumber'};
427
    my $biblionumber = $params{'biblionumber'};
427
428
428
    return unless ( $itemnumber || $ci_id );
429
    return unless ( $itemnumber || $biblionumber || $ci_id );
429
430
430
    my $field = ($itemnumber) ? 'itemnumber' : 'ci_id';
431
    my ( $field, $value );
431
    my $value = ($itemnumber) ? $itemnumber  : $ci_id;
432
    if ( $itemnumber ) {
433
        $field = 'itemnumber';
434
        $value = $itemnumber;
435
    } elsif ( $biblionumber ) {
436
        $field = 'biblionumber';
437
        $value = $biblionumber;
438
    } else {
439
        $field = 'ci_id';
440
        $value = $ci_id;
441
    }
432
442
433
    my $query = "SELECT * FROM course_items WHERE $field = ?";
443
    my $query = "SELECT * FROM course_items WHERE $field = ?";
434
    my $dbh   = C4::Context->dbh;
444
    my $dbh   = C4::Context->dbh;
Lines 462-471 sub ModCourseItem { Link Here
462
    warn identify_myself(%params) if $DEBUG;
472
    warn identify_myself(%params) if $DEBUG;
463
473
464
    my $itemnumber = $params{'itemnumber'};
474
    my $itemnumber = $params{'itemnumber'};
475
    my $biblionumber = $params{'biblionumber'};
465
476
466
    return unless ($itemnumber);
477
    return unless ($itemnumber || $biblionumber);
467
478
468
    my $course_item = GetCourseItem( itemnumber => $itemnumber );
479
    my $course_item = $itemnumber ? GetCourseItem( itemnumber => $itemnumber ) : GetCourseItem( biblionumber => $biblionumber );
480
481
    if ( $itemnumber and !$biblionumber ) {
482
        $biblionumber = Koha::Items->find( $itemnumber )->biblionumber;
483
        $params{biblionumber} = $biblionumber;
484
    }
469
485
470
    my $ci_id;
486
    my $ci_id;
471
487
Lines 504-509 sub _AddCourseItem { Link Here
504
    my $ci = Koha::Course::Item->new(
520
    my $ci = Koha::Course::Item->new(
505
        {
521
        {
506
            itemnumber => $params{itemnumber},
522
            itemnumber => $params{itemnumber},
523
            biblionumber => $params{biblionumber},
507
            %data,
524
            %data,
508
            %enabled,
525
            %enabled,
509
        }
526
        }
Lines 535-570 sub _UpdateCourseItem { Link Here
535
    my %data = map { $_ => $params{$_} } @FIELDS;
552
    my %data = map { $_ => $params{$_} } @FIELDS;
536
    my %enabled = map { $_ . "_enabled" => $params{ $_ . "_enabled" } } @FIELDS;
553
    my %enabled = map { $_ . "_enabled" => $params{ $_ . "_enabled" } } @FIELDS;
537
554
538
    my $item = Koha::Items->find( $course_item->itemnumber );
555
    if ( $course_item->itemnumber ) {
539
556
        # biblio-level course items don't store any of these fields
540
    # Handle updates to changed fields for a course item, both adding and removing
557
        my $item = Koha::Items->find( $course_item->itemnumber );
541
    if ( $course_item->is_enabled ) {
558
542
        my $item_fields = {};
559
        # Handle updates to changed fields for a course item, both adding and removing
543
560
        if ( $course_item->is_enabled ) {
544
        for my $field ( @FIELDS ) {
561
            my $item_fields = {};
545
562
546
            my $field_enabled = $field . '_enabled';
563
            for my $field ( @FIELDS ) {
547
            my $field_storage = $field . '_storage';
564
548
565
                my $field_enabled = $field . '_enabled';
549
            # Find newly enabled field and add item value to storage
566
                my $field_storage = $field . '_storage';
550
            if ( $params{$field_enabled} && !$course_item->$field_enabled ) {
567
551
                $enabled{$field_storage} = $item->$field;
568
                # Find newly enabled field and add item value to storage
552
                $item_fields->{$field}   = $params{$field};
569
                if ( $params{$field_enabled} && !$course_item->$field_enabled ) {
553
            }
570
                    $enabled{$field_storage} = $item->$field;
554
            # Find newly disabled field and copy the storage value to the item, unset storage value
571
                    $item_fields->{$field}   = $params{$field};
555
            elsif ( !$params{$field_enabled} && $course_item->$field_enabled ) {
572
                }
556
                $item_fields->{$field}   = $course_item->$field_storage;
573
                # Find newly disabled field and copy the storage value to the item, unset storage value
557
                $enabled{$field_storage} = undef;
574
                elsif ( !$params{$field_enabled} && $course_item->$field_enabled ) {
558
            }
575
                    $item_fields->{$field}   = $course_item->$field_storage;
559
            # The field was already enabled, copy the incoming value to the item.
576
                    $enabled{$field_storage} = undef;
560
            # The "original" ( when not on course reserve ) value is already in the storage field
577
                }
561
            elsif ( $course_item->$field_enabled) {
578
                # The field was already enabled, copy the incoming value to the item.
562
                $item_fields->{$field} = $params{$field};
579
                # The "original" ( when not on course reserve ) value is already in the storage field
580
                elsif ( $course_item->$field_enabled) {
581
                    $item_fields->{$field} = $params{$field};
582
                }
563
            }
583
            }
564
        }
565
584
566
        $item->set( $item_fields )->store
585
            $item->set( $item_fields )->store
567
            if keys %$item_fields;
586
                if keys %$item_fields;
587
        }
568
    }
588
    }
569
589
570
    $course_item->update( { %data, %enabled } );
590
    $course_item->update( { %data, %enabled } );
Lines 850-856 sub GetCourseReserves { Link Here
850
    my $value = ($course_id) ? $course_id  : $ci_id;
870
    my $value = ($course_id) ? $course_id  : $ci_id;
851
871
852
    my $query = "
872
    my $query = "
853
        SELECT cr.*, ci.itemnumber
873
        SELECT cr.*, ci.itemnumber, ci.biblionumber
854
        FROM course_reserves cr, course_items ci
874
        FROM course_reserves cr, course_items ci
855
        WHERE cr.$field = ?
875
        WHERE cr.$field = ?
856
        AND cr.ci_id = ci.ci_id
876
        AND cr.ci_id = ci.ci_id
Lines 864-870 sub GetCourseReserves { Link Here
864
    if ($include_items) {
884
    if ($include_items) {
865
        foreach my $cr (@$course_reserves) {
885
        foreach my $cr (@$course_reserves) {
866
            my $item = Koha::Items->find( $cr->{itemnumber} );
886
            my $item = Koha::Items->find( $cr->{itemnumber} );
867
            my $biblio = $item->biblio;
887
            my $biblio = $cr->{itemnumber} ? $item->biblio : Koha::Biblios->find( $cr->{biblionumber} );
868
            my $biblioitem = $biblio->biblioitem;
888
            my $biblioitem = $biblio->biblioitem;
869
            $cr->{'course_item'} = GetCourseItem( ci_id => $cr->{'ci_id'} );
889
            $cr->{'course_item'} = GetCourseItem( ci_id => $cr->{'ci_id'} );
870
            $cr->{'item'}        = $item;
890
            $cr->{'item'}        = $item;
Lines 882-888 sub GetCourseReserves { Link Here
882
902
883
    if ($include_courses) {
903
    if ($include_courses) {
884
        foreach my $cr (@$course_reserves) {
904
        foreach my $cr (@$course_reserves) {
885
            $cr->{'courses'} = GetCourses( itemnumber => $cr->{'itemnumber'} );
905
            $cr->{'courses'} = $cr->{itemnumber} ? GetCourses( itemnumber => $cr->{'itemnumber'} ) : GetCourses( biblionumber => $cr->{biblionumber} );
886
        }
906
        }
887
    }
907
    }
888
908
Lines 924-929 sub DelCourseReserve { Link Here
924
=head2 GetItemCourseReservesInfo
944
=head2 GetItemCourseReservesInfo
925
945
926
    my $arrayref = GetItemCourseReservesInfo( itemnumber => $itemnumber );
946
    my $arrayref = GetItemCourseReservesInfo( itemnumber => $itemnumber );
947
    my $arrayref = GetItemCourseReservesInfo( biblionumber => $biblionumber );
927
948
928
    For a given item, returns an arrayref of reserves hashrefs,
949
    For a given item, returns an arrayref of reserves hashrefs,
929
    with a course hashref under the key 'course'
950
    with a course hashref under the key 'course'
Lines 935-944 sub GetItemCourseReservesInfo { Link Here
935
    warn identify_myself(%params) if $DEBUG;
956
    warn identify_myself(%params) if $DEBUG;
936
957
937
    my $itemnumber = $params{'itemnumber'};
958
    my $itemnumber = $params{'itemnumber'};
959
    my $biblionumber = $params{'biblionumber'};
938
960
939
    return unless ($itemnumber);
961
    return unless ($itemnumber || $biblionumber);
940
962
941
    my $course_item = GetCourseItem( itemnumber => $itemnumber );
963
    my $course_item = $itemnumber ? GetCourseItem( itemnumber => $itemnumber ) : GetCourseItem( biblionumber => $biblionumber );
942
964
943
    return unless ( keys %$course_item );
965
    return unless ( keys %$course_item );
944
966
Lines 958-963 sub GetItemCourseReservesInfo { Link Here
958
    ci_id - course_item id
980
    ci_id - course_item id
959
    OR
981
    OR
960
    itemnumber - course_item itemnumber
982
    itemnumber - course_item itemnumber
983
    OR
984
    biblionumber - course_item biblionumber
961
985
962
    enabled = 'yes' or 'no'
986
    enabled = 'yes' or 'no'
963
    Optional, if not supplied, counts reserves
987
    Optional, if not supplied, counts reserves
Lines 972-981 sub CountCourseReservesForItem { Link Here
972
    my $ci_id      = $params{'ci_id'};
996
    my $ci_id      = $params{'ci_id'};
973
    my $itemnumber = $params{'itemnumber'};
997
    my $itemnumber = $params{'itemnumber'};
974
    my $enabled    = $params{'enabled'};
998
    my $enabled    = $params{'enabled'};
999
    my $biblionumber = $params{'biblionumber'};
975
1000
976
    return unless ( $ci_id || $itemnumber );
1001
    return unless ( $ci_id || ( $itemnumber || $biblionumber ) );
977
1002
978
    my $course_item = GetCourseItem( ci_id => $ci_id, itemnumber => $itemnumber );
1003
    my $course_item = $itemnumber ? GetCourseItem( ci_id => $ci_id, itemnumber => $itemnumber ) : GetCourseItem( ci_id => $ci_id, biblionumber => $biblionumber );
979
1004
980
    my @params = ( $course_item->{'ci_id'} );
1005
    my @params = ( $course_item->{'ci_id'} );
981
    push( @params, $enabled ) if ($enabled);
1006
    push( @params, $enabled ) if ($enabled);
(-)a/catalogue/detail.pl (+5 lines)
Lines 612-617 if($query->cookie("intranet_bib_list")){ Link Here
612
    }
612
    }
613
}
613
}
614
614
615
if ( C4::Context->preference('UseCourseReserves') ) {
616
    my $course_reserves = GetItemCourseReservesInfo( biblionumber => $biblionumber );
617
    $template->param( course_reserves => $course_reserves );
618
}
619
615
$template->param(biblio => $biblio);
620
$template->param(biblio => $biblio);
616
621
617
output_html_with_http_headers $query, $cookie, $template->output;
622
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/course_reserves/add_items.pl (-6 / +42 lines)
Lines 41-55 my $barcode = $cgi->param('barcode') || ''; Link Here
41
my $return       = $cgi->param('return')       || '';
41
my $return       = $cgi->param('return')       || '';
42
my $itemnumber   = $cgi->param('itemnumber')   || '';
42
my $itemnumber   = $cgi->param('itemnumber')   || '';
43
my $is_edit      = $cgi->param('is_edit')      || '';
43
my $is_edit      = $cgi->param('is_edit')      || '';
44
my $biblionumber = $cgi->param('biblionumber') || '';
44
45
45
$barcode =~ s/^\s*|\s*$//g; #remove leading/trailing whitespace
46
$barcode =~ s/^\s*|\s*$//g; #remove leading/trailing whitespace
47
$biblionumber =~ s/^\s*|\s*$//g; #remove leading/trailing whitespace
46
48
47
my $item = Koha::Items->find( { ( $itemnumber ? ( itemnumber => $itemnumber ) : ( barcode => $barcode ) ) } );
49
my ( $item, $biblio );
48
$itemnumber = $item->id if $item;
49
50
50
my $title = ($item) ? $item->biblio->title : undef;
51
if ( $barcode || $itemnumber ) {
52
    # adding an item to course items
53
    $item = $itemnumber ? Koha::Items->find( $itemnumber ) : Koha::Items->find({ barcode => $barcode });
54
    if ( $item ) {
55
        $itemnumber = $item->id;
56
        $biblio = $item->biblio;
57
        $biblionumber = $biblio->biblionumber;
58
    }
59
} else {
60
    # adding a biblio to course items
61
    $biblio = Koha::Biblios->find( $biblionumber );
62
}
63
64
my $title = $biblio->title if $biblio;
51
65
52
my $step = ( $action eq 'lookup' && $item ) ? '2' : '1';
66
my $step = ( $action eq 'lookup' && ( $item or $biblio ) ) ? '2' : '1';
53
67
54
my $tmpl = ($course_id) ? "add_items-step$step.tt" : "invalid-course.tt";
68
my $tmpl = ($course_id) ? "add_items-step$step.tt" : "invalid-course.tt";
55
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
69
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 60-68 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
60
    }
74
    }
61
);
75
);
62
76
63
if ( !$item && $action eq 'lookup' ){
77
if ( !$item && !$biblio && $action eq 'lookup' ){
64
    $template->param( ERROR_ITEM_NOT_FOUND => 1 );
78
    $template->param( ERROR_ITEM_NOT_FOUND => 1 );
65
    $template->param( UNKNOWN_BARCODE => $barcode ) if $barcode;
79
    $template->param( UNKNOWN_BARCODE => $barcode ) if $barcode;
80
    $template->param( UNKNOWN_BIBLIONUMBER => $biblionumber ) if $biblionumber;
66
}
81
}
67
82
68
$template->param( course => GetCourse($course_id) );
83
$template->param( course => GetCourse($course_id) );
Lines 80-86 if ( $action eq 'lookup' and $item ) { Link Here
80
    my $itemtypes = Koha::ItemTypes->search;
95
    my $itemtypes = Koha::ItemTypes->search;
81
    $template->param(
96
    $template->param(
82
        item           => $item,
97
        item           => $item,
83
        biblio         => $item->biblio,
98
        biblio         => $biblio,
84
        course_item    => $course_item,
99
        course_item    => $course_item,
85
        course_reserve => $course_reserve,
100
        course_reserve => $course_reserve,
86
        is_edit        => $is_edit,
101
        is_edit        => $is_edit,
Lines 91-96 if ( $action eq 'lookup' and $item ) { Link Here
91
        return    => $return,
106
        return    => $return,
92
    );
107
    );
93
108
109
} elsif ( $action eq 'lookup' and $biblio ) {
110
    my $course_item = Koha::Course::Items->find({ biblionumber => $biblio->biblionumber });
111
    my $course_reserve =
112
      ($course_item)
113
      ? GetCourseReserve(
114
        course_id => $course_id,
115
        ci_id     => $course_item->ci_id,
116
      )
117
      : undef;
118
119
    my $itemtypes = Koha::ItemTypes->search;
120
    $template->param(
121
        biblio         => $biblio,
122
        course_item    => $course_item,
123
        course_reserve => $course_reserve,
124
        is_edit        => $is_edit,
125
126
        return    => $return,
127
    );
128
94
} elsif ( $action eq 'add' ) {
129
} elsif ( $action eq 'add' ) {
95
    my $itype         = scalar $cgi->param('itype');
130
    my $itype         = scalar $cgi->param('itype');
96
    my $ccode         = scalar $cgi->param('ccode');
131
    my $ccode         = scalar $cgi->param('ccode');
Lines 106-111 if ( $action eq 'lookup' and $item ) { Link Here
106
141
107
    my $ci_id = ModCourseItem(
142
    my $ci_id = ModCourseItem(
108
            itemnumber    => $itemnumber,
143
            itemnumber    => $itemnumber,
144
            biblionumber  => $biblionumber,
109
            itype         => $itype,
145
            itype         => $itype,
110
            ccode         => $ccode,
146
            ccode         => $ccode,
111
            homebranch    => $homebranch,
147
            homebranch    => $homebranch,
(-)a/course_reserves/batch_add_items.pl (-38 / +92 lines)
Lines 34-47 my $cgi = CGI->new; Link Here
34
my $action    = $cgi->param('action')    || q{};
34
my $action    = $cgi->param('action')    || q{};
35
my $course_id = $cgi->param('course_id') || q{};
35
my $course_id = $cgi->param('course_id') || q{};
36
my $barcodes  = $cgi->param('barcodes')  || q{};
36
my $barcodes  = $cgi->param('barcodes')  || q{};
37
my $biblionumbers = $cgi->param('biblionumbers') || q{};
37
38
38
my $itype         = $cgi->param('itype');
39
my $itype         = $cgi->param('itype');
39
my $ccode         = $cgi->param('ccode');
40
my $ccode         = $cgi->param('ccode');
40
my $homebranch    = $cgi->param('homebranch');
41
my $homebranch    = $cgi->param('homebranch');
41
my $holdingbranch = $cgi->param('holdingbranch');
42
my $holdingbranch = $cgi->param('holdingbranch');
42
my $location      = $cgi->param('location');
43
my $location      = $cgi->param('location');
43
my $staff_note    = $cgi->param('staff_note');
44
my $public_note   = $cgi->param('public_note');
45
44
46
my $itype_enabled         = scalar $cgi->param('itype_enabled') ? 1 : 0;
45
my $itype_enabled         = scalar $cgi->param('itype_enabled') ? 1 : 0;
47
my $ccode_enabled         = scalar $cgi->param('ccode_enabled') ? 1 : 0;
46
my $ccode_enabled         = scalar $cgi->param('ccode_enabled') ? 1 : 0;
Lines 68-116 if ( $course_id && $course ) { Link Here
68
    }
67
    }
69
    elsif ( $action eq 'add' ) {
68
    elsif ( $action eq 'add' ) {
70
        my @barcodes = uniq( split( /\s\n/, $barcodes ) );
69
        my @barcodes = uniq( split( /\s\n/, $barcodes ) );
71
70
        my @biblionumbers = uniq( split( /\s\n/, $biblionumbers ) );
72
        my @items;
71
73
        my @invalid_barcodes;
72
        if (@barcodes > 0) {
74
        for my $b (@barcodes) {
73
            my @items;
75
            my $item = Koha::Items->find( { barcode => $b } );
74
            my @invalid_barcodes;
76
75
            for my $b (@barcodes) {
77
            if ($item) {
76
                my $item = Koha::Items->find( { barcode => $b } );
78
                push( @items, $item );
77
78
                if ($item) {
79
                    push( @items, $item );
80
                }
81
                else {
82
                    push( @invalid_barcodes, $b );
83
                }
79
            }
84
            }
80
            else {
85
81
                push( @invalid_barcodes, $b );
86
            foreach my $item (@items) {
87
                my $ci_id = ModCourseItem(
88
                    itemnumber            => $item->id,
89
                    biblionumber          => $item->biblionumber,
90
                    itype                 => $itype,
91
                    ccode                 => $ccode,
92
                    holdingbranch         => $holdingbranch,
93
                    homebranch            => $homebranch,
94
                    location              => $location,
95
                    itype_enabled         => $itype_enabled,
96
                    ccode_enabled         => $ccode_enabled,
97
                    holdingbranch_enabled => $holdingbranch_enabled,
98
                    homebranch_enabled    => $homebranch_enabled,
99
                    location_enabled      => $location_enabled,
100
                );
101
102
                my $staff_note  = $cgi->param('item_staff_note');
103
                my $public_note = $cgi->param('item_public_note');
104
                my $cr_id = ModCourseReserve(
105
                    course_id   => $course_id,
106
                    ci_id       => $ci_id,
107
                    staff_note  => $staff_note,
108
                    public_note => $public_note,
109
                );
82
            }
110
            }
83
        }
84
111
85
        foreach my $item (@items) {
112
            $template->param(
86
            my $ci_id = ModCourseItem(
113
                action           => 'display_results',
87
                itemnumber            => $item->id,
114
                items_added      => \@items,
88
                itype                 => $itype,
115
                invalid_barcodes => \@invalid_barcodes,
89
                ccode                 => $ccode,
116
                course_id        => $course_id,
90
                holdingbranch         => $holdingbranch,
117
                barcodes         => 1,
91
                homebranch            => $homebranch,
92
                location              => $location,
93
                itype_enabled         => $itype_enabled,
94
                ccode_enabled         => $ccode_enabled,
95
                holdingbranch_enabled => $holdingbranch_enabled,
96
                homebranch_enabled    => $homebranch_enabled,
97
                location_enabled      => $location_enabled,
98
            );
118
            );
99
119
100
            my $cr_id = ModCourseReserve(
120
        } elsif (@biblionumbers > 0) {
101
                course_id   => $course_id,
121
            my @biblios;
102
                ci_id       => $ci_id,
122
            my @invalid_biblionumbers;
103
                staff_note  => $staff_note,
123
            for my $b (@biblionumbers) {
104
                public_note => $public_note,
124
                my $biblio = Koha::Biblios->find( $b );
125
126
                if ($biblio) {
127
                    push( @biblios, $biblio );
128
                }
129
                else {
130
                    push( @invalid_biblionumbers, $b );
131
                }
132
            }
133
134
            foreach my $biblio (@biblios) {
135
                my $ci_id = ModCourseItem(
136
                    itemnumber            => undef,
137
                    biblionumber          => $biblio->id,
138
                    itype                 => $itype,
139
                    ccode                 => $ccode,
140
                    holdingbranch         => $holdingbranch,
141
                    homebranch            => $homebranch,
142
                    location              => $location,
143
                    itype_enabled         => $itype_enabled,
144
                    ccode_enabled         => $ccode_enabled,
145
                    holdingbranch_enabled => $holdingbranch_enabled,
146
                    homebranch_enabled    => $homebranch_enabled,
147
                    location_enabled      => $location_enabled,
148
                );
149
150
                my $staff_note  = $cgi->param('biblio_staff_note');
151
                my $public_note = $cgi->param('biblio_public_note');
152
                my $cr_id = ModCourseReserve(
153
                    course_id   => $course_id,
154
                    ci_id       => $ci_id,
155
                    staff_note  => $staff_note,
156
                    public_note => $public_note,
157
                );
158
            }
159
160
            $template->param(
161
                action           => 'display_results',
162
                biblios_added    => \@biblios,
163
                invalid_biblionumbers => \@invalid_biblionumbers,
164
                course_id        => $course_id,
165
                biblionumbers    => 1,
105
            );
166
            );
106
        }
167
        }
107
108
        $template->param(
109
            action           => 'display_results',
110
            items_added      => \@items,
111
            invalid_barcodes => \@invalid_barcodes,
112
            course_id        => $course_id,
113
        );
114
    }
168
    }
115
} else {
169
} else {
116
    $template->param( action => 'invalid_course' );
170
    $template->param( action => 'invalid_course' );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (+9 lines)
Lines 165-170 Link Here
165
            </span>
165
            </span>
166
        [% END %]
166
        [% END %]
167
167
168
        [% IF course_reserves %]
169
            <span class="results_summary"><span class="label">Courses that have reserved this title: </span>
170
            [% FOREACH c IN course_reserves %]
171
                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% c.course_id | uri %]">[% c.course.course_name | html %]</a>
172
                [% IF ( loop.last ) %][% ELSE %]|[% END %]
173
            [% END %]
174
            </span>
175
        [% END %]
176
168
        [% IF ( AmazonCoverImages  || LocalCoverImages || AdlibrisEnabled || IntranetCoce || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
177
        [% IF ( AmazonCoverImages  || LocalCoverImages || AdlibrisEnabled || IntranetCoce || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
169
            </div>
178
            </div>
170
            <div class="col-xs-3 bookcoverimg">
179
            <div class="col-xs-3 bookcoverimg">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt (-1 / +27 lines)
Lines 1-3 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
3
<title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 16-23 Link Here
16
        [% IF ERROR_ITEM_NOT_FOUND %]
17
        [% IF ERROR_ITEM_NOT_FOUND %]
17
            [% IF UNKNOWN_BARCODE %]
18
            [% IF UNKNOWN_BARCODE %]
18
                <div class="dialog alert">No item found with barcode [% UNKNOWN_BARCODE | html %]</div>
19
                <div class="dialog alert">No item found with barcode [% UNKNOWN_BARCODE | html %]</div>
20
            [% ELSIF UNKNOWN_BIBLIONUMBER %]
21
                <div class="dialog alert">No bibliographic record found with biblionumber [% UNKNOWN_BIBLIONUMBER | html %]</div>
19
            [% ELSE %]
22
            [% ELSE %]
20
                 <div class="dialog alert">No item found</div>
23
                 <div class="dialog alert">No item or bibliographic record found</div>
21
            [% END %]
24
            [% END %]
22
        [% END %]
25
        [% END %]
23
26
Lines 35-40 Link Here
35
                </ol>
38
                </ol>
36
            </fieldset>
39
            </fieldset>
37
40
41
            <fieldset class="rows">
42
                <legend>Or use biblionumber of a bibliographic record</legend>
43
                <ol>
44
                    <li>
45
                        <label class="required" for="biblionumber">Biblionumber:</label>
46
                        <input id="biblionumber" name="biblionumber" type="text" />
47
                    </li>
48
                </ol>
49
            </fieldset>
50
38
            <fieldset class="action">
51
            <fieldset class="action">
39
                <input type="submit" value="Submit" class="submit" />
52
                <input type="submit" value="Submit" class="submit" />
40
53
Lines 44-47 Link Here
44
    </div>
57
    </div>
45
</div>
58
</div>
46
59
60
[% MACRO jsinclude BLOCK %]
61
    <script>
62
        $(document).ready(function(){
63
            $("input[type='submit']").click(function(e){
64
                if ( $("#biblionumber").val().length > 0 && $("#barcode").val().length > 0 ) {
65
                    e.preventDefault();
66
                    alert(__("Please enter only a barcode, or only a biblionumber."));
67
                }
68
            });
69
        });
70
    </script>
71
[% END %]
72
47
[% INCLUDE 'intranet-bottom.inc' %]
73
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt (-1 / +40 lines)
Lines 17-29 Link Here
17
        <div class="col-md-8 col-md-offset-2">
17
        <div class="col-md-8 col-md-offset-2">
18
18
19
        [% IF course_reserve && !is_edit%]<div class="dialog message" id="already_on_reserve_this">This course already has this item on reserve.</div>[% END %]
19
        [% IF course_reserve && !is_edit%]<div class="dialog message" id="already_on_reserve_this">This course already has this item on reserve.</div>[% END %]
20
        [% IF course_item %]<div class="dialog message" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.count | html %]</div>[% END %]
20
        [% IF course_item %]
21
            [% IF item %]
22
                <div class="dialog message" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.count | html %]</div>
23
            [% ELSE %]
24
                <div class="dialog message" id="already_on_reserve">Number of courses reserving this bibliographic record: [% course_item.course_reserves.count | html %]</div>
25
            [% END %]
26
        [% END %]
21
27
22
        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
28
        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
23
            <input type="hidden" name="course_id" value="[% course.course_id | html %]" />
29
            <input type="hidden" name="course_id" value="[% course.course_id | html %]" />
24
            <input type="hidden" name="return" value="[% return | html %]" />
30
            <input type="hidden" name="return" value="[% return | html %]" />
25
            <input type="hidden" name="action" value="add" />
31
            <input type="hidden" name="action" value="add" />
26
32
33
            [% IF item # adding an item to course items %]
34
27
            <fieldset class="rows">
35
            <fieldset class="rows">
28
                [% IF is_edit || course_reserve %]
36
                [% IF is_edit || course_reserve %]
29
                    <legend>Edit <em>[% biblio.title | html %]</em> in <em>[% course.course_name | html %]</em></legend>
37
                    <legend>Edit <em>[% biblio.title | html %]</em> in <em>[% course.course_name | html %]</em></legend>
Lines 35-40 Link Here
35
                        <span class="label">Barcode:</span>
43
                        <span class="label">Barcode:</span>
36
                        <span id="barcode">[% item.barcode | html %]</span>
44
                        <span id="barcode">[% item.barcode | html %]</span>
37
                        <input type="hidden" name="itemnumber" value="[% item.itemnumber | html %]" />
45
                        <input type="hidden" name="itemnumber" value="[% item.itemnumber | html %]" />
46
                        <input type="hidden" name="biblionumber" value="[% item.biblionumber | html %]" />
38
                    </li>
47
                    </li>
39
48
40
                    [% IF item_level_itypes %]
49
                    [% IF item_level_itypes %]
Lines 185-190 Link Here
185
                    Checking the box next to the field label will enable changes to that field. Leave boxes unchecked to make no change.<br>
194
                    Checking the box next to the field label will enable changes to that field. Leave boxes unchecked to make no change.<br>
186
                    Any items with existing course reserves will have their <em>on reserve</em> values updated.
195
                    Any items with existing course reserves will have their <em>on reserve</em> values updated.
187
                </p>
196
                </p>
197
198
            [% ELSE # adding a biblio to course items %]
199
200
            <fieldset class="rows">
201
                [% IF is_edit || course_reserve %]
202
                    <legend>Edit <em>[% biblio.title | html %]</em> in <em>[% course.course_name | html %]</em></legend>
203
                [% ELSE %]
204
                    <legend>Add <em>[% biblio.title | html %]</em> to <em>[% course.course_name | html %]</em></legend>
205
                [% END %]
206
                <ol>
207
                    <li>
208
                        <span class="label">Biblionumber:</span>
209
                        <span id="biblionumber">[% biblio.biblionumber | html %]</span>
210
                        <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html %]" />
211
                    </li>
212
213
                    <li>
214
                        <label for="staff_note">Staff note:</label>
215
                        <textarea name="staff_note" id="staff_note">[% course_reserve.staff_note | html %]</textarea>
216
                    </li>
217
218
                    <li>
219
                        <label for="public_note">Public note:</label>
220
                        <textarea name="public_note" id="public_note">[% course_reserve.public_note | html %]</textarea>
221
                    </li>
222
223
                </ol>
224
            </fieldset>
225
226
            [% END %]
188
            <fieldset class="action">
227
            <fieldset class="action">
189
                <input type="submit" id="submit" value="Save" class="submit focus" />
228
                <input type="submit" id="submit" value="Save" class="submit focus" />
190
229
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt (-25 / +76 lines)
Lines 93-105 Link Here
93
                        </li>
93
                        </li>
94
94
95
                        <li>
95
                        <li>
96
                            <label for="staff_note">Staff note:</label>
96
                            <label for="item_staff_note">Staff note:</label>
97
                            <textarea name="staff_note" id="staff_note">[% course_reserve.staff_note | html %]</textarea>
97
                            <textarea name="item_staff_note" id="item_staff_note">[% course_reserve.staff_note | html %]</textarea>
98
                        </li>
98
                        </li>
99
99
100
                        <li>
100
                        <li>
101
                            <label for="public_note">Public note:</label>
101
                            <label for="item_public_note">Public note:</label>
102
                            <textarea name="public_note" id="public_note">[% course_reserve.public_note | html %]</textarea>
102
                            <textarea name="item_public_note" id="item_public_note">[% course_reserve.public_note | html %]</textarea>
103
                        </li>
103
                        </li>
104
                    </ol>
104
                    </ol>
105
                </fieldset>
105
                </fieldset>
Lines 109-114 Link Here
109
                    Any items with existing course reserves will have their <em>on reserve</em> values updated.
109
                    Any items with existing course reserves will have their <em>on reserve</em> values updated.
110
                </p>
110
                </p>
111
111
112
                <fieldset class="rows">
113
                    <legend>Or use biblionumbers of bibliographic records</legend>
114
                    <ol>
115
                        <li>
116
                            <label class="required" for="biblionumbers">Biblionumbers:</label>
117
                            <textarea rows="20" cols="50" id="biblionumbers" name="biblionumbers"></textarea>
118
                        </li>
119
120
                        <li>
121
                            <label for="biblio_staff_note">Staff note:</label>
122
                            <textarea name="biblio_staff_note" id="biblio_staff_note">[% course_reserve.staff_note | html %]</textarea>
123
                        </li>
124
125
                        <li>
126
                            <label for="biblio_public_note">Public note:</label>
127
                            <textarea name="biblio_public_note" id="biblio_public_note">[% course_reserve.public_note | html %]</textarea>
128
                        </li>
129
                    </ol>
130
                </fieldset>
131
112
                <fieldset class="action">
132
                <fieldset class="action">
113
                    <input type="submit" value="Submit" class="submit" />
133
                    <input type="submit" value="Submit" class="submit" />
114
134
Lines 120-146 Link Here
120
        [% IF action == 'display_results' %]
140
        [% IF action == 'display_results' %]
121
            <h1>Results</h1>
141
            <h1>Results</h1>
122
142
123
            <h3>Items added</h3>
143
            [% IF barcodes %]
124
            [% IF items_added.size > 0 %]
144
                <h3>Items added</h3>
125
                <p>The following items were added or updated:</p>
145
                [% IF items_added.size > 0 %]
126
                <ul>
146
                    <p>The following items were added or updated:</p>
127
                    [% FOREACH i IN items_added %]
147
                    <ul>
128
                        <li>[% i.biblio.title | html %] ( [% i.barcode | html %] )</li>
148
                        [% FOREACH i IN items_added %]
129
                    [% END %]
149
                            <li>[% i.biblio.title | html %] ( [% i.barcode | html %] )</li>
130
                </ul>
150
                        [% END %]
131
            [% ELSE %]
151
                    </ul>
132
                No valid item barcodes found.
152
                [% ELSE %]
133
            [% END %]
153
                    No valid item barcodes found.
134
154
                [% END %]
135
155
136
            [% IF invalid_barcodes.size > 0 %]
156
137
                <h3>Invalid barcodes</h3>
157
                [% IF invalid_barcodes.size > 0 %]
138
                <p>The following invalid barcodes were skipped:</p>
158
                    <h3>Invalid barcodes</h3>
139
                <ul>
159
                    <p>The following invalid barcodes were skipped:</p>
140
                    [% FOREACH b IN invalid_barcodes %]
160
                    <ul>
141
                        <li>[% b | html %]</li>
161
                        [% FOREACH b IN invalid_barcodes %]
142
                    [% END %]
162
                            <li>[% b | html %]</li>
143
                </ul>
163
                        [% END %]
164
                    </ul>
165
                [% END %]
166
            [% ELSIF biblionumbers %]
167
                <h3>Bibliographic records added</h3>
168
                [% IF biblios_added.size > 0 %]
169
                    <p>The following bibliographic records were added or updated:</p>
170
                    <ul>
171
                        [% FOREACH b IN biblios_added %]
172
                            <li>[% b.title | html %] ( [% b.biblionumber | html %] )</li>
173
                        [% END %]
174
                    </ul>
175
                [% ELSE %]
176
                    No valid biblionumbers found.
177
                [% END %]
178
179
180
                [% IF invalid_biblionumbers.size > 0 %]
181
                    <h3>Invalid biblionumbers</h3>
182
                    <p>The following invalid biblionumbers were skipped:</p>
183
                    <ul>
184
                        [% FOREACH b IN invalid_biblionumbers %]
185
                            <li>[% b | html %]</li>
186
                        [% END %]
187
                    </ul>
188
                [% END %]
144
            [% END %]
189
            [% END %]
145
190
146
            <p>
191
            <p>
Lines 162-167 Link Here
162
                    $('#' + $(this).data('pulldown') ).attr('disabled', 'disabled');
207
                    $('#' + $(this).data('pulldown') ).attr('disabled', 'disabled');
163
                }
208
                }
164
            });
209
            });
210
            $("input[type='submit']").click(function(e){
211
                if ( $("#biblionumbers").val().length > 0 && $("#barcodes").val().length > 0 ) {
212
                    e.preventDefault();
213
                    alert(__("Please enter only barcodes, or only biblionumbers."));
214
                }
215
            });
165
        });
216
        });
166
    //]]>
217
    //]]>
167
    </script>
218
    </script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt (-81 / +93 lines)
Lines 102-207 Link Here
102
                        <tr>
102
                        <tr>
103
                            <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio=cr.biblio %]</a></td>
103
                            <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.biblio.biblionumber | uri %]">[% INCLUDE 'biblio-title.inc' biblio=cr.biblio %]</a></td>
104
                            <td>[% cr.biblio.author | html %]</td>
104
                            <td>[% cr.biblio.author | html %]</td>
105
                            <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber | uri %]&amp;biblionumber=[% cr.biblio.biblionumber | uri %]&amp;bi=[% cr.biblioitem.biblioitemnumber | uri %]">[% cr.item.barcode | html %]</a></td>
105
106
                            <td>[% cr.item.itemcallnumber | html %]</td>
106
                            [% IF cr.item %]
107
                            [% IF item_level_itypes %]
107
                                <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber | uri %]&amp;biblionumber=[% cr.biblio.biblionumber | uri %]&amp;bi=[% cr.biblioitem.biblioitemnumber | uri %]">[% cr.item.barcode | html %]</a></td>
108
                            <td>
108
                                <td>[% cr.item.itemcallnumber | html %]</td>
109
                                [% IF cr.course_item.itype_enabled %]
109
                                [% IF item_level_itypes %]
110
                                    [% IF cr.course_item.enabled == 'yes' %]
110
                                <td>
111
                                        <strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype ) | html %]</strong>
111
                                    [% IF cr.course_item.itype_enabled %]
112
                                        ([% ItemTypes.GetDescription( cr.course_item.itype_storage ) | html %])
112
                                        [% IF cr.course_item.enabled == 'yes' %]
113
                                            <strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype ) | html %]</strong>
114
                                            ([% ItemTypes.GetDescription( cr.course_item.itype_storage ) | html %])
115
                                        [% ELSE %]
116
                                            [% ItemTypes.GetDescription( cr.course_item.itype ) | html %]
117
                                            (<strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype) | html %]</strong>)
118
                                        [% END %]
113
                                    [% ELSE %]
119
                                    [% ELSE %]
114
                                        [% ItemTypes.GetDescription( cr.course_item.itype ) | html %]
120
                                         <em>Unchanged</em>
115
                                        (<strong>[% ItemTypes.GetDescription( cr.item.effective_itemtype) | html %]</strong>)
121
                                         [% IF cr.item.itype %]
122
                                             ([% ItemTypes.GetDescription( cr.item.itype ) | html %])
123
                                         [% END %]
116
                                    [% END %]
124
                                    [% END %]
117
                                [% ELSE %]
125
                                </td>
118
                                     <em>Unchanged</em>
119
                                     [% IF cr.item.itype %]
120
                                         ([% ItemTypes.GetDescription( cr.item.itype ) | html %])
121
                                     [% END %]
122
                                [% END %]
126
                                [% END %]
123
                            </td>
127
                                <td>
124
                            [% END %]
128
                                     [% IF cr.course_item.ccode_enabled %]
125
                            <td>
129
                                         [% IF cr.course_item.enabled == 'yes' %]
126
                                 [% IF cr.course_item.ccode_enabled %]
130
                                         <strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>
127
                                     [% IF cr.course_item.enabled == 'yes' %]
131
                                            [% IF cr.item.ccode %]
128
                                     <strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>
132
                                                ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode_storage ) | html %])
129
                                        [% IF cr.item.ccode %]
133
                                            [% END %]
130
                                            ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode_storage ) | html %])
134
                                         [% ELSE %]
131
                                        [% END %]
135
                                            [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode ) | html %]
132
                                     [% ELSE %]
136
                                            [% IF cr.item.ccode %]
133
                                        [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.course_item.ccode ) | html %]
137
                                                (<strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>)
134
                                        [% IF cr.item.ccode %]
138
                                            [% END %]
135
                                            (<strong>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %]</strong>)
139
                                         [% END %]
136
                                        [% END %]
140
                                         [% ELSE %]
137
                                     [% END %]
141
                                             <em>Unchanged</em>
138
                                 [% ELSE %]
142
                                             [% IF cr.item.ccode %]
139
                                     <em>Unchanged</em>
143
                                                 ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %])
140
                                     [% IF cr.item.ccode %]
144
                                             [% END %]
141
                                         ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => cr.item.ccode ) | html %])
145
                                         [% END %]
142
                                     [% END %]
146
                                    </td>
143
                                 [% END %]
147
                                    <td>
144
                            </td>
148
                                        [% IF cr.course_item.location_enabled %]
145
                            <td>
149
                                            [% IF cr.course_item.enabled == 'yes' %]
146
                                [% IF cr.course_item.location_enabled %]
150
                                                <strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>
147
                                    [% IF cr.course_item.enabled == 'yes' %]
151
                                                [% IF cr.item.permanent_location %]
148
                                        <strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>
152
                                                    ([% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location_storage ) | html %])
149
                                        [% IF cr.item.permanent_location %]
153
                                                [% END %]
150
                                            ([% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location_storage ) | html %])
154
                                        [% ELSE %]
155
                                            [% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location ) | html %]
156
                                            [% IF cr.item.permanent_location %]
157
                                                (<strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>)
158
                                            [% END %]
151
                                        [% END %]
159
                                        [% END %]
152
                                    [% ELSE %]
160
                                    [% ELSE %]
153
                                        [% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location ) | html %]
161
                                        <em>Unchanged</em>
154
                                        [% IF cr.item.permanent_location %]
162
                                        [% IF cr.item.permanent_location %]
155
                                            (<strong>[% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %]</strong>)
163
                                            ([% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %])
156
                                        [% END %]
164
                                        [% END %]
157
                                    [% END %]
165
                                    [% END %]
158
                                [% ELSE %]
166
                                </td>
159
                                    <em>Unchanged</em>
167
                                <td>
160
                                    [% IF cr.item.permanent_location %]
168
                                    [% IF cr.course_item.homebranch_enabled %]
161
                                        ([% AuthorisedValues.GetByCode( 'LOC', cr.item.permanent_location ) | html %])
169
                                        [% IF cr.course_item.enabled == 'yes' %]
162
                                    [% END %]
170
                                            <strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>
163
                                [% END %]
171
                                            [% IF cr.item.homebranch %]
164
                            </td>
172
                                                ([% Branches.GetName( cr.course_item.homebranch_storage ) | html %])
165
                            <td>
173
                                            [% END %]
166
                                [% IF cr.course_item.homebranch_enabled %]
174
                                        [% ELSE %]
167
                                    [% IF cr.course_item.enabled == 'yes' %]
175
                                            [% Branches.GetName( cr.course_item.homebranch ) | html %]
168
                                        <strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>
176
                                            [% IF cr.item.homebranch %]
169
                                        [% IF cr.item.homebranch %]
177
                                                (<strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>)
170
                                            ([% Branches.GetName( cr.course_item.homebranch_storage ) | html %])
178
                                            [% END %]
171
                                        [% END %]
179
                                        [% END %]
172
                                    [% ELSE %]
180
                                    [% ELSE %]
173
                                        [% Branches.GetName( cr.course_item.homebranch ) | html %]
181
                                        <em>Unchanged</em>
174
                                        [% IF cr.item.homebranch %]
182
                                        [% IF cr.item.homebranch %]
175
                                            (<strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>)
183
                                            ([% Branches.GetName( cr.item.homebranch ) | html %])
176
                                        [% END %]
184
                                        [% END %]
177
                                    [% END %]
185
                                    [% END %]
178
                                [% ELSE %]
186
                                </td>
179
                                    <em>Unchanged</em>
187
                                <td>
180
                                    [% IF cr.item.homebranch %]
188
                                    [% IF cr.course_item.holdingbranch_enabled %]
181
                                        ([% Branches.GetName( cr.item.homebranch ) | html %])
189
                                        [% IF cr.course_item.enabled == 'yes' %]
182
                                    [% END %]
190
                                            <strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>
183
                                [% END %]
191
                                            [% IF cr.item.holdingbranch %]
184
                            </td>
192
                                                ([% Branches.GetName( cr.course_item.holdingbranch_storage ) | html %])
185
                            <td>
193
                                            [% END %]
186
                                [% IF cr.course_item.holdingbranch_enabled %]
194
                                        [% ELSE %]
187
                                    [% IF cr.course_item.enabled == 'yes' %]
195
                                            [% Branches.GetName( cr.course_item.holdingbranch ) | html %]
188
                                        <strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>
196
                                            [% IF cr.item.holdingbranch %]
189
                                        [% IF cr.item.holdingbranch %]
197
                                                (<strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>)
190
                                            ([% Branches.GetName( cr.course_item.holdingbranch_storage ) | html %])
198
                                            [% END %]
191
                                        [% END %]
199
                                        [% END %]
192
                                    [% ELSE %]
200
                                    [% ELSE %]
193
                                        [% Branches.GetName( cr.course_item.holdingbranch ) | html %]
201
                                        <em>Unchanged</em>
194
                                        [% IF cr.item.holdingbranch %]
202
                                        [% IF cr.item.holdingbranch %]
195
                                            (<strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>)
203
                                            ([% Branches.GetName( cr.item.holdingbranch ) | html %])
196
                                        [% END %]
204
                                        [% END %]
197
                                    [% END %]
205
                                    [% END %]
206
                                </td>
207
                            [% ELSE # record-level course reserve %]
208
                                [% IF ( item_level_itypes ) %]
209
                                    <td colspan="7">
198
                                [% ELSE %]
210
                                [% ELSE %]
199
                                    <em>Unchanged</em>
211
                                    <td colspan="6">
200
                                    [% IF cr.item.holdingbranch %]
201
                                        ([% Branches.GetName( cr.item.holdingbranch ) | html %])
202
                                    [% END %]
203
                                [% END %]
212
                                [% END %]
204
                            </td>
213
                                        <em>Information not available for record-level course reserve</em>
214
                                    </td>
215
                            [% END %]
216
205
                            <td>[% IF (cr.staff_note) %]
217
                            <td>[% IF (cr.staff_note) %]
206
                                    [% cr.staff_note | html %]
218
                                    [% cr.staff_note | html %]
207
                                [% ELSIF (cr.item.itemnotes_nonpublic) %]
219
                                [% ELSIF (cr.item.itemnotes_nonpublic) %]
Lines 250-256 Link Here
250
                            [% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %]
262
                            [% IF CAN_user_coursereserves_add_reserves || CAN_user_coursereserves_delete_reserves %]
251
                                <td class="actions">
263
                                <td class="actions">
252
                                    [% IF CAN_user_coursereserves_add_reserves %]
264
                                    [% IF CAN_user_coursereserves_add_reserves %]
253
                                        <a class="btn btn-default btn-xs" href="add_items.pl?course_id=[% course.course_id | html %]&amp;itemnumber=[% cr.item.itemnumber | html %]&amp;action=lookup&amp;return=[% course.course_id | html %]&amp;is_edit=1"><i class="fa fa-pencil"></i> Edit</a>
265
                                        <a class="btn btn-default btn-xs" href="add_items.pl?course_id=[% course.course_id | html %]&amp;itemnumber=[% cr.item.itemnumber | html %]&amp;biblionumber=[% cr.biblio.biblionumber | html %]&amp;action=lookup&amp;return=[% course.course_id | html %]&amp;is_edit=1"><i class="fa fa-pencil"></i> Edit</a>
254
                                    [% END %]
266
                                    [% END %]
255
267
256
                                    [% IF CAN_user_coursereserves_delete_reserves %]
268
                                    [% IF CAN_user_coursereserves_delete_reserves %]
(-)a/t/db_dependent/CourseReserves/CourseItems.t (-1 / +8 lines)
Lines 39-44 my ($biblionumber, $itemnumber) = create_bib_and_item(); Link Here
39
39
40
my $ci_id = ModCourseItem(
40
my $ci_id = ModCourseItem(
41
    itemnumber            => $itemnumber,
41
    itemnumber            => $itemnumber,
42
    biblionumber          => $biblionumber,
42
    itype_enabled         => 1,
43
    itype_enabled         => 1,
43
    ccode_enabled         => 1,
44
    ccode_enabled         => 1,
44
    homebranch_enabled    => 1,
45
    homebranch_enabled    => 1,
Lines 82-87 is($item->location, 'TH', 'Item location in course should be TH'); Link Here
82
83
83
ModCourseItem(
84
ModCourseItem(
84
    itemnumber            => $itemnumber,
85
    itemnumber            => $itemnumber,
86
    biblionumber          => $biblionumber,
85
    itype_enabled         => 1,
87
    itype_enabled         => 1,
86
    ccode_enabled         => 1,
88
    ccode_enabled         => 1,
87
    homebranch_enabled    => 1,
89
    homebranch_enabled    => 1,
Lines 158-163 is($course_item2->{ccode_storage}, '', 'Course item ccode storage should be empt Link Here
158
160
159
ModCourseItem(
161
ModCourseItem(
160
    itemnumber            => $itemnumber,
162
    itemnumber            => $itemnumber,
163
    biblionumber          => $biblionumber,
161
    itype_enabled         => 1,
164
    itype_enabled         => 1,
162
    ccode_enabled         => 1,
165
    ccode_enabled         => 1,
163
    homebranch_enabled    => 1,
166
    homebranch_enabled    => 1,
Lines 182-187 is($item->ccode, 'DVD', 'Item ccode should be DVD'); Link Here
182
185
183
ModCourseItem(
186
ModCourseItem(
184
    itemnumber            => $itemnumber,
187
    itemnumber            => $itemnumber,
188
    biblionumber          => $biblionumber,
185
    itype_enabled         => 1,
189
    itype_enabled         => 1,
186
    ccode_enabled         => 1,
190
    ccode_enabled         => 1,
187
    homebranch_enabled    => 0,             # LEAVE UNCHANGED
191
    homebranch_enabled    => 0,             # LEAVE UNCHANGED
Lines 208-213 subtest 'Ensure modifying fields on existing course items updates the item and c Link Here
208
    my ($biblionumber, $itemnumber) = create_bib_and_item();
212
    my ($biblionumber, $itemnumber) = create_bib_and_item();
209
    my $ci_id = ModCourseItem(
213
    my $ci_id = ModCourseItem(
210
        itemnumber            => $itemnumber,
214
        itemnumber            => $itemnumber,
215
        biblionumber          => $biblionumber,
211
        itype_enabled         => 0,
216
        itype_enabled         => 0,
212
        ccode_enabled         => 0,
217
        ccode_enabled         => 0,
213
        homebranch_enabled    => 0,
218
        homebranch_enabled    => 0,
Lines 299-304 subtest 'Ensure modifying fields on existing course items updates the item and c Link Here
299
    # Test removing fields from an active course item
304
    # Test removing fields from an active course item
300
    ModCourseItem(
305
    ModCourseItem(
301
        itemnumber            => $itemnumber,
306
        itemnumber            => $itemnumber,
307
        biblionumber          => $biblionumber,
302
        itype_enabled         => 0,
308
        itype_enabled         => 0,
303
        ccode_enabled         => 0,
309
        ccode_enabled         => 0,
304
        homebranch_enabled    => 0,
310
        homebranch_enabled    => 0,
Lines 346-351 subtest 'Ensure item info is preserved' => sub { Link Here
346
    #Add course item but change nothing
352
    #Add course item but change nothing
347
    my $course_item_id = ModCourseItem(
353
    my $course_item_id = ModCourseItem(
348
        itemnumber    => $item->itemnumber,
354
        itemnumber    => $item->itemnumber,
355
        biblionumber  => $biblionumber,
349
        itype         => '',
356
        itype         => '',
350
        ccode         => '',
357
        ccode         => '',
351
        holdingbranch => '',
358
        holdingbranch => '',
Lines 376-381 subtest 'Ensure item info is preserved' => sub { Link Here
376
    #Add course item but change nothing
383
    #Add course item but change nothing
377
    $course_item_id = ModCourseItem(
384
    $course_item_id = ModCourseItem(
378
        itemnumber    => $item->itemnumber,
385
        itemnumber    => $item->itemnumber,
386
        biblionumber  => $biblionumber,
379
        itype         => '',
387
        itype         => '',
380
        ccode         => '',
388
        ccode         => '',
381
        holdingbranch => '',
389
        holdingbranch => '',
382
- 

Return to bug 14237