Bug 12115: follow-up fix for tools/inventory's output_pref issues
authorMark Tompsett <mtompset@hotmail.com>
Mon, 21 Apr 2014 01:13:26 +0000 (21:13 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 28 Apr 2014 16:33:17 +0000 (16:33 +0000)
This should correct issues with the output_prefs in the
compareinv2bar logic section of tools/inventory.pl
It is a follow up to bug 11253.

TEST PLAN
---------
NOTE: There should be no distinguishable difference before and
      after the patch. This corrects a works by accident bug.

Back up DB.
Create a small barcode file from books in a given branch.

Set I18N/L10N system preference of dateformat to mm/dd/yyyy.
Go to inventory/stocktaking tool.
Browse for the barcode file.
Click submit just below the 'Use a barcode file' section.
All looks fine in mm/dd/yyyy format.

Set I18N/L10N system preference of dateformat to yyyy-mm-dd.
Go to inventory/stocktaking tool.
Browse for the barcode file.
Click submit just below the 'Use a barcode file' section.
All looks fine in yyyy-mm-dd format.

Set I18N/L10N system preference of dateformat to dd/mm/yyyy.
Go to inventory/stocktaking tool.
Browse for the barcode file.
Click submit just below the 'Use a barcode file' section.
All looks fine in dd/mm/yyyy format.

Apply patch
Restore DB (so results should be comparable to the first result)
Repeat the three testing blocks above.
There should be no visible difference.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
tools/inventory.pl

index 3db63af..f79f9d6 100755 (executable)
@@ -204,9 +204,11 @@ if ( $markseen or $op ) {
 # If "compare barcodes list to results" has been checked, we want to alert for missing items
 if ( $compareinv2barcd ) {
     # set "missing" flags for all items with a datelastseen (dls) before the choosen datelastseen (cdls)
-    my $dls = output_pref( dt_from_string( $datelastseen ), 'iso' );
+    my $dls = output_pref( { dt => dt_from_string( $datelastseen ),
+                             dateformat => 'iso' } );
     foreach my $item ( @$inventorylist ) {
-        my $cdls = output_pref( dt_from_string( $_->{datelastseen} ), 'iso' );
+        my $cdls = output_pref( { dt => dt_from_string( $_->{datelastseen} ),
+                                  dateformat => 'iso' } );
         if ( $cdls lt $dls ) {
             $item->{problem} = 'missingitem';
             # We have to push a copy of the item, not the reference