Lines 55-61
BEGIN {
Link Here
|
55 |
|
55 |
|
56 |
# function exports |
56 |
# function exports |
57 |
@EXPORT = qw( |
57 |
@EXPORT = qw( |
58 |
GetItem |
|
|
59 |
AddItemFromMarc |
58 |
AddItemFromMarc |
60 |
AddItem |
59 |
AddItem |
61 |
AddItemBatchFromMarc |
60 |
AddItemBatchFromMarc |
Lines 112-123
indexed (e.g., by Zebra), but means that each item
Link Here
|
112 |
modification transaction must keep the items table |
111 |
modification transaction must keep the items table |
113 |
and the MARC XML in sync at all times. |
112 |
and the MARC XML in sync at all times. |
114 |
|
113 |
|
115 |
Consequently, all code that creates, modifies, or deletes |
|
|
116 |
item records B<must> use an appropriate function from |
117 |
C<C4::Items>. If no existing function is suitable, it is |
118 |
better to add one to C<C4::Items> than to use add |
119 |
one-off SQL statements to add or modify items. |
120 |
|
121 |
The items table will be considered authoritative. In other |
114 |
The items table will be considered authoritative. In other |
122 |
words, if there is ever a discrepancy between the items |
115 |
words, if there is ever a discrepancy between the items |
123 |
table and the MARC XML, the items table should be considered |
116 |
table and the MARC XML, the items table should be considered |
Lines 135-175
of C<C4::Items>
Link Here
|
135 |
|
128 |
|
136 |
=cut |
129 |
=cut |
137 |
|
130 |
|
138 |
=head2 GetItem |
|
|
139 |
|
140 |
$item = GetItem($itemnumber,$barcode,$serial); |
141 |
|
142 |
Return item information, for a given itemnumber or barcode. |
143 |
The return value is a hashref mapping item column |
144 |
names to values. If C<$serial> is true, include serial publication data. |
145 |
|
146 |
=cut |
147 |
|
148 |
sub GetItem { |
149 |
my ($itemnumber,$barcode, $serial) = @_; |
150 |
my $dbh = C4::Context->dbh; |
151 |
|
152 |
my $item; |
153 |
if ($itemnumber) { |
154 |
$item = Koha::Items->find( $itemnumber ); |
155 |
} else { |
156 |
$item = Koha::Items->find( { barcode => $barcode } ); |
157 |
} |
158 |
|
159 |
return unless ( $item ); |
160 |
|
161 |
my $data = $item->unblessed(); |
162 |
$data->{itype} = $item->effective_itemtype(); # set the correct itype |
163 |
|
164 |
if ($serial) { |
165 |
my $ssth = $dbh->prepare("SELECT serialseq,publisheddate from serialitems left join serial on serialitems.serialid=serial.serialid where serialitems.itemnumber=?"); |
166 |
$ssth->execute( $data->{'itemnumber'} ); |
167 |
( $data->{'serialseq'}, $data->{'publisheddate'} ) = $ssth->fetchrow_array(); |
168 |
} |
169 |
|
170 |
return $data; |
171 |
} # sub GetItem |
172 |
|
173 |
=head2 CartToShelf |
131 |
=head2 CartToShelf |
174 |
|
132 |
|
175 |
CartToShelf($itemnumber); |
133 |
CartToShelf($itemnumber); |
176 |
- |
|
|