Bug 32030: I18N - Load de-DE, es-ES, fr-FR strings
[koha-ffzg.git] / misc / export_records.pl
index b5a7291..32658cb 100755 (executable)
@@ -18,9 +18,9 @@
 
 use Modern::Perl;
 use MARC::File::XML;
-use List::MoreUtils qw(uniq);
-use Getopt::Long;
-use Pod::Usage;
+use List::MoreUtils qw( uniq );
+use Getopt::Long qw( GetOptions );
+use Pod::Usage qw( pod2usage );
 
 use Koha::Script;
 use C4::Auth;
@@ -143,21 +143,31 @@ $timestamp = ($timestamp) ? output_pref({ dt => dt_from_string($timestamp), date
 
 if ( $record_type eq 'bibs' ) {
     if ( $timestamp ) {
-        push @record_ids, $_->{biblionumber} for @{
-            $dbh->selectall_arrayref(q| (
-                SELECT biblio_metadata.biblionumber
-                FROM biblio_metadata
-                  LEFT JOIN items USING(biblionumber)
-                WHERE biblio_metadata.timestamp >= ?
-                  OR items.timestamp >= ?
-            ) UNION (
-                SELECT biblio_metadata.biblionumber
-                FROM biblio_metadata
-                  LEFT JOIN deleteditems USING(biblionumber)
-                WHERE biblio_metadata.timestamp >= ?
-                  OR deleteditems.timestamp >= ?
-            ) |, { Slice => {} }, ( $timestamp ) x 4 );
-        };
+        if (!$dont_export_items) {
+            push @record_ids, $_->{biblionumber} for @{
+                $dbh->selectall_arrayref(q| (
+                    SELECT biblio_metadata.biblionumber
+                    FROM biblio_metadata
+                      LEFT JOIN items USING(biblionumber)
+                    WHERE biblio_metadata.timestamp >= ?
+                      OR items.timestamp >= ?
+                ) UNION (
+                    SELECT biblio_metadata.biblionumber
+                    FROM biblio_metadata
+                      LEFT JOIN deleteditems USING(biblionumber)
+                    WHERE biblio_metadata.timestamp >= ?
+                      OR deleteditems.timestamp >= ?
+                ) |, { Slice => {} }, ( $timestamp ) x 4 );
+            };
+        } else {
+            push @record_ids, $_->{biblionumber} for @{
+                $dbh->selectall_arrayref(q| (
+                    SELECT biblio_metadata.biblionumber
+                    FROM biblio_metadata
+                    WHERE biblio_metadata.timestamp >= ?
+                ) |, { Slice => {} }, $timestamp );
+            };
+        }
     } else {
         my $conditions = {
             ( $starting_biblionumber or $ending_biblionumber )
@@ -232,6 +242,7 @@ if ($deleted_barcodes) {
             SELECT DISTINCT barcode
             FROM deleteditems
             WHERE deleteditems.biblionumber = ?
+            AND barcode IS NOT NULL AND barcode != ''
         |, { Slice => {} }, $record_id );
         say $_->{barcode} for @$barcode;
     }
@@ -388,11 +399,17 @@ Copyright Koha Team
 
 This file is part of Koha.
 
-Koha is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 3 of the License, or (at your option) any later version.
-
-You should have received a copy of the GNU General Public License along
-with Koha; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 =cut