[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4802] trunk
- Subject: SF.net SVN: ledger-smb:[4802] trunk
- From: ..hidden..
- Date: Tue, 29 May 2012 11:22:44 +0000
Revision: 4802
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4802&view=rev
Author: einhverfr
Date: 2012-05-29 11:22:44 +0000 (Tue, 29 May 2012)
Log Message:
-----------
Preliminarily signing off on new content management code. May still be buggy. Employees and users not moved over yet.
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/Entity/Credit_Account.pm
trunk/LedgerSMB/DBObject/Entity/Note.pm
trunk/LedgerSMB/Scripts/contact.pm
trunk/UI/Contact/divs/credit.html
Modified: trunk/LedgerSMB/DBObject/Entity/Credit_Account.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Credit_Account.pm 2012-05-29 10:49:29 UTC (rev 4801)
+++ trunk/LedgerSMB/DBObject/Entity/Credit_Account.pm 2012-05-29 11:22:44 UTC (rev 4802)
@@ -381,7 +381,66 @@
$self = $self->new(%$ref);
}
+=item get_pricematrix
+This routine gets the price matrix for the customer or vendor. This returns a
+hashref with up to two keys: pricematrix for all vendors and customers, and
+pricematrix_pricegroup for customers.
+
+=cut
+
+sub get_pricematrix {
+ my $self = shift @_;
+ my $retval = {};
+ @{$retval->{pricematrix}} = $self->exec_method(
+ funcname => 'eca__get_pricematrix'
+ );
+ if ($self->{entity_class} == 1){
+ @{$retval->{pricematrix_pricegroup}}= $self->exec_method(
+ funcname => 'eca__get_pricematrix_by_pricegroup'
+ );
+ }
+}
+
+=item delete_pricematrix($entry_id)
+
+This deletes a pricematrix line identified by $entry_id
+
+=cut
+
+sub delete_pricematrix {
+ my $self = shift @_;
+ my ($entry_id) = @_;
+ my ($retval) = $self->exec_method(funcname => 'eca__delete_pricematrix',
+ args => [$self->{credit_id}, $entry_id]
+ );
+ return $retval;
+}
+
+
+=item save_pricematrix
+
+Updates or inserts the price matrix.
+
+=cut
+
+sub save_pricematrix {
+ my ($self, $request) = @_;
+ for my $count (1 .. $request->{pm_rowcount}){
+ my $entry_id = $request->{"pm_$count"};
+ my @args = ();
+ for my $prop (qw(parts_id credit_id pricebreak price lead_time
+ partnumber validfrom validto curr entry_id)){
+ push @args, $request->{"${prop}_$entry_id"};
+ $self->execute_method(funcname => 'eca__save_pricematrix',
+ args => ..hidden..);
+ }
+ }
+}
+
+
+=back
+
=head1 COPYRIGHT
Copyright (C) 2012 The LedgerSMB Core Team. This file may be reused under the
Modified: trunk/LedgerSMB/DBObject/Entity/Note.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Entity/Note.pm 2012-05-29 10:49:29 UTC (rev 4801)
+++ trunk/LedgerSMB/DBObject/Entity/Note.pm 2012-05-29 11:22:44 UTC (rev 4802)
@@ -77,6 +77,14 @@
has 'note' => (is => 'rw', isa => 'Str');
+=item 'note_class'
+
+ID for note class (1 for entity, 3 for eca, etc)
+
+=cut
+
+has 'note_class' => (is => 'rw', isa => 'Maybe[Int]');
+
=back
=head1 METHODS
Modified: trunk/LedgerSMB/Scripts/contact.pm
===================================================================
--- trunk/LedgerSMB/Scripts/contact.pm 2012-05-29 10:49:29 UTC (rev 4801)
+++ trunk/LedgerSMB/Scripts/contact.pm 2012-05-29 11:22:44 UTC (rev 4802)
@@ -608,6 +608,31 @@
get($request);
}
+=item get_pricelist
+
+This returns and displays the pricelist. The id field is required.
+
+=cut
+
+sub get_pricelist {
+ my ($request) = @_;
+ my $credit = LedgerSMB::DBObject::Entity::Credit_Account->get_by_id(
+ $request->{credit_id}
+ );
+ my $pricelist = $credit->get_pricematrix;
+ $request->merge($credit) if $credit;
+ $request->merge($pricelist) if $pricelist;
+ my $template = LedgerSMB::Template->new(
+ user => $request->{_user},
+ path => 'UI/Contact' ,
+ template => 'pricelist',
+ format => uc($request->{format} || 'HTML'),
+ locale => $request->{_locale},
+ );
+
+ $template->render($request);
+}
+
=back
=head1 COPYRIGHT
Modified: trunk/UI/Contact/divs/credit.html
===================================================================
--- trunk/UI/Contact/divs/credit.html 2012-05-29 10:49:29 UTC (rev 4801)
+++ trunk/UI/Contact/divs/credit.html 2012-05-29 11:22:44 UTC (rev 4802)
@@ -314,17 +314,10 @@
accesskey="Q"
title="Quotation [Alt-Q]"
text = (entity_class == 1) ? text('RFQ') : text('Quotation')
- };
- INCLUDE button element_data = {
- class="submit"
- type="submit"
- name="action"
- value="pricelist"
- accesskey="P"
- title="Pricelist [Alt-P]"
- text = text('Pricelist')
- };
- END ?>
+ }; ?>
+ <A HREF="contact.pl?action=get_pricelist&credit_id=<?lsmb
+ credit_act.id ?>"><?lsmb text('Pricelist') ?></a>
+ <?lsmb END ?>
</form>
</div>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.