From 47245b9d2a704664cb7cbc84923803fb84ada027 Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Sun, 20 Apr 2014 21:13:26 -0400
Subject: [PATCH] [PASSED QA] Bug 12115 - Follow up fix for tools/inventory's output_pref issues

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>
---
 tools/inventory.pl |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/inventory.pl b/tools/inventory.pl
index 3db63af..f79f9d6 100755
--- a/tools/inventory.pl
+++ b/tools/inventory.pl
@@ -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
-- 
1.7.2.5