Bug 15758: Koha::Libraries - Remove GetBranches
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / koha-news.tt
index 62dd962..1cf4313 100644 (file)
@@ -1,4 +1,5 @@
 [% USE KohaDates %]
+[% USE Branches %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; News</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -112,18 +113,12 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
             <li>
                 <label for="branch">Library: </label>
                 <select id="branch" name="branch">
-                [% IF ( new_detail.branchcode == '' ) %]
-                    <option value="" selected="selected">All libraries</option>
-                [% ELSE %]
-                    <option value=""         >All libraries</option>
-                [% END %]
-                [% FOREACH branch_item IN branch_list %]
-                [% IF ( branch_item.value.branchcode == new_detail.branchcode ) %]
-                    <option value="[% branch_item.value.branchcode %]" selected="selected">[% branch_item.value.branchname %]</option>
-                [% ELSE %]
-                    <option value="[% branch_item.value.branchcode %]">[% branch_item.value.branchname %]</option>
-                [% END %]
-                [% END %]
+                    [% IF ( new_detail.branchcode == '' ) %]
+                        <option value="" selected="selected">All libraries</option>
+                    [% ELSE %]
+                        <option value=""         >All libraries</option>
+                    [% END %]
+                    [% PROCESS options_for_libraries libraries => Branches.all( selected => new_detail.branchcode, unfiltered => 1, ) %]
                 </select>
             </li>
             <li>
@@ -191,17 +186,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
                 [% ELSE %]
                 <option value=""         >All libraries</option>
                 [% END %]
-                [% FOREACH branch_item IN branch_list %]
-                [% IF ( branch_item.value.branchcode == branchcode ) %]
-                    <option value="[% branch_item.value.branchcode %]"
-                            selected="selected">[% branch_item.value.branchname %]
-                    </option>
-                [% ELSE %]
-                    <option value="[% branch_item.value.branchcode %]"
-                                    >[% branch_item.value.branchname %]
-                    </option>
-                [% END %]
-                [% END %]
+                [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode, unfiltered => 1, ) %]
             </select>
             <input type="submit" class="button" value="Filter" />
         </form>