[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6170] trunk/LedgerSMB/Setting/Sequence.pm



Revision: 6170
          http://sourceforge.net/p/ledger-smb/code/6170
Author:   einhverfr
Date:     2013-10-23 13:43:48 +0000 (Wed, 23 Oct 2013)
Log Message:
-----------
sequence logic now provides API to determine if sequence should be incremented

Modified Paths:
--------------
    trunk/LedgerSMB/Setting/Sequence.pm

Modified: trunk/LedgerSMB/Setting/Sequence.pm
===================================================================
--- trunk/LedgerSMB/Setting/Sequence.pm	2013-10-23 13:27:13 UTC (rev 6169)
+++ trunk/LedgerSMB/Setting/Sequence.pm	2013-10-23 13:43:48 UTC (rev 6170)
@@ -176,6 +176,31 @@
 
 }
 
+=head2 should_increment($vars, $fldname, [$label]);
+
+If label is provided, used to get new sequence to test.
+
+Returns true if one should increment, false otherwise.
+
+=cut
+
+
+
+sub should_increment{
+    my ($self, $vars, $fldname, $label) = @_;
+
+    if (!$vars->{$fldname}){
+       return 1;
+    }
+    if (!$vars->{setting_sequence}){
+        return 0;
+    }
+    my $sequence = $self;
+    $sequence = LedgerSMB::Setting::Sequence->get($label) if $label;
+    return 1 unless $sequence->accept_input;
+    return 0;
+}
+
 =head2 delete(label)
 
 Deletes a sequence.

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits