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

SF.net SVN: ledger-smb: [1174] trunk



Revision: 1174
          http://svn.sourceforge.net/ledger-smb/?rev=1174&view=rev
Author:   einhverfr
Date:     2007-05-08 09:59:05 -0700 (Tue, 08 May 2007)

Log Message:
-----------
Adding copy=> and merge=>..hidden.. args to DBObject->new

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject.pm
    trunk/LedgerSMB.pm

Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm	2007-05-08 16:28:28 UTC (rev 1173)
+++ trunk/LedgerSMB/DBObject.pm	2007-05-08 16:59:05 UTC (rev 1174)
@@ -47,21 +47,30 @@
     $type =~ m/::(.*?)$/;
     $type = lc $1;
     print "Type: $type\n";
-    $self->exec_method( procname => "$type" . "_" . $AUTOLOAD, args => ..hidden..
-        order_by => $order_by);
+    $self->exec_method( procname => "$type" . "_" . $AUTOLOAD, args => ..hidden..);
 }
 
 sub new {
     my $class = shift @_;
     my %args  = @_;
     my $base  = $args{base};
+    my $mode  = $args{copy};
+    my @mergelist = @{$args{merge}};
     my $self  = bless {}, $class;
     if ( !$base->isa('LedgerSMB') ) {
         $self->error("Constructor called without LedgerSMB object arg");
     }
 
     my $attr;
-    $self->merge($base);
+    if (lc($mode) eq 'base'){
+        $self->merge($base, 'dbh', '_roles');
+    }
+    elsif (lc($mode) eq 'list'){
+        $self->merge($base, @mergelist);
+    }
+    else {
+        $self->merge($base);
+    }
     $self;
 }
 
@@ -142,7 +151,6 @@
     }
     for ( keys %temphash ) {
         my @data;
-        my $ins_values;
         $query = "$query_type ";
         if ( $query_type eq 'UPDATE' ) {
             $query = "DELETE FROM $_ WHERE row_id = ?";

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-05-08 16:28:28 UTC (rev 1173)
+++ trunk/LedgerSMB.pm	2007-05-08 16:59:05 UTC (rev 1174)
@@ -460,8 +460,8 @@
 sub is_allowed_role {
     my $self = shift @_;
     my %args = @_;
-    my @roles = @{$args{allowed_roles}}
-    for $role (@roles){
+    my @roles = @{$args{allowed_roles}};
+    for my $role (@roles){
         if (scalar(grep /^$role$/, $self->{_roles})){
             return 1;
         }


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