|
Lines 27-33
BEGIN {
Link Here
|
| 27 |
@ISA = qw(Exporter); |
27 |
@ISA = qw(Exporter); |
| 28 |
|
28 |
|
| 29 |
@EXPORT = qw( |
29 |
@EXPORT = qw( |
| 30 |
GetItem |
|
|
| 31 |
AddItemFromMarc |
30 |
AddItemFromMarc |
| 32 |
AddItem |
31 |
AddItem |
| 33 |
AddItemBatchFromMarc |
32 |
AddItemBatchFromMarc |
|
Lines 100-111
indexed (e.g., by Zebra), but means that each item
Link Here
|
| 100 |
modification transaction must keep the items table |
99 |
modification transaction must keep the items table |
| 101 |
and the MARC XML in sync at all times. |
100 |
and the MARC XML in sync at all times. |
| 102 |
|
101 |
|
| 103 |
Consequently, all code that creates, modifies, or deletes |
|
|
| 104 |
item records B<must> use an appropriate function from |
| 105 |
C<C4::Items>. If no existing function is suitable, it is |
| 106 |
better to add one to C<C4::Items> than to use add |
| 107 |
one-off SQL statements to add or modify items. |
| 108 |
|
| 109 |
The items table will be considered authoritative. In other |
102 |
The items table will be considered authoritative. In other |
| 110 |
words, if there is ever a discrepancy between the items |
103 |
words, if there is ever a discrepancy between the items |
| 111 |
table and the MARC XML, the items table should be considered |
104 |
table and the MARC XML, the items table should be considered |
|
Lines 123-163
of C<C4::Items>
Link Here
|
| 123 |
|
116 |
|
| 124 |
=cut |
117 |
=cut |
| 125 |
|
118 |
|
| 126 |
=head2 GetItem |
|
|
| 127 |
|
| 128 |
$item = GetItem($itemnumber,$barcode,$serial); |
| 129 |
|
| 130 |
Return item information, for a given itemnumber or barcode. |
| 131 |
The return value is a hashref mapping item column |
| 132 |
names to values. If C<$serial> is true, include serial publication data. |
| 133 |
|
| 134 |
=cut |
| 135 |
|
| 136 |
sub GetItem { |
| 137 |
my ($itemnumber,$barcode, $serial) = @_; |
| 138 |
my $dbh = C4::Context->dbh; |
| 139 |
|
| 140 |
my $item; |
| 141 |
if ($itemnumber) { |
| 142 |
$item = Koha::Items->find( $itemnumber ); |
| 143 |
} else { |
| 144 |
$item = Koha::Items->find( { barcode => $barcode } ); |
| 145 |
} |
| 146 |
|
| 147 |
return unless ( $item ); |
| 148 |
|
| 149 |
my $data = $item->unblessed(); |
| 150 |
$data->{itype} = $item->effective_itemtype(); # set the correct itype |
| 151 |
|
| 152 |
if ($serial) { |
| 153 |
my $ssth = $dbh->prepare("SELECT serialseq,publisheddate from serialitems left join serial on serialitems.serialid=serial.serialid where serialitems.itemnumber=?"); |
| 154 |
$ssth->execute( $data->{'itemnumber'} ); |
| 155 |
( $data->{'serialseq'}, $data->{'publisheddate'} ) = $ssth->fetchrow_array(); |
| 156 |
} |
| 157 |
|
| 158 |
return $data; |
| 159 |
} # sub GetItem |
| 160 |
|
| 161 |
=head2 CartToShelf |
119 |
=head2 CartToShelf |
| 162 |
|
120 |
|
| 163 |
CartToShelf($itemnumber); |
121 |
CartToShelf($itemnumber); |
| 164 |
- |
|
|