Bug 19200: Preventing warns when exporting a basket
authorAleisha Amohia <aleishaamohia@hotmail.com>
Tue, 29 Aug 2017 21:07:39 +0000 (21:07 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 22 Dec 2017 16:15:35 +0000 (13:15 -0300)
To test:
1) Go to Tools -> CSV profiles -> New CSV Profile
2) Create a new CSV profile with any name of SQL fields. Ensure profile
type: SQL and usage: basket export in acquisition
3) Go to Acquisitions -> Find or create a vendor -> Use or create a
basket
4) Click the dropdown menu next to the 'Export as CSV' button. There
should be a 'Default' option and your new CSV profile (at least)
5) Click the 'Default' option. Notice warns
6) Click the 'Export as CSV' button. Notice warns
7) Click your new CSV profile option. Notice warns
8) Apply patch and refresh page
9) Repeat steps 5-7, confirm that warns do not show
10) Confirm export still works as expected

Sponsored-by: Catalyst IT

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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

acqui/basket.pl

index 0719618..8df5f8b 100755 (executable)
@@ -170,11 +170,13 @@ if ( $op eq 'delete_confirm' ) {
         -type       => 'text/csv',
         -attachment => 'basket' . $basket->{'basketno'} . '.csv',
     );
-    if ( $query->param('csv_profile') eq 'default'){
-        print GetBasketAsCSV($query->param('basketno'), $query);
+    my $csv_profile_id = $query->param('csv_profile');
+    if (defined $csv_profile_id) {
+        # using a csv profile
+        print GetBasketAsCSV(scalar $query->param('basketno'), $query, $csv_profile_id);
     } else {
-        my $csv_profile_id = $query->param('csv_profile');
-        print  GetBasketAsCSV($query->param('basketno'), $query, $csv_profile_id);
+        # using default
+        print GetBasketAsCSV(scalar $query->param('basketno'), $query);
     }
     exit;
 } elsif ($op eq 'email') {