REPORTS_DIR=""
WORKING_DIR=""
+# collisions file processing
+ADMIN_PASSWORD=""
+MERGE_PROFILE=104 # "Backstage Field Protection"
+BIB_QUEUE=5413 # "Backstage Quarterly"
+
SCRIPT_DIR=$PWD
CURL="curl --silent --show-error --user $BACKSTAGE_USER:$BACKSTAGE_PASSWORD";
}
+function bs_import_bib_collisions {
+ bs_set_qtr_dates;
+ bs_make_dirs "quarterly"
+ CFILE="$WORKING_DIR/bib-collisions.mrc";
+
+ echo "Processing bib collisions files $CFILE"
+
+ if [ ! -f "$CFILE" ]; then
+ echo "No bib collisions file to process."
+ return;
+ fi;
+
+ if [ ! -s "$CFILE" ]; then
+ echo "Bib collisions file is empty"
+ return;
+ fi;
+
+ if [ ! -f "$WORKING_DIR/bib-collisions.bak.mrc" ]; then
+ echo "Making collisions file backup."
+ cp $CFILE "$WORKING_DIR/bib-collisions.bak.mrc";
+ else
+ echo "Collisions file backup already exists"
+ fi;
+
+ cd /openils/bin/
+ perl ./marc_stream_importer.pl \
+ --spoolfile $CFILE \
+ --user admin \
+ --password $ADMIN_PASSWORD \
+ --bib-auto-overlay-exact \
+ --bib-queue $BIB_QUEUE \
+ --merge-profile $MERGE_PROFILE
+
+ cd $SCRIPT_DIR;
+}
+
+
# Sets the start and end dates of the previous quarter.
# Probably a more elegant way to do this, oh well.
function bs_set_qtr_dates {
}
-while getopts "abqhd:" opt; do
+while getopts "abqhd:p:c" opt; do
case $opt in
d) export PGHOST=$OPTARG;;
+ p) ADMIN_PASSWORD=$OPTARG;;
a) bs_import_monthly_auths;;
q) bs_import_qtrly_results;;
b) bs_export_qtrly_bibs;;
+ c) bs_import_bib_collisions;;
h) usage;;
esac
done;