Revert "Bug 20341: Use AuthorisedValues plugin on the staff side"
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 19 Mar 2018 18:40:09 +0000 (15:40 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 19 Mar 2018 18:40:09 +0000 (15:40 -0300)
This reverts commit a67fdf3bd498bf1c5a90c2847570ea8eff9c52da.

I am not sure we already agreed on that: the UI let the ability to
choose different AV category for each frameworks. I think it should be
discussed widely before removing this possibility.
Even if I am pretty sure it is not handle correctly everywhere.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

catalogue/detail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

index 1d61967..f2e8fae 100755 (executable)
@@ -203,7 +203,20 @@ my $copynumbers =
 my (@itemloop, @otheritemloop, %itemfields);
 my $norequests = 1;
 
-my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => { not => undef } });
+my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => { not => undef } });
+if ( $mss->count ) {
+    $template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorised_value ) );
+}
+$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => { not => undef } });
+if ( $mss->count ) {
+    $template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorised_value ) );
+}
+$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.withdrawn', authorised_value => { not => undef } });
+if ( $mss->count ) {
+    $template->param( itemwithdrawnloop => GetAuthorisedValues( $mss->next->authorised_value) );
+}
+
+$mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => { not => undef } });
 my %materials_map;
 if ($mss->count) {
     my $materials_authvals = GetAuthorisedValues($mss->next->authorised_value);
index 635781b..d3b12b4 100644 (file)
                             <span class="intransit">In transit from [% Branches.GetName( item.transfertfrom ) %] to [% Branches.GetName( item.transfertto ) %] since [% item.transfertwhen | $KohaDates %]</span>
                         [% END %]
 
-                        [% itemlost_desc = AuthorisedValues.GetByCode( 'LOST', item.itemlost ) %]
                         [% IF ( item.itemlost ) %]
-                            [% IF itemlost_desc %]
-                                <span class="lost">[% itemlost_desc %]</span>
+                            [% IF itemlostloop %]
+                                [% FOREACH itemlostloo IN itemlostloop %]
+                                    [% IF itemlostloo.authorised_value == item.itemlost %]
+                                        <span class="lost">[% itemlostloo.lib %]</span>
+                                    [% END %]
+                                [% END %]
                             [% ELSE %]
                                 <span class="lost">Unavailable (lost or missing)</span>
                             [% END %]
                         [% END %]
 
-                        [% withdrawn_desc = AuthorisedValues.GetByCode( 'WITHDRAWN', item.withdrawn ) %]
                         [% IF ( item.withdrawn ) %]
-                            [% IF withdrawn_desc %]
-                                <span class="wdn">[% withdrawn_desc %]</span>
+                            [% IF itemwithdrawnloop %]
+                                [% FOREACH itemwithdrawnloo IN itemwithdrawnloop %]
+                                    [% IF itemwithdrawnloo.authorised_value == item.withdrawn %]
+                                        <span class="wdn">[% itemwithdrawnloo.lib %]</span>
+                                    [% END %]
+                                [% END %]
                             [% ELSE %]
                                 <span class="wdn">Withdrawn</span>
                             [% END %]
                         [% END %]
 
-                        [% damaged_desc = AuthorisedValues.GetByCode( 'DAMAGED', item.damaged ) %]
                         [% IF ( item.damaged ) %]
-                            [% IF damaged_desc %]
-                                <span class="dmg">[% damaged_desc %]</span>
+                            [% IF itemdamagedloop %]
+                                [% FOREACH itemdamagedloo IN itemdamagedloop %]
+                                    [% IF itemdamagedloo.authorised_value == item.damaged %]
+                                        <span class="dmg">[% itemdamagedloo.lib %]</span>
+                                    [% END %]
+                                [% END %]
                             [% ELSE %]
                                 <span class="dmg">Damaged</span>
                             [% END %]