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

SF.net SVN: ledger-smb:[3489] trunk/LedgerSMB/File.pm



Revision: 3489
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3489&view=rev
Author:   einhverfr
Date:     2011-07-11 08:58:36 +0000 (Mon, 11 Jul 2011)

Log Message:
-----------
Base class for file attachments complete

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

Modified: trunk/LedgerSMB/File.pm
===================================================================
--- trunk/LedgerSMB/File.pm	2011-07-11 08:44:34 UTC (rev 3488)
+++ trunk/LedgerSMB/File.pm	2011-07-11 08:58:36 UTC (rev 3489)
@@ -19,6 +19,7 @@
 package LedgerSMB::File;
 use Class::Struct;
 use LedgerSMB::DBObject;
+use strict;
 
 =item  attached_by_id
 
@@ -79,7 +80,7 @@
 
 =cut
 
-struct LedgerSMB::DBObject::File => {
+struct 'LedgerSMB::File' => {
    attached_by_id =>  '$',
    attached_by    =>  '$',
    attached_at    =>  '$',
@@ -185,8 +186,6 @@
 
 Lists the links directly attached to the object.
 
-=back
-
 =cut
 
 sub list_links{
@@ -228,6 +227,33 @@
 
 }
 
+=item merge(hashref)
+
+Merges in specific attributes from the ref.
+
+=cut
+
+sub merge {
+    my ($self, $ref) = @_;
+    $self->attached_by_id ($ref->{attached_by_id} || $self->attached_by_id);
+    $self->attached_by    ($ref->{attached_by}    || $self->attached_by);
+    $self->attached_at    ($ref->{attached_at}    || $self->attached_at);
+    $self->reference      ($ref->{reference}      || $self->reference);
+    $self->content        ($ref->{content}        || $self->content);
+    $self->mime_type_id   ($ref->{mime_type_id}   || $self->mime_type_id);
+    $self->mime_type_text ($ref->{mime_type_text} || $self->mime_type_text);
+    $self->file_name      ($ref->{file_name}      || $self->file_name);
+    $self->description    ($ref->{description}    || $self->description);
+    $self->id             ($ref->{id}             || $self->id);
+    $self->ref_key        ($ref->{ref_key}        || $self->ref_key);
+    $self->file_class     ($ref->{file_class}     || $self->file_class);
+    $self->src_class      ($ref->{src_class}      || $self->src_class);
+    $self->dbobject       ($ref->{dbobject}       || $self->dbobject);
+    $self->x_info         ($ref->{dbobject}       || $self->x_info);
+}
+
+=back
+
 =head1 COPYRIGHT
 
 Copyright (C) 2011 The LedgerSMB Core Team


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