my $copynumbers = GetKohaAuthorisedValues('items.copynumber', $fw);
my (@itemloop, @otheritemloop, %itemfields);
my $norequests = 1;
-my $authvalcode_items_itemlost = GetAuthValCode('items.itemlost',$fw);
-my $authvalcode_items_damaged = GetAuthValCode('items.damaged', $fw);
+
+if ( my $lost_av = GetAuthValCode('items.itemlost', $fw) ) {
+ $template->param( itemlostloop => GetAuthorisedValues( $lost_av ) );
+}
+if ( my $damaged_av = GetAuthValCode('items.damaged', $fw) ) {
+ $template->param( itemdamagedloop => GetAuthorisedValues( $damaged_av ) );
+}
my $materials_authvalcode = GetAuthValCode('items.materials', $fw);
my %materials_map;
: '';
$item->{datedue} = format_sqldatetime($item->{datedue});
- # item damaged, lost, withdrawn loops
- $item->{itemlostloop} = GetAuthorisedValues($authvalcode_items_itemlost) if $authvalcode_items_itemlost;
- if ($item->{damaged}) {
- $item->{itemdamagedloop} = GetAuthorisedValues($authvalcode_items_damaged) if $authvalcode_items_damaged;
- }
+
#get shelf location and collection code description if they are authorised value.
# same thing for copy number
my $shelfcode = $item->{'location'};
($itemnumber) and @items = (grep {$_->{'itemnumber'} == $itemnumber} @items);
foreach my $item (@items){
$item->{object} = Koha::Items->find( $item->{itemnumber} );
- $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw)) if GetAuthValCode('items.itemlost',$fw);
- $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw)) if GetAuthValCode('items.damaged',$fw);
- $item->{itemwithdrawnloop}= GetAuthorisedValues(GetAuthValCode('items.withdrawn',$fw)) if GetAuthValCode('items.withdrawn',$fw);
$item->{'collection'} = $ccodes->{ $item->{ccode} } if ($ccodes);
$item->{'itype'} = $itemtypes->{ $item->{'itype'} }->{'translated_description'};
$item->{'replacementprice'} = sprintf( "%.2f", $item->{'replacementprice'} );
}
}
+
+if ( my $lost_av = GetAuthValCode('items.itemlost', $fw) ) {
+ $template->param( itemlostloop => GetAuthorisedValues( $lost_av ) );
+}
+if ( my $damaged_av = GetAuthValCode('items.damaged', $fw) ) {
+ $template->param( itemdamagedloop => GetAuthorisedValues( $damaged_av ) );
+}
+if ( my $withdrawn_av = GetAuthValCode('items.withdrawn', $fw) ) {
+ $template->param( itemwithdrawnloop => GetAuthorisedValues( $withdrawn_av ) );
+}
+
$template->param(count => $data->{'count'},
subscriptionsnumber => $subscriptionsnumber,
subscriptiontitle => $data->{title},
[% END %]
[% IF ( item.itemlost ) %]
- [% IF ( item.itemlostloop ) %]
- [% FOREACH itemlostloo IN item.itemlostloop %]
+ [% IF itemlostloop %]
+ [% FOREACH itemlostloo IN itemlostloop %]
[% IF itemlostloo.authorised_value == item.itemlost %]
<span class="lost">[% itemlostloo.lib %]</span>
[% END %]
[% END %]
[% IF ( item.damaged ) %]
- [% IF ( item.itemdamagedloop ) %]
- [% FOREACH itemdamagedloo IN item.itemdamagedloop %]
+ [% IF itemdamagedloop %]
+ [% FOREACH itemdamagedloo IN itemdamagedloop %]
[% IF itemdamagedloo.authorised_value == item.damaged %]
<span class="dmg">[% itemdamagedloo.lib %]</span>
[% END %]
[% END %]
</li>
<li><span class="label">Current renewals:</span> [% ITEM_DAT.renewals %] </li>
- [% IF ( ITEM_DAT.itemlostloop ) %]
+ [% IF itemlostloop %]
<li><span class="label">Lost status:</span>
[% IF ( CAN_user_circulate ) %]
<form action="updateitem.pl" method="post">
<input type="hidden" name="itemnumber" value="[% ITEM_DAT.itemnumber %]" />
<select name="itemlost" >
<option value="">Choose</option>
- [% FOREACH itemlostloo IN ITEM_DAT.itemlostloop %]
+ [% FOREACH itemlostloo IN itemlostloop %]
[% IF itemlostloo.authorised_value == ITEM_DAT.itemlost %]
<option value="[% itemlostloo.authorised_value %]" selected="selected">[% itemlostloo.lib %]</option>
[% ELSE %]
<input type="hidden" name="damaged" value="[% ITEM_DAT.damaged %]" />
<input type="submit" name="submit" class="submit" value="Set status" /></form>
[% ELSE %]
- [% FOREACH itemlostloo IN ITEM_DAT.itemlostloop %]
+ [% FOREACH itemlostloo IN itemlostloop %]
[% IF ( itemlostloo.selected ) %]
[% itemlostloo.lib %]
[% END %]
<li><span class="label">Lost on:</span>[% ITEM_DAT.itemlost_on | $KohaDates %] </li>
[% END %]
[% END %]
- [% IF ( ITEM_DAT.itemdamagedloop ) %]
+ [% IF itemdamagedloop %]
<li><span class="label">Damaged status:</span>
[% IF ( CAN_user_circulate ) %]
<form action="updateitem.pl" method="post">
<input type="hidden" name="itemnumber" value="[% ITEM_DAT.itemnumber %]" />
<select name="damaged" >
<option value="">Choose</option>
- [% FOREACH itemdamagedloo IN ITEM_DAT.itemdamagedloop %]
+ [% FOREACH itemdamagedloo IN itemdamagedloop %]
[% IF itemdamagedloo.authorised_value == ITEM_DAT.damaged %]
<option value="[% itemdamagedloo.authorised_value %]" selected="selected">[% itemdamagedloo.lib %]</option>
[% ELSE %]
<input type="hidden" name="itemlost" value="[% ITEM_DAT.itemlost %]" />
<input type="submit" name="submit" class="submit" value="Set status" /></form>
[% ELSE %]
- [% FOREACH itemdamagedloo IN ITEM_DAT.itemdamagedloop %]
+ [% FOREACH itemdamagedloo IN itemdamagedloop %]
[% IF ( itemdamagedloo.selected ) %]
[% itemdamagedloo.lib %]
[% END %]
</li>
[% END %]
- [% IF ( ITEM_DAT.itemwithdrawnloop ) %]
+ [% IF itemwithdrawnloop %]
<li><span class="label">Withdrawn status:</span>
[% IF ( CAN_user_circulate ) %]
<form action="updateitem.pl" method="post">
<input type="hidden" name="itemnumber" value="[% ITEM_DAT.itemnumber %]" />
<select name="withdrawn" >
<option value="">Choose</option>
- [% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
+ [% FOREACH itemwithdrawn IN itemwithdrawnloop %]
[% IF itemwithdrawn.authorised_value == ITEM_DAT.withdrawn %]
<option value="[% itemwithdrawn.authorised_value %]" selected="selected">[% itemwithdrawn.lib %]</option>
[% ELSE %]
<input type="hidden" name="damaged" value="[% ITEM_DAT.damaged %]" />
<input type="submit" name="submit" class="submit" value="Set status" /></form>
[% ELSE %]
- [% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
+ [% FOREACH itemwithdrawn IN itemwithdrawnloop %]
[% IF itemwithdrawn.authorised_value == ITEM_DAT.withdrawn %]
[% itemwithdrawn.lib %]
[% END %]