Lines 41-47
BEGIN {
Link Here
|
41 |
&GetPrinters &GetPrinter |
41 |
&GetPrinters &GetPrinter |
42 |
&GetItemTypes &getitemtypeinfo |
42 |
&GetItemTypes &getitemtypeinfo |
43 |
&GetItemTypesCategorized &GetItemTypesByCategory |
43 |
&GetItemTypesCategorized &GetItemTypesByCategory |
44 |
&GetSupportName &GetSupportList |
|
|
45 |
&getframeworks &getframeworkinfo |
44 |
&getframeworks &getframeworkinfo |
46 |
&GetFrameworksLoop |
45 |
&GetFrameworksLoop |
47 |
&getallthemes |
46 |
&getallthemes |
Lines 92-170
Koha.pm provides many functions for Koha scripts.
Link Here
|
92 |
|
91 |
|
93 |
=cut |
92 |
=cut |
94 |
|
93 |
|
95 |
=head2 GetSupportName |
|
|
96 |
|
97 |
$itemtypename = &GetSupportName($codestring); |
98 |
|
99 |
Returns a string with the name of the itemtype. |
100 |
|
101 |
=cut |
102 |
|
103 |
sub GetSupportName{ |
104 |
my ($codestring)=@_; |
105 |
return if (! $codestring); |
106 |
my $resultstring; |
107 |
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); |
108 |
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { |
109 |
my $query = qq| |
110 |
SELECT description |
111 |
FROM itemtypes |
112 |
WHERE itemtype=? |
113 |
order by description |
114 |
|; |
115 |
my $sth = C4::Context->dbh->prepare($query); |
116 |
$sth->execute($codestring); |
117 |
($resultstring)=$sth->fetchrow; |
118 |
return $resultstring; |
119 |
} else { |
120 |
my $sth = |
121 |
C4::Context->dbh->prepare( |
122 |
"SELECT lib FROM authorised_values WHERE category = ? AND authorised_value = ?" |
123 |
); |
124 |
$sth->execute( $advanced_search_types, $codestring ); |
125 |
my $data = $sth->fetchrow_hashref; |
126 |
return $$data{'lib'}; |
127 |
} |
128 |
|
129 |
} |
130 |
=head2 GetSupportList |
131 |
|
132 |
$itemtypes = &GetSupportList(); |
133 |
|
134 |
Returns an array ref containing informations about Support (since itemtype is rather a circulation code when item-level-itypes is used). |
135 |
|
136 |
build a HTML select with the following code : |
137 |
|
138 |
=head3 in PERL SCRIPT |
139 |
|
140 |
my $itemtypes = GetSupportList(); |
141 |
$template->param(itemtypeloop => $itemtypes); |
142 |
|
143 |
=head3 in TEMPLATE |
144 |
|
145 |
<select name="itemtype" id="itemtype"> |
146 |
<option value=""></option> |
147 |
[% FOREACH itemtypeloo IN itemtypeloop %] |
148 |
[% IF ( itemtypeloo.selected ) %] |
149 |
<option value="[% itemtypeloo.itemtype %]" selected="selected">[% itemtypeloo.description %]</option> |
150 |
[% ELSE %] |
151 |
<option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.description %]</option> |
152 |
[% END %] |
153 |
[% END %] |
154 |
</select> |
155 |
|
156 |
=cut |
157 |
|
158 |
sub GetSupportList{ |
159 |
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); |
160 |
if (!$advanced_search_types or $advanced_search_types =~ /itemtypes/) { |
161 |
return GetItemTypes( style => 'array' ); |
162 |
} else { |
163 |
my $advsearchtypes = GetAuthorisedValues($advanced_search_types); |
164 |
my @results= map {{itemtype=>$$_{authorised_value},description=>$$_{lib},imageurl=>$$_{imageurl}}} @$advsearchtypes; |
165 |
return \@results; |
166 |
} |
167 |
} |
168 |
=head2 GetItemTypes |
94 |
=head2 GetItemTypes |
169 |
|
95 |
|
170 |
$itemtypes = &GetItemTypes( style => $style ); |
96 |
$itemtypes = &GetItemTypes( style => $style ); |