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

(-)a/C4/CourseReserves.pm (-1 / +10 lines)
Lines 56-62 BEGIN { Link Here
56
    %EXPORT_TAGS = ( 'all' => \@EXPORT_OK );
56
    %EXPORT_TAGS = ( 'all' => \@EXPORT_OK );
57
57
58
    $DEBUG = 0;
58
    $DEBUG = 0;
59
    @FIELDS = ( 'itype', 'ccode', 'holdingbranch', 'location' );
59
    @FIELDS = ( 'itype', 'ccode', 'homebranch', 'holdingbranch', 'location' );
60
}
60
}
61
61
62
=head1 NAME
62
=head1 NAME
Lines 495-500 sub _AddCourseItem { Link Here
495
    my (%params) = @_;
495
    my (%params) = @_;
496
    warn identify_myself(%params) if $DEBUG;
496
    warn identify_myself(%params) if $DEBUG;
497
497
498
    $params{homebranch} ||= undef; # Can't be empty string, FK constraint
498
    $params{holdingbranch} ||= undef; # Can't be empty string, FK constraint
499
    $params{holdingbranch} ||= undef; # Can't be empty string, FK constraint
499
500
500
    my %data = map { $_ => $params{$_} } @FIELDS;
501
    my %data = map { $_ => $params{$_} } @FIELDS;
Lines 524-529 sub _UpdateCourseItem { Link Here
524
    my $ci_id         = $params{'ci_id'};
525
    my $ci_id         = $params{'ci_id'};
525
    my $course_item   = $params{'course_item'};
526
    my $course_item   = $params{'course_item'};
526
527
528
    $params{homebranch} ||= undef; # Can't be empty string, FK constraint
527
    $params{holdingbranch} ||= undef; # Can't be empty string, FK constraint
529
    $params{holdingbranch} ||= undef; # Can't be empty string, FK constraint
528
530
529
    return unless ( $ci_id || $course_item );
531
    return unless ( $ci_id || $course_item );
Lines 539-544 sub _UpdateCourseItem { Link Here
539
        $item_fields->{itype}         = $course_item->itype         if $course_item->itype_enabled;
541
        $item_fields->{itype}         = $course_item->itype         if $course_item->itype_enabled;
540
        $item_fields->{ccode}         = $course_item->ccode         if $course_item->ccode_enabled;
542
        $item_fields->{ccode}         = $course_item->ccode         if $course_item->ccode_enabled;
541
        $item_fields->{location}      = $course_item->location      if $course_item->location_enabled;
543
        $item_fields->{location}      = $course_item->location      if $course_item->location_enabled;
544
        $item_fields->{homebranch}    = $course_item->homebranch    if $course_item->homebranch_enabled;
542
        $item_fields->{holdingbranch} = $course_item->holdingbranch if $course_item->holdingbranch_enabled;
545
        $item_fields->{holdingbranch} = $course_item->holdingbranch if $course_item->holdingbranch_enabled;
543
546
544
        Koha::Items->find( $course_item->itemnumber )
547
        Koha::Items->find( $course_item->itemnumber )
Lines 572-577 sub _RevertFields { Link Here
572
    $item_fields->{itype}         = $course_item->itype_storage         if $course_item->itype_enabled;
575
    $item_fields->{itype}         = $course_item->itype_storage         if $course_item->itype_enabled;
573
    $item_fields->{ccode}         = $course_item->ccode_storage         if $course_item->ccode_enabled;
576
    $item_fields->{ccode}         = $course_item->ccode_storage         if $course_item->ccode_enabled;
574
    $item_fields->{location}      = $course_item->location_storage      if $course_item->location_enabled;
577
    $item_fields->{location}      = $course_item->location_storage      if $course_item->location_enabled;
578
    $item_fields->{homebranch} = $course_item->homebranch_storage if $course_item->homebranch_enabled;
575
    $item_fields->{holdingbranch} = $course_item->holdingbranch_storage if $course_item->holdingbranch_enabled;
579
    $item_fields->{holdingbranch} = $course_item->holdingbranch_storage if $course_item->holdingbranch_enabled;
576
580
577
    Koha::Items->find( $course_item->itemnumber )
581
    Koha::Items->find( $course_item->itemnumber )
Lines 582-587 sub _RevertFields { Link Here
582
    $course_item->itype_storage(undef);
586
    $course_item->itype_storage(undef);
583
    $course_item->ccode_storage(undef);
587
    $course_item->ccode_storage(undef);
584
    $course_item->location_storage(undef);
588
    $course_item->location_storage(undef);
589
    $course_item->homebranch_storage(undef);
585
    $course_item->holdingbranch_storage(undef);
590
    $course_item->holdingbranch_storage(undef);
586
    $course_item->store();
591
    $course_item->store();
587
}
592
}
Lines 603-608 sub _SwapAllFields { Link Here
603
        $course_item->itype_storage( $item->effective_itemtype )    if $course_item->itype_enabled;
608
        $course_item->itype_storage( $item->effective_itemtype )    if $course_item->itype_enabled;
604
        $course_item->ccode_storage( $item->ccode )                 if $course_item->ccode_enabled;
609
        $course_item->ccode_storage( $item->ccode )                 if $course_item->ccode_enabled;
605
        $course_item->location_storage( $item->location )           if $course_item->location_enabled;
610
        $course_item->location_storage( $item->location )           if $course_item->location_enabled;
611
        $course_item->homebranch_storage( $item->homebranch )       if $course_item->homebranch_enabled;
606
        $course_item->holdingbranch_storage( $item->holdingbranch ) if $course_item->holdingbranch_enabled;
612
        $course_item->holdingbranch_storage( $item->holdingbranch ) if $course_item->holdingbranch_enabled;
607
        $course_item->store();
613
        $course_item->store();
608
614
Lines 610-615 sub _SwapAllFields { Link Here
610
        $item_fields->{itype}         = $course_item->itype         if $course_item->itype_enabled;
616
        $item_fields->{itype}         = $course_item->itype         if $course_item->itype_enabled;
611
        $item_fields->{ccode}         = $course_item->ccode         if $course_item->ccode_enabled;
617
        $item_fields->{ccode}         = $course_item->ccode         if $course_item->ccode_enabled;
612
        $item_fields->{location}      = $course_item->location      if $course_item->location_enabled;
618
        $item_fields->{location}      = $course_item->location      if $course_item->location_enabled;
619
        $item_fields->{homebranch}    = $course_item->homebranch    if $course_item->homebranch_enabled;
613
        $item_fields->{holdingbranch} = $course_item->holdingbranch if $course_item->holdingbranch_enabled;
620
        $item_fields->{holdingbranch} = $course_item->holdingbranch if $course_item->holdingbranch_enabled;
614
621
615
        Koha::Items->find( $course_item->itemnumber )
622
        Koha::Items->find( $course_item->itemnumber )
Lines 622-627 sub _SwapAllFields { Link Here
622
        $item_fields->{itype}         = $course_item->itype_storage         if $course_item->itype_enabled;
629
        $item_fields->{itype}         = $course_item->itype_storage         if $course_item->itype_enabled;
623
        $item_fields->{ccode}         = $course_item->ccode_storage         if $course_item->ccode_enabled;
630
        $item_fields->{ccode}         = $course_item->ccode_storage         if $course_item->ccode_enabled;
624
        $item_fields->{location}      = $course_item->location_storage      if $course_item->location_enabled;
631
        $item_fields->{location}      = $course_item->location_storage      if $course_item->location_enabled;
632
        $item_fields->{homebranch}    = $course_item->homebranch_storage    if $course_item->homebranch_enabled;
625
        $item_fields->{holdingbranch} = $course_item->holdingbranch_storage if $course_item->holdingbranch_enabled;
633
        $item_fields->{holdingbranch} = $course_item->holdingbranch_storage if $course_item->holdingbranch_enabled;
626
634
627
        Koha::Items->find( $course_item->itemnumber )
635
        Koha::Items->find( $course_item->itemnumber )
Lines 632-637 sub _SwapAllFields { Link Here
632
        $course_item->itype_storage(undef);
640
        $course_item->itype_storage(undef);
633
        $course_item->ccode_storage(undef);
641
        $course_item->ccode_storage(undef);
634
        $course_item->location_storage(undef);
642
        $course_item->location_storage(undef);
643
        $course_item->homebranch_storage(undef);
635
        $course_item->holdingbranch_storage(undef);
644
        $course_item->holdingbranch_storage(undef);
636
        $course_item->store();
645
        $course_item->store();
637
    }
646
    }
(-)a/course_reserves/add_items.pl (+4 lines)
Lines 93-103 if ( $action eq 'lookup' and $item ) { Link Here
93
} elsif ( $action eq 'add' ) {
93
} elsif ( $action eq 'add' ) {
94
    my $itype         = scalar $cgi->param('itype');
94
    my $itype         = scalar $cgi->param('itype');
95
    my $ccode         = scalar $cgi->param('ccode');
95
    my $ccode         = scalar $cgi->param('ccode');
96
    my $homebranch    = $cgi->param('homebranch');
96
    my $holdingbranch = scalar $cgi->param('holdingbranch');
97
    my $holdingbranch = scalar $cgi->param('holdingbranch');
97
    my $location      = scalar $cgi->param('location');
98
    my $location      = scalar $cgi->param('location');
98
99
99
    my $itype_enabled         = scalar $cgi->param('itype_enabled') ? 1 : 0;
100
    my $itype_enabled         = scalar $cgi->param('itype_enabled') ? 1 : 0;
100
    my $ccode_enabled         = scalar $cgi->param('ccode_enabled') ? 1 : 0;
101
    my $ccode_enabled         = scalar $cgi->param('ccode_enabled') ? 1 : 0;
102
    my $homebranch_enabled    = $cgi->param('homebranch_enabled') ? 1 : 0;
101
    my $holdingbranch_enabled = scalar $cgi->param('holdingbranch_enabled') ? 1 : 0;
103
    my $holdingbranch_enabled = scalar $cgi->param('holdingbranch_enabled') ? 1 : 0;
102
    my $location_enabled      = scalar $cgi->param('location_enabled') ? 1 : 0;
104
    my $location_enabled      = scalar $cgi->param('location_enabled') ? 1 : 0;
103
105
Lines 105-114 if ( $action eq 'lookup' and $item ) { Link Here
105
            itemnumber    => $itemnumber,
107
            itemnumber    => $itemnumber,
106
            itype         => $itype,
108
            itype         => $itype,
107
            ccode         => $ccode,
109
            ccode         => $ccode,
110
            homebranch    => $homebranch,
108
            holdingbranch => $holdingbranch,
111
            holdingbranch => $holdingbranch,
109
            location      => $location,
112
            location      => $location,
110
            itype_enabled         => $itype_enabled,
113
            itype_enabled         => $itype_enabled,
111
            ccode_enabled         => $ccode_enabled,
114
            ccode_enabled         => $ccode_enabled,
115
            homebranch_enabled    => $homebranch_enabled,
112
            holdingbranch_enabled => $holdingbranch_enabled,
116
            holdingbranch_enabled => $holdingbranch_enabled,
113
            location_enabled      => $location_enabled,
117
            location_enabled      => $location_enabled,
114
    );
118
    );
(-)a/installer/data/mysql/atomicupdate/bug-22630.perl (+44 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if (CheckVersion($DBversion)) {
3
    if (!column_exists('course_items', 'homebranch')) {
4
        $dbh->do(q{
5
            ALTER TABLE course_items
6
            ADD COLUMN homebranch VARCHAR(10) NULL DEFAULT NULL AFTER ccode_storage
7
        });
8
    }
9
10
    if (!foreign_key_exists('course_items', 'fk_course_items_homebranch')) {
11
        $dbh->do(q{
12
            ALTER TABLE course_items
13
            ADD CONSTRAINT fk_course_items_homebranch
14
              FOREIGN KEY (homebranch) REFERENCES branches (branchcode)
15
              ON DELETE CASCADE ON UPDATE CASCADE
16
        });
17
    }
18
19
    if (!column_exists('course_items', 'homebranch_enabled')) {
20
        $dbh->do(q{
21
            ALTER TABLE course_items
22
            ADD COLUMN homebranch_enabled tinyint(1) NOT NULL DEFAULT 0 AFTER homebranch
23
        });
24
    }
25
26
    if (!column_exists('course_items', 'homebranch_storage')) {
27
        $dbh->do(q{
28
            ALTER TABLE course_items
29
            ADD COLUMN homebranch_storage VARCHAR(10) NULL DEFAULT NULL AFTER homebranch_enabled
30
        });
31
    }
32
33
    if (!foreign_key_exists('course_items', 'fk_course_items_homebranch_storage')) {
34
        $dbh->do(q{
35
            ALTER TABLE course_items
36
            ADD CONSTRAINT fk_course_items_homebranch_storage
37
              FOREIGN KEY (homebranch_storage) REFERENCES branches (branchcode)
38
              ON DELETE CASCADE ON UPDATE CASCADE
39
        });
40
    }
41
42
    SetVersion($DBversion);
43
    print "Upgrade to $DBversion done (Bug 22630 - Add course_items.homebranch)\n";
44
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +6 lines)
Lines 3823-3828 CREATE TABLE `course_items` ( Link Here
3823
  `ccode` varchar(80) DEFAULT NULL, -- new category code for the item to have while on reserve (optional)
3823
  `ccode` varchar(80) DEFAULT NULL, -- new category code for the item to have while on reserve (optional)
3824
  `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if ccode should be changed while on course reserve
3824
  `ccode_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if ccode should be changed while on course reserve
3825
  `ccode_storage` varchar(80) DEFAULT NULL, -- a place to store the ccode when item is on course reserve
3825
  `ccode_storage` varchar(80) DEFAULT NULL, -- a place to store the ccode when item is on course reserve
3826
  `homebranch` varchar(10) DEFAULT NULL, -- new home branch for the item to have while on reserve (optional)
3827
  `homebranch_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if homebranch should be changed while on course reserve
3828
  `homebranch_storage` varchar(10) DEFAULT NULL, -- a place to store the homebranch when item is on course reserve
3826
  `holdingbranch` varchar(10) DEFAULT NULL, -- new holding branch for the item to have while on reserve (optional)
3829
  `holdingbranch` varchar(10) DEFAULT NULL, -- new holding branch for the item to have while on reserve (optional)
3827
  `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve
3830
  `holdingbranch_enabled` tinyint(1) NOT NULL DEFAULT 0, -- indicates if itype should be changed while on course reserve
3828
  `holdingbranch_storage` varchar(10) DEFAULT NULL, -- a place to store the holdingbranch when item is on course reserve
3831
  `holdingbranch_storage` varchar(10) DEFAULT NULL, -- a place to store the holdingbranch when item is on course reserve
Lines 3841-3847 CREATE TABLE `course_items` ( Link Here
3841
--
3844
--
3842
ALTER TABLE `course_items`
3845
ALTER TABLE `course_items`
3843
  ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3846
  ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
3844
  ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE;
3847
  ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
3848
  ADD CONSTRAINT fk_course_items_homebranch FOREIGN KEY (homebranch) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE,
3849
  ADD CONSTRAINT fk_course_items_homebranch_storage FOREIGN KEY (homebranch_storage) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE;
3845
3850
3846
--
3851
--
3847
-- Table structure for table `course_reserves`
3852
-- Table structure for table `course_reserves`
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt (+26 lines)
Lines 118-123 Link Here
118
                    </li>
118
                    </li>
119
119
120
                    <li>
120
                    <li>
121
                        <label class="required" for="homebranch">Home library:</label>
122
123
                        [% IF course_item.homebranch_enabled %]
124
                            <input type="checkbox" value="1" class="field-toggle" data-pulldown="homebranch" name="homebranch_enabled" id="homebranch_enabled" checked />
125
                        [% ELSE %]
126
                            <input type="checkbox" value="1" class="field-toggle" data-pulldown="homebranch" name="homebranch_enabled" id="homebranch_enabled" />
127
                        [% END %]
128
129
                        [% IF course_item.homebranch_enabled %]
130
                            <select id="homebranch" name="homebranch">
131
                        [% ELSE %]
132
                            <select id="homebranch" name="homebranch" disabled="disabled">
133
                        [% END %]
134
135
                            <option value=""></option>
136
                            [% FOREACH b IN Branches.all() %]
137
                                [% IF course_item.homebranch.defined && ( ( course.enabled == 'yes' && b.branchcode == item.homebranch ) || ( course.enabled == 'no' && b.branchcode == course_item.homebranch ) ) %]
138
                                    <option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
139
                                [% ELSE %]
140
                                    <option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
141
                                [% END %]
142
                            [% END %]
143
                        </select>
144
                    </li>
145
146
                    <li>
121
                        <label class="required" for="holdingbranch">Holding library:</label>
147
                        <label class="required" for="holdingbranch">Holding library:</label>
122
148
123
                        [% IF course_item.holdingbranch_enabled %]
149
                        [% IF course_item.holdingbranch_enabled %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt (-1 / +22 lines)
Lines 81-87 Link Here
81
                        [% IF item_level_itypes %]<th>Item type</th>[% END %]
81
                        [% IF item_level_itypes %]<th>Item type</th>[% END %]
82
                        <th>Collection</th>
82
                        <th>Collection</th>
83
                        <th>Location</th>
83
                        <th>Location</th>
84
                        <th>Library</th>
84
                        <th>Home Library</th>
85
                        <th>Holding Library</th>
85
                        <th>Staff note</th>
86
                        <th>Staff note</th>
86
                        <th>Public note</th>
87
                        <th>Public note</th>
87
                        <th>Link</th>
88
                        <th>Link</th>
Lines 159-164 Link Here
159
                                [% END %]
160
                                [% END %]
160
                            </td>
161
                            </td>
161
                            <td>
162
                            <td>
163
                                [% IF cr.course_item.homebranch_enabled %]
164
                                    [% IF cr.course_item.enabled == 'yes' %]
165
                                        <strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>
166
                                        [% IF cr.item.homebranch %]
167
                                            ([% Branches.GetName( cr.course_item.homebranch ) | html %])
168
                                        [% END %]
169
                                    [% ELSE %]
170
                                        [% Branches.GetName( cr.course_item.homebranch ) | html %]
171
                                        [% IF cr.item.homebranch %]
172
                                            (<strong>[% Branches.GetName( cr.item.homebranch ) | html %]</strong>)
173
                                        [% END %]
174
                                    [% END %]
175
                                [% ELSE %]
176
                                    <i>Unchanged</i>
177
                                    [% IF cr.item.homebranch %]
178
                                        ([% Branches.GetName( cr.item.homebranch ) | html %])
179
                                    [% END %]
180
                                [% END %]
181
                            </td>
182
                            <td>
162
                                [% IF cr.course_item.holdingbranch_enabled %]
183
                                [% IF cr.course_item.holdingbranch_enabled %]
163
                                    [% IF cr.course_item.enabled == 'yes' %]
184
                                    [% IF cr.course_item.enabled == 'yes' %]
164
                                        <strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>
185
                                        <strong>[% Branches.GetName( cr.item.holdingbranch ) | html %]</strong>
(-)a/t/db_dependent/CourseReserves/CourseItems.t (-2 / +15 lines)
Lines 23-29 use C4::CourseReserves qw/ModCourseItem ModCourseReserve DelCourseReserve GetCou Link Here
23
use C4::Context;
23
use C4::Context;
24
use Koha::Items;
24
use Koha::Items;
25
25
26
use Test::More tests => 29;
26
use Test::More tests => 34;
27
27
28
BEGIN {
28
BEGIN {
29
    require_ok('C4::CourseReserves');
29
    require_ok('C4::CourseReserves');
Lines 41-50 my $ci_id = ModCourseItem( Link Here
41
    itemnumber            => $itemnumber,
41
    itemnumber            => $itemnumber,
42
    itype_enabled         => 1,
42
    itype_enabled         => 1,
43
    ccode_enabled         => 1,
43
    ccode_enabled         => 1,
44
    homebranch_enabled    => 1,
44
    holdingbranch_enabled => 1,
45
    holdingbranch_enabled => 1,
45
    location_enabled      => 1,
46
    location_enabled      => 1,
46
    itype                 => 'BK_foo',
47
    itype                 => 'BK_foo',
47
    ccode                 => 'BOOK',
48
    ccode                 => 'BOOK',
49
    homebranch            => 'B2',
48
    holdingbranch         => 'B2',
50
    holdingbranch         => 'B2',
49
    location              => 'TH',
51
    location              => 'TH',
50
);
52
);
Lines 67-78 my $cr_id = ModCourseReserve( Link Here
67
my $course_item = GetCourseItem( ci_id => $ci_id );
69
my $course_item = GetCourseItem( ci_id => $ci_id );
68
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo');
70
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo');
69
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD');
71
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD');
72
is($course_item->{homebranch_storage}, 'B1', 'Course item holding branch storage should be B1');
70
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1');
73
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1');
71
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR');
74
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR');
72
75
73
my $item = Koha::Items->find($itemnumber);
76
my $item = Koha::Items->find($itemnumber);
74
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo');
77
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo');
75
is($item->ccode, 'BOOK', 'Item ccode in course should be BOOK');
78
is($item->ccode, 'BOOK', 'Item ccode in course should be BOOK');
79
is($item->homebranch, 'B2', 'Item home branch in course should be B2');
76
is($item->holdingbranch, 'B2', 'Item holding branch in course should be B2');
80
is($item->holdingbranch, 'B2', 'Item holding branch in course should be B2');
77
is($item->location, 'TH', 'Item location in course should be TH');
81
is($item->location, 'TH', 'Item location in course should be TH');
78
82
Lines 80-89 ModCourseItem( Link Here
80
    itemnumber            => $itemnumber,
84
    itemnumber            => $itemnumber,
81
    itype_enabled         => 1,
85
    itype_enabled         => 1,
82
    ccode_enabled         => 1,
86
    ccode_enabled         => 1,
87
    homebranch_enabled    => 1,
83
    holdingbranch_enabled => 1,
88
    holdingbranch_enabled => 1,
84
    location_enabled      => 1,
89
    location_enabled      => 1,
85
    itype                 => 'BK_foo',
90
    itype                 => 'BK_foo',
86
    ccode                 => 'DVD',
91
    ccode                 => 'DVD',
92
    homebranch            => 'B3',
87
    holdingbranch         => 'B3',
93
    holdingbranch         => 'B3',
88
    location              => 'TH',
94
    location              => 'TH',
89
);
95
);
Lines 98-109 ModCourseReserve( Link Here
98
$course_item = GetCourseItem( ci_id => $ci_id );
104
$course_item = GetCourseItem( ci_id => $ci_id );
99
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo');
105
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo');
100
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD');
106
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD');
107
is($course_item->{homebranch_storage}, 'B1', 'Course item home branch storage should be B1');
101
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1');
108
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1');
102
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR');
109
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR');
103
110
104
$item = Koha::Items->find($itemnumber);
111
$item = Koha::Items->find($itemnumber);
105
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo');
112
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo');
106
is($item->ccode, 'DVD', 'Item ccode in course should be DVD');
113
is($item->ccode, 'DVD', 'Item ccode in course should be DVD');
114
is($item->homebranch, 'B3', 'Item home branch in course should be B3');
107
is($item->holdingbranch, 'B3', 'Item holding branch in course should be B3');
115
is($item->holdingbranch, 'B3', 'Item holding branch in course should be B3');
108
is($item->location, 'TH', 'Item location in course should be TH');
116
is($item->location, 'TH', 'Item location in course should be TH');
109
117
Lines 111-116 DelCourseReserve( cr_id => $cr_id ); Link Here
111
$item = Koha::Items->find($itemnumber);
119
$item = Koha::Items->find($itemnumber);
112
is($item->effective_itemtype, 'CD_foo', 'Item type removed from course should be set back to CD_foo');
120
is($item->effective_itemtype, 'CD_foo', 'Item type removed from course should be set back to CD_foo');
113
is($item->ccode, 'CD', 'Item ccode removed from course should be set back to CD');
121
is($item->ccode, 'CD', 'Item ccode removed from course should be set back to CD');
122
is($item->homebranch, 'B1', 'Item home branch removed from course should be set back B1');
114
is($item->holdingbranch, 'B1', 'Item holding branch removed from course should be set back B1');
123
is($item->holdingbranch, 'B1', 'Item holding branch removed from course should be set back B1');
115
is($item->location, 'HR', 'Item location removed from course should be TH');
124
is($item->location, 'HR', 'Item location removed from course should be TH');
116
125
Lines 124-133 my $ci_id2 = ModCourseItem( Link Here
124
    itemnumber            => $itemnumber,
133
    itemnumber            => $itemnumber,
125
    itype_enabled         => 1,
134
    itype_enabled         => 1,
126
    ccode_enabled         => 1,
135
    ccode_enabled         => 1,
136
    homebranch_enabled    => 1,
127
    holdingbranch_enabled => 1,
137
    holdingbranch_enabled => 1,
128
    location_enabled      => 1,
138
    location_enabled      => 1,
129
    itype                 => 'CD_foo',
139
    itype                 => 'CD_foo',
130
    ccode                 => 'BOOK',
140
    ccode                 => 'BOOK',
141
    homebranch            => 'B1',
131
    holdingbranch         => 'B1',
142
    holdingbranch         => 'B1',
132
    location              => 'HR',
143
    location              => 'HR',
133
);
144
);
Lines 149-158 ModCourseItem( Link Here
149
    itemnumber            => $itemnumber,
160
    itemnumber            => $itemnumber,
150
    itype_enabled         => 1,
161
    itype_enabled         => 1,
151
    ccode_enabled         => 1,
162
    ccode_enabled         => 1,
163
    homebranch_enabled    => 1,
152
    holdingbranch_enabled => 1,
164
    holdingbranch_enabled => 1,
153
    location_enabled      => 1,
165
    location_enabled      => 1,
154
    itype                 => 'CD_foo',
166
    itype                 => 'CD_foo',
155
    ccode                 => 'DVD',
167
    ccode                 => 'DVD',
168
    homebranch            => 'B1',
156
    holdingbranch         => 'B1',
169
    holdingbranch         => 'B1',
157
    location              => 'HR',
170
    location              => 'HR',
158
);
171
);
Lines 171-176 ModCourseItem( Link Here
171
    itemnumber            => $itemnumber,
184
    itemnumber            => $itemnumber,
172
    itype_enabled         => 1,
185
    itype_enabled         => 1,
173
    ccode_enabled         => 1,
186
    ccode_enabled         => 1,
187
    homebranch_enabled    => 0,             # LEAVE UNCHANGED
174
    holdingbranch_enabled => 0,             # LEAVE UNCHANGED
188
    holdingbranch_enabled => 0,             # LEAVE UNCHANGED
175
    location_enabled      => 1,
189
    location_enabled      => 1,
176
    itype                 => 'BK',
190
    itype                 => 'BK',
177
- 

Return to bug 22630