Support authority records with marc_export --since user/dbs/marc_export_since
authorDan Scott <dscott@laurentian.ca>
Thu, 23 Jan 2014 04:12:25 +0000 (23:12 -0500)
committerDan Scott <dscott@laurentian.ca>
Thu, 23 Jan 2014 04:12:25 +0000 (23:12 -0500)
We can make the --since clause a little more flexible and let it handle
authority records as well.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/support-scripts/marc_export.in

index d253228..e2e0896 100755 (executable)
@@ -83,7 +83,7 @@ Usage: $0 [options]
  --timeout          Timeout for exporting a single record; increase if you
                     are using --holdings and are exporting records that
                     have a lot of items attached to them.
- --type or -t       Record type (BIBLIO, AUTHORITY) [BIBLIO]
+ --type             Record type (BIBLIO, AUTHORITY) [BIBLIO]
  --all or -a        Export all records; ignores input list
  --library          Export the bibliographic records that have attached
                     holdings for the listed library or libraries as
@@ -213,11 +213,15 @@ if ($all_records) {
     # get list of eligible ids if --since
     my %ids;
     if (defined $since) {
+        my $rtype = 'bre';
+        if ($type eq 'authority') {
+            $rtype = 'are';
+        }
         my $recids = $editor->json_query({
-            select => { bre => ['id'] },
-            from => { bre => {} },
+            select => { $rtype => ['id'] },
+            from => { $rtype => {} },
             where => {
-                '+bre' => {
+                "+$rtype" => {
                     deleted => 'f',
                     $dtype => {
                         '>=' => $since,