|
Lines 1760-1863
sub GetHiddenItemnumbers {
Link Here
|
| 1760 |
return @resultitems; |
1760 |
return @resultitems; |
| 1761 |
} |
1761 |
} |
| 1762 |
|
1762 |
|
| 1763 |
=head3 get_item_authorised_values |
|
|
| 1764 |
|
| 1765 |
find the types and values for all authorised values assigned to this item. |
| 1766 |
|
| 1767 |
parameters: itemnumber |
| 1768 |
|
| 1769 |
returns: a hashref malling the authorised value to the value set for this itemnumber |
| 1770 |
|
| 1771 |
$authorised_values = { |
| 1772 |
'CCODE' => undef, |
| 1773 |
'DAMAGED' => '0', |
| 1774 |
'LOC' => '3', |
| 1775 |
'LOST' => '0' |
| 1776 |
'NOT_LOAN' => '0', |
| 1777 |
'RESTRICTED' => undef, |
| 1778 |
'STACK' => undef, |
| 1779 |
'WITHDRAWN' => '0', |
| 1780 |
'branches' => 'CPL', |
| 1781 |
'cn_source' => undef, |
| 1782 |
'itemtypes' => 'SER', |
| 1783 |
}; |
| 1784 |
|
| 1785 |
Notes: see C4::Biblio::get_biblio_authorised_values for a similar method at the biblio level. |
| 1786 |
|
| 1787 |
=cut |
| 1788 |
|
| 1789 |
sub get_item_authorised_values { |
| 1790 |
my $itemnumber = shift; |
| 1791 |
|
| 1792 |
# assume that these entries in the authorised_value table are item level. |
| 1793 |
my $query = q(SELECT distinct authorised_value, kohafield |
| 1794 |
FROM marc_subfield_structure |
| 1795 |
WHERE kohafield like 'item%' |
| 1796 |
AND authorised_value != '' ); |
| 1797 |
|
| 1798 |
my $itemlevel_authorised_values = C4::Context->dbh->selectall_hashref( $query, 'authorised_value' ); |
| 1799 |
my $iteminfo = GetItem( $itemnumber ); |
| 1800 |
# warn( Data::Dumper->Dump( [ $itemlevel_authorised_values ], [ 'itemlevel_authorised_values' ] ) ); |
| 1801 |
my $return; |
| 1802 |
foreach my $this_authorised_value ( keys %$itemlevel_authorised_values ) { |
| 1803 |
my $field = $itemlevel_authorised_values->{ $this_authorised_value }->{'kohafield'}; |
| 1804 |
$field =~ s/^items\.//; |
| 1805 |
if ( exists $iteminfo->{ $field } ) { |
| 1806 |
$return->{ $this_authorised_value } = $iteminfo->{ $field }; |
| 1807 |
} |
| 1808 |
} |
| 1809 |
# warn( Data::Dumper->Dump( [ $return ], [ 'return' ] ) ); |
| 1810 |
return $return; |
| 1811 |
} |
| 1812 |
|
| 1813 |
=head3 get_authorised_value_images |
| 1814 |
|
| 1815 |
find a list of icons that are appropriate for display based on the |
| 1816 |
authorised values for a biblio. |
| 1817 |
|
| 1818 |
parameters: listref of authorised values, such as comes from |
| 1819 |
get_item_authorised_values or |
| 1820 |
from C4::Biblio::get_biblio_authorised_values |
| 1821 |
|
| 1822 |
returns: listref of hashrefs for each image. Each hashref looks like this: |
| 1823 |
|
| 1824 |
{ imageurl => '/intranet-tmpl/prog/img/itemtypeimg/npl/WEB.gif', |
| 1825 |
label => '', |
| 1826 |
category => '', |
| 1827 |
value => '', } |
| 1828 |
|
| 1829 |
Notes: Currently, I put on the full path to the images on the staff |
| 1830 |
side. This should either be configurable or not done at all. Since I |
| 1831 |
have to deal with 'intranet' or 'opac' in |
| 1832 |
get_biblio_authorised_values, perhaps I should be passing it in. |
| 1833 |
|
| 1834 |
=cut |
| 1835 |
|
| 1836 |
sub get_authorised_value_images { |
| 1837 |
my $authorised_values = shift; |
| 1838 |
|
| 1839 |
my @imagelist; |
| 1840 |
|
| 1841 |
my $authorised_value_list = GetAuthorisedValues(); |
| 1842 |
# warn ( Data::Dumper->Dump( [ $authorised_value_list ], [ 'authorised_value_list' ] ) ); |
| 1843 |
foreach my $this_authorised_value ( @$authorised_value_list ) { |
| 1844 |
if ( exists $authorised_values->{ $this_authorised_value->{'category'} } |
| 1845 |
&& $authorised_values->{ $this_authorised_value->{'category'} } eq $this_authorised_value->{'authorised_value'} ) { |
| 1846 |
# warn ( Data::Dumper->Dump( [ $this_authorised_value ], [ 'this_authorised_value' ] ) ); |
| 1847 |
if ( defined $this_authorised_value->{'imageurl'} ) { |
| 1848 |
push @imagelist, { imageurl => C4::Koha::getitemtypeimagelocation( 'intranet', $this_authorised_value->{'imageurl'} ), |
| 1849 |
label => $this_authorised_value->{'lib'}, |
| 1850 |
category => $this_authorised_value->{'category'}, |
| 1851 |
value => $this_authorised_value->{'authorised_value'}, }; |
| 1852 |
} |
| 1853 |
} |
| 1854 |
} |
| 1855 |
|
| 1856 |
# warn ( Data::Dumper->Dump( [ \@imagelist ], [ 'imagelist' ] ) ); |
| 1857 |
return \@imagelist; |
| 1858 |
|
| 1859 |
} |
| 1860 |
|
| 1861 |
=head1 LIMITED USE FUNCTIONS |
1763 |
=head1 LIMITED USE FUNCTIONS |
| 1862 |
|
1764 |
|
| 1863 |
The following functions, while part of the public API, |
1765 |
The following functions, while part of the public API, |