[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4937] trunk
- Subject: SF.net SVN: ledger-smb:[4937] trunk
- From: ..hidden..
- Date: Thu, 21 Jun 2012 08:14:25 +0000
Revision: 4937
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4937&view=rev
Author: einhverfr
Date: 2012-06-21 08:14:25 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
File attachments for employees, customers, vendors, etc
Modified Paths:
--------------
trunk/Changelog
trunk/LedgerSMB/File.pm
trunk/LedgerSMB/Scripts/contact.pm
trunk/LedgerSMB/Scripts/employee.pm
trunk/LedgerSMB/Scripts/file.pm
trunk/UI/Contact/divs/notes.html
Modified: trunk/Changelog
===================================================================
--- trunk/Changelog 2012-06-21 06:34:05 UTC (rev 4936)
+++ trunk/Changelog 2012-06-21 08:14:25 UTC (rev 4937)
@@ -20,6 +20,8 @@
* Added description field to transaction and invoice screens (Chris T)
* Removed ability to repost/delete transactions (Chris T)
* Partsgroups can now be nested though this is not yet used by LSMB (Chris T)
+* Added file attachments to parts (Chris T)
+* Added file attachments to customers, vendors, employees, leads etc (Chris T)
New RESTful Web Services Framework
* Supports XML and JSON as input formats
Modified: trunk/LedgerSMB/File.pm
===================================================================
--- trunk/LedgerSMB/File.pm 2012-06-21 06:34:05 UTC (rev 4936)
+++ trunk/LedgerSMB/File.pm 2012-06-21 08:14:25 UTC (rev 4937)
@@ -271,10 +271,9 @@
sub list{
my ($self, $args) = @_;
- my @results = $self->exec_method(
- {funcname => 'file__list_by',
+ my @results = $self->call_procedure(
+ procname => 'file__list_by',
args => [$args->{ref_key}, $args->{file_class}]
- }
);
return @results;
}
@@ -305,7 +304,6 @@
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);
@@ -316,8 +314,6 @@
$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);
}
=item commit()
@@ -328,7 +324,7 @@
sub commit{
my ($self) = @_;
- return $self->dbobject->{dbh}->commit;
+ return $self->dbh->commit;
}
=back
Modified: trunk/LedgerSMB/Scripts/contact.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm 2012-06-21 06:34:05 UTC (rev 4936)
+++ trunk/LedgerSMB/Scripts/contact.pm 2012-06-21 08:14:25 UTC (rev 4937)
@@ -23,6 +23,7 @@
use LedgerSMB::DBObject::Entity::Contact;
use LedgerSMB::DBObject::Entity::Bank;
use LedgerSMB::DBObject::Entity::Note;
+use LedgerSMB::File;
use LedgerSMB::App_State;
use LedgerSMB::Template;
@@ -99,14 +100,21 @@
# DIVS logic
my @DIVS;
+ my @entity_files;
+ my @eca_files;
if ($company->{entity_id} or $person->{entity_id}){
- @DIVS = qw(credit address contact_info bank_act notes);
+ my $entity_id = $company->{entity_id};
+ $entity_id ||= $person->{entity_id};
+ @DIVS = qw(credit address contact_info bank_act notes files);
unshift @DIVS, 'company' if $company->{entity_id};
unshift @DIVS, 'person' if $person->{entity_id};
+ @entity_files = LedgerSMB::File->list(
+ {ref_key => $entity_id, file_class => '4'}
+ );
} else {
@DIVS = qw(company person);
}
- $request->{company_div} ||= 'company';
+ $request->{target_div} ||= 'company';
my %DIV_LABEL = (
company => $locale->text('Company'),
@@ -116,6 +124,7 @@
contact_info => $locale->text('Contact Info'),
bank_act => $locale->text('Bank Accounts'),
notes => $locale->text('Notes'),
+ files => $locale->text('Files'),
);
# DIVS contents
@@ -128,9 +137,15 @@
);
my $credit_act;
for my $ref(@credit_list){
- $credit_act = $ref
- if ($request->{credit_id} eq $ref->{id})
- or ($request->{meta_number} eq $ref->{meta_number});
+ if (($request->{credit_id} eq $ref->{id})
+ or ($request->{meta_number} eq $ref->{meta_number})){
+
+ $credit_act = $ref;
+ @eca_files = LedgerSMB::File->list(
+ {ref_key => $ref->{id}, file_class => '5'}
+ );
+
+ }
}
my $entity_class = $credit_act->{entity_class};
@@ -252,6 +267,8 @@
contacts => ..hidden..,
bank_account => ..hidden..,
notes => ..hidden..,
+ entity_files => ..hidden..,
+ eca_files => ..hidden..,
# globals
form_id => $request->{form_id},
salutations => ..hidden..,
@@ -440,8 +457,7 @@
sub save_person {
my ($request) = @_;
- use LedgerSMB::DBObject::Entity::Person2;
- my $person = LedgerSMB::DBObject::Entity::Person2->new(
+ my $person = LedgerSMB::DBObject::Entity::Person->new(
%$request
);
use Data::Dumper;
Modified: trunk/LedgerSMB/Scripts/employee.pm
===================================================================
--- trunk/LedgerSMB/Scripts/employee.pm 2012-06-21 06:34:05 UTC (rev 4936)
+++ trunk/LedgerSMB/Scripts/employee.pm 2012-06-21 08:14:25 UTC (rev 4937)
@@ -84,13 +84,17 @@
sub _main_screen {
my ($request, $employee) = @_;
my $user;
+ my @entity_files;
if ($employee->{entity_id}){
$user = LedgerSMB::DBObject::Entity::User->get($employee->{entity_id});
+ @entity_files = LedgerSMB::File->list(
+ {ref_key => $entity_id, file_class => '4'}
+ );
}
# DIVS logic
my @DIVS;
if ($employee->{entity_id}){
- @DIVS = qw(employee user wage address contact_info bank_act notes);
+ @DIVS = qw(employee user wage address contact_info bank_act notes files);
} else {
@DIVS = qw(employee);
}
@@ -104,6 +108,7 @@
contact_info => $locale->text('Contact Info'),
bank_act => $locale->text('Bank Accounts'),
notes => $locale->text('Notes'),
+ files => $locale->text('Files'),
);
if ($LedgerSMB::Scripts::employee::country::country_divs{
@@ -231,6 +236,7 @@
contacts => ..hidden..,
bank_account => ..hidden..,
notes => ..hidden..,
+ entity_files => ..hidden..,
managers => ..hidden..,
# globals
form_id => $request->{form_id},
Modified: trunk/LedgerSMB/Scripts/file.pm
===================================================================
--- trunk/LedgerSMB/Scripts/file.pm 2012-06-21 06:34:05 UTC (rev 4936)
+++ trunk/LedgerSMB/Scripts/file.pm 2012-06-21 08:14:25 UTC (rev 4937)
@@ -40,8 +40,7 @@
sub get {
my ($request) = @_;
- my $file = LedgerSMB::File->new();
- $file->dbobject(LedgerSMB::DBObject->new({base => $request}));
+ my $file = LedgerSMB::File->new(%$request);
$file->id($request->{id});
$file->file_class($request->{file_class});
$file->get();
@@ -92,8 +91,7 @@
sub attach_file {
my ($request) = @_;
- my $file = $fileclassmap->{$request->{file_class}}->new();
- $file->dbobject(LedgerSMB::DBObject->new({base => $request}));
+ my $file = $fileclassmap->{$request->{file_class}}->new(%$request);
my @fnames = $request->{_request}->upload_info;
$file->file_name($fnames[0]);
$file->merge($request);
Modified: trunk/UI/Contact/divs/notes.html
===================================================================
--- trunk/UI/Contact/divs/notes.html 2012-06-21 06:34:05 UTC (rev 4936)
+++ trunk/UI/Contact/divs/notes.html 2012-06-21 08:14:25 UTC (rev 4937)
@@ -66,3 +66,4 @@
</div>
<?lsmb END ?>
</div>
+</div>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.