use C4::Context;
use C4::Koha;
use C4::Biblio;
-use C4::Dates qw/format_date format_date_in_iso/;
+use Koha::DateUtils;
use MARC::Record;
use C4::ClassSource;
use C4::Log;
sub ModDateLastSeen {
my ($itemnumber) = @_;
- my $today = C4::Dates->new();
- ModItem({ itemlost => 0, datelastseen => $today->output("iso") }, undef, $itemnumber);
+ my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
+ ModItem({ itemlost => 0, datelastseen => $today }, undef, $itemnumber);
}
=head2 DelItem
branch => $branch,
offset => $offset,
size => $size,
- stautshash => $statushash
+ statushash => $statushash,
interface => $interface,
} );
my ( $biblionumber ) = @_;
my $dbh = C4::Context->dbh;
# note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
+ require C4::Languages;
+ my $language = C4::Languages::getlanguage();
my $query = "
SELECT items.*,
biblio.*,
serial.serialseq,
serial.publisheddate,
itemtypes.description,
+ COALESCE( localization.translation, itemtypes.description ) AS translated_description,
itemtypes.notforloan as notforloan_per_itemtype,
holding.branchurl,
holding.branchname,
LEFT JOIN serial USING (serialid)
LEFT JOIN itemtypes ON itemtypes.itemtype = "
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
+ $query .= q|
+ LEFT JOIN localization ON itemtypes.itemtype = localization.code
+ AND localization.entity = 'itemtypes'
+ AND localization.lang = ?
+ |;
+
$query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
my $sth = $dbh->prepare($query);
- $sth->execute($biblionumber);
+ $sth->execute($language, $biblionumber);
my $i = 0;
my @results;
my $serial;
(not defined $item->{'withdrawn'} or $item->{'withdrawn'} eq '')) {
$item->{'withdrawn'} = 0;
}
- if (exists $item->{'location'} && !$item->{'permanent_location'}) {
+ if (exists $item->{location}
+ and $item->{location} ne 'CART'
+ and $item->{location} ne 'PROC'
+ and not $item->{permanent_location}
+ ) {
$item->{'permanent_location'} = $item->{'location'};
}
if (exists $item->{'timestamp'}) {
sub _set_defaults_for_add {
my $item = shift;
- $item->{dateaccessioned} ||= C4::Dates->new->output('iso');
+ $item->{dateaccessioned} ||= output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
$item->{$_} ||= 0 for (qw( notforloan damaged itemlost withdrawn));
}
notforloan = ?,
damaged = ?,
itemlost = ?,
- withdrawn = ?,
+ withdrawn = ?,
itemcallnumber = ?,
coded_location_qualifier = ?,
restricted = ?,
holdingbranch = ?,
paidfor = ?,
location = ?,
- permanent_location = ?,
+ permanent_location = ?,
onloan = ?,
issues = ?,
renewals = ?,
ccode = ?,
itype = ?,
materials = ?,
- uri = ?,
+ uri = ?,
enumchron = ?,
more_subfields_xml = ?,
copynumber = ?,
stocknumber = ?
";
my $sth = $dbh->prepare($query);
- my $today = C4::Dates->today('iso');
+ my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
$sth->execute(
$item->{'biblionumber'},
$item->{'biblioitemnumber'},
#----- itemtypes
} elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
- my $sth = $dbh->prepare( "SELECT itemtype,description FROM itemtypes ORDER BY description" );
- $sth->execute;
+ my $itemtypes = GetItemTypes( style => 'array' );
push @authorised_values, ""
unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
- while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
- push @authorised_values, $itemtype;
- $authorised_lib{$itemtype} = $description;
+ for my $itemtype ( @$itemtypes ) {
+ push @authorised_values, $itemtype->{itemtype};
+ $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
}
#---- class_sources
} elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) {