Bug 17220: Change hold confirmation string from 'Place hold' to 'Confirm hold'
[srvgit] / opac / opac-downloadcart.pl
index 2541701..75ab4a1 100755 (executable)
@@ -17,8 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-use warnings;
+use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use Encode qw(encode);
@@ -27,10 +26,11 @@ use C4::Auth;
 use C4::Biblio;
 use C4::Items;
 use C4::Output;
-use C4::VirtualShelves;
 use C4::Record;
 use C4::Ris;
-use C4::Csv;
+use Koha::CsvProfiles;
+use Koha::RecordProcessor;
+
 use utf8;
 my $query = new CGI;
 
@@ -39,8 +39,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
         template_name   => "opac-downloadcart.tt",
         query           => $query,
         type            => "opac",
-        authnotrequired => 1,
-        flagsrequired   => { borrow => 1 },
+        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
     }
 );
 
@@ -64,9 +63,19 @@ if ($bib_list && $format) {
 
         # Other formats
     } else {
+        my $record_processor = Koha::RecordProcessor->new({
+            filters => 'ViewPolicy'
+        });
         foreach my $biblio (@bibs) {
 
             my $record = GetMarcBiblio($biblio, 1);
+            my $framework = &GetFrameworkCode( $biblio );
+            $record_processor->options({
+                interface => 'opac',
+                frameworkcode => $framework
+            });
+            $record_processor->process($record);
+
             next unless $record;
 
             if ($format eq 'iso2709') {
@@ -79,7 +88,12 @@ if ($bib_list && $format) {
                 $output .= marc2bibtex($record, $biblio);
             }
             elsif ( $format eq 'isbd' ) {
-                $output   .= GetISBDView($biblio, "opac");
+                my $framework = GetFrameworkCode( $biblio );
+                $output   .= GetISBDView({
+                    'record'    => $record,
+                    'template'  => 'opac',
+                    'framework' => $framework,
+                });
                 $extension = "txt";
                 $type      = "text/plain";
             }
@@ -97,7 +111,7 @@ if ($bib_list && $format) {
     print $output;
 
 } else { 
-    $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
+    $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
     $template->param(bib_list => $bib_list); 
     output_html_with_http_headers $query, $cookie, $template->output;
 }