LP1108867: i18n support for holds in record details
authorDan Scott <dan@coffeecode.net>
Tue, 29 Jan 2013 10:55:10 +0000 (12:55 +0200)
committerDan Scott <dan@coffeecode.net>
Thu, 21 Feb 2013 03:30:47 +0000 (22:30 -0500)
Rather than constructing a string of "Place hold on " + "copy", etc,
just display more complete "Copy hold" / "Volume hold" / "Issue hold"
strings that have a chance of being translatable.

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Open-ILS/src/templates/opac/parts/record/copy_table.tt2

index b806f5c..d75cb20 100644 (file)
@@ -99,38 +99,52 @@ END;
             [% END # is_staff %]
             [% IF ctx.is_staff OR serial_holdings %]
             <td header='copy_header_holdable'>[%  # Show copy/volume hold links to staff (without
-                    # checking whether they have permissions to do those).
-                    overall_holdable = (
-                        copy_info.holdable == 't' AND
-                        copy_info.location_holdable == 't' AND
-                        copy_info.status_holdable == 't');
-                    IF overall_holdable;
-                        l("Place on");
-                        IF ctx.is_staff;
-                    %]
-                <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
-                    {hold_target => copy_info.id, hold_type => 'C', hold_source_page => mkurl()}) %]">[% l("copy") %]</a>
-                [%-      IF copy_info.call_number != last_cn;
-                            last_cn = copy_info.call_number;
-                            l(" / "); %]
-                <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
-                    {hold_target => copy_info.call_number, hold_type => 'V', hold_source_page => mkurl()}) %]">[% l("volume") %]</a>
-                [%-      END;
-                         IF serial_holdings;
-                            l(" / ");
-                         END;
+                # checking whether they have permissions to do those).
+                overall_holdable = (
+                    copy_info.holdable == 't' AND
+                    copy_info.location_holdable == 't' AND
+                    copy_info.status_holdable == 't'
+                );
+                IF overall_holdable;
+                    hold_link = '';
+                    param_sep = l(" / ");
+
+                    # Only staff get to place copy or volume holds
+                    IF ctx.is_staff; 
+                        hold_link = '<a href="' _
+                            mkurl(ctx.opac_root _ '/place_hold', {
+                                hold_target => copy_info.id,
+                                hold_type => 'C',
+                                hold_source_page => mkurl()
+                            }) _ '">' _ l('Copy hold') _ '</a>';
+                        IF copy_info.call_number != last_cn;
+                            last_cn = copy_info.call_number; 
+                            hold_link = hold_link _ param_sep;
+                            hold_link = hold_link _ '<a href="' _
+                                mkurl(ctx.opac_root _ '/place_hold', {
+                                    hold_target => copy_info.call_number,
+                                    hold_type => 'V',
+                                    hold_source_page => mkurl()
+                                }) _ '">' _ l('Volume hold') _ '</a>';
                         END;
                         IF serial_holdings;
-                %]
-                <a class="rdetail-issue-place-hold"
-                    href="[% mkurl(ctx.opac_root _ '/place_hold', {
-                    hold_target => copy_info.issuance, hold_type => 'I',
-                    hold_source_page => mkurl()
-                }) %]">[% l("issue") %]</a>[%-
+                            hold_link = hold_link _ param_sep;
                         END;
-                    ELSE;
-                        l("No");
-                    END %]</td>
+                    END; 
+                    IF serial_holdings; 
+                        hold_link = hold_link _
+                            '<a class="rdetail-issue-place-hold" href="' _
+                            mkurl(ctx.opac_root _ '/place_hold', {
+                                hold_target => copy_info.issuance,
+                                hold_type => 'I',
+                                hold_source_page => mkurl()
+                            }) _ '">' _ l('Issue hold') _ '</a>';
+                    END; 
+
+                    hold_link;
+                ELSE; 
+                    l("Not holdable");
+                END %]</td>
             [%- END %]
             <td header='copy_header_status'>[% copy_info.copy_status | html %]</td>
             <td header='due_date'>[%