[open-ils-commits] r16305 - trunk/Open-ILS/src/perlmods/OpenILS/Application (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 26 12:21:48 EDT 2010


Author: phasefx
Date: 2010-04-26 12:21:45 -0400 (Mon, 26 Apr 2010)
New Revision: 16305

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Log:
Don't rely on the sequence like this, using xact_start to find preceding circ renewal chain

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2010-04-26 15:16:13 UTC (rev 16304)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2010-04-26 16:21:45 UTC (rev 16305)
@@ -1537,17 +1537,14 @@
         my $target_copy = $$first_circ{'target_copy'};
         my $usr = $$first_circ{'usr'};
         my $last_circ_from_prev_chain = $e->json_query({
-            'select' => {
-                'circ' => [{
-                    'column' => 'id',
-                    'transform' => 'max'
-                }]
-            },
+            'select' => { 'circ' => ['id'] },
             'from' => 'circ', 
             'where' => {
                 target_copy => $target_copy,
-                id => { '<' => $$first_circ{'id'} }
-            }
+                xact_start => { '<' => $$first_circ{'xact_start'} }
+            },
+            'order_by' => [{ 'class'=>'circ', 'field'=>'xact_start', 'direction'=>'desc' }],
+            'limit' => 1
         })->[0];
         return undef unless $last_circ_from_prev_chain;
         return undef unless $$last_circ_from_prev_chain{'id'};
@@ -1562,17 +1559,14 @@
         my $first_circ = $e->json_query({from => ['action.circ_chain', $circ_id]})->[0];
         my $target_copy = $$first_circ{'target_copy'};
         my $last_circ_from_prev_chain = $e->json_query({
-            'select' => {
-                'circ' => [{
-                    'column' => 'id',
-                    'transform' => 'max'
-                }]
-            },
+            'select' => { 'circ' => ['id'] },
             'from' => 'circ', 
             'where' => {
                 target_copy => $target_copy,
-                id => { '<' => $$first_circ{'id'} }
-            }
+                xact_start => { '<' => $$first_circ{'xact_start'} }
+            },
+            'order_by' => [{ 'class'=>'circ', 'field'=>'xact_start', 'direction'=>'desc' }],
+            'limit' => 1
         })->[0];
         return undef unless $last_circ_from_prev_chain;
         return undef unless $$last_circ_from_prev_chain{'id'};



More information about the open-ils-commits mailing list