[Jifty-commit] r4492 - in apps/spensive: . lib/Spensive/Action
lib/Spensive/Model
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Tue Nov 20 12:12:23 EST 2007
Author: jesse
Date: Tue Nov 20 12:11:53 2007
New Revision: 4492
Modified:
apps/spensive/ (props changed)
apps/spensive/lib/Spensive/Action/EmailDispatch.pm
apps/spensive/lib/Spensive/Model/Expense.pm
apps/spensive/lib/Spensive/Model/User.pm
apps/spensive/lib/Spensive/View.pm
Log:
r67473 at pinglin (orig r7381): jesse | 2007-09-21 14:27:13 -0400
checkpoint
Modified: apps/spensive/lib/Spensive/Action/EmailDispatch.pm
==============================================================================
--- apps/spensive/lib/Spensive/Action/EmailDispatch.pm (original)
+++ apps/spensive/lib/Spensive/Action/EmailDispatch.pm Tue Nov 20 12:11:53 2007
@@ -79,13 +79,10 @@
$pa->load_by_cols( published_address => $key );
if ( $pa->id && $pa->id == $id) {
- $action = Jifty->web->new_action(
- class => 'CreateEmail',
- moniker => "email_dispatch",
- arguments => {
+ my $email = Spensive::Model::Email->new();
+ $email->create(
expense => $pa->id,
message => $self->argument_value('email'),
- },
);
}
@@ -98,21 +95,8 @@
# if we have a user's expense creating address
if ( $pa->id && $pa->id == $id) {
- # We got a user
- # if a user set up auto_attributes we need to parse
- # for braindump syntax. Put them first so that if
- # auto_attributes contains [due] a [due] in Subject will clobber
-
- $action = Jifty->web->new_action(
- class => 'CreateExpense',
- moniker => "email_dispatch",
- arguments => {
- title => $summary,
- description => $body,
- incurred_by => $pa->id,
- email_content => $self->argument_value('email'),
- },
- );
+ my $expense = Spensive::Model::Expense->new();
+ $expense->create( title => $summary, description => $body, email_content => $self->argument_Value('email'), _force_incurred_by => $pa->id);
}
}
if($action) {
Modified: apps/spensive/lib/Spensive/Model/Expense.pm
==============================================================================
--- apps/spensive/lib/Spensive/Model/Expense.pm (original)
+++ apps/spensive/lib/Spensive/Model/Expense.pm Tue Nov 20 12:11:53 2007
@@ -28,13 +28,20 @@
my $args = shift;
$args->{'published_address'} = $PWGEN->generate;
- $args->{'incurred_by'} = $self->current_user->id;
+ $args->{'incurred_by'} = delete $args->{'_force_incurred_by'} || $self->current_user->id;
$args->{'date_incurred'} ||= Jifty::DateTime->now;
$self->{'_email_content'} = delete $args->{'email_content'};
return 1;
}
-sub published_address {my $self = shift; return $self->_value('published_address').$self->id."@".Jifty->config->app('EmailDomain') };
+sub published_address {
+ my $self = shift;
+ return unless $self->_value('published_address');
+
+ return $self->_value('published_address')
+ . $self->id . "@"
+ . Jifty->config->app('EmailDomain');
+}
sub after_create {
my $self = shift;
Modified: apps/spensive/lib/Spensive/Model/User.pm
==============================================================================
--- apps/spensive/lib/Spensive/Model/User.pm (original)
+++ apps/spensive/lib/Spensive/Model/User.pm Tue Nov 20 12:11:53 2007
@@ -14,7 +14,7 @@
};
-our $PWGEN = Text::Password::Pronounceable->new(6=>8);
+our $PWGEN = Text::Password::Pronounceable->new(6=>8);
sub published_address { my $self = shift; return $self->_value('published_address').$self->id."@".Jifty->config->app('EmailDomain') };
@@ -27,7 +27,6 @@
use Jifty::Plugin::User::Mixin::Model::User;
use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
-use Jifty::Plugin::OpenID::Mixin::Model::User;
# Your model-specific methods go here.
Modified: apps/spensive/lib/Spensive/View.pm
==============================================================================
--- apps/spensive/lib/Spensive/View.pm (original)
+++ apps/spensive/lib/Spensive/View.pm Tue Nov 20 12:11:53 2007
@@ -12,6 +12,7 @@
h2 { _('(It also helps you get reimbursed for them)') };
h3 { _('Unsubmitted expenses') };
+ form {
my $search = Spensive::Model::ExpenseCollection->new();
$search->limit(
column => 'expense_report',
@@ -30,6 +31,7 @@
defaults => { page => 1, id => 'xxx' }
);
+ };
span {
{ class is 'hint' };
hyperlink( label => 'All my expenses...', path => '/expenses/all' );
More information about the Jifty-commit
mailing list