Email invoices to users
This commit is contained in:
@@ -155,37 +155,38 @@ class Auth_OSB extends Auth_ORM {
|
||||
$mmto = ORM::factory('module_method_token',array('token'=>$token));
|
||||
$user = FALSE;
|
||||
|
||||
// Ignore the token if it doesnt exist.
|
||||
if ($mmto->loaded()) {
|
||||
if (! is_null($mmto->date_expire) AND $mmto->date_expire < time()) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Token Not Valid'),
|
||||
'type'=>'warning',
|
||||
'body'=>_('Token expired')));
|
||||
// Check that the token is for this URI
|
||||
$mo = ORM::factory('module',array('name'=>Request::current()->controller()));
|
||||
$mmo = ORM::factory('module_method',array(
|
||||
'module_id'=>$mo->id,
|
||||
'name'=>Request::current()->directory() ? sprintf('%s_%s',Request::current()->directory(),Request::current()->action()) : Request::current()->action()
|
||||
));
|
||||
|
||||
// @todo Log the token deletion
|
||||
Session::instance()->delete('token');
|
||||
$mmto->delete();
|
||||
// Ignore the token if this is not the right method.
|
||||
if ($mmo->id == $mmto->method_id) {
|
||||
if (! is_null($mmto->date_expire) AND $mmto->date_expire < time()) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Token Not Valid'),
|
||||
'type'=>'warning',
|
||||
'body'=>_('Token expired')));
|
||||
|
||||
} elseif (! is_null($mmto->uses) AND $mmto->uses < 1) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Token Not Valid'),
|
||||
'type'=>'warning',
|
||||
'body'=>_('Token expired')));
|
||||
// @todo Log the token deletion
|
||||
Session::instance()->delete('token');
|
||||
$mmto->delete();
|
||||
|
||||
// @todo Log the token deletion
|
||||
Session::instance()->delete('token');
|
||||
$mmto->delete();
|
||||
} elseif (! is_null($mmto->uses) AND $mmto->uses < 1) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Token Not Valid'),
|
||||
'type'=>'warning',
|
||||
'body'=>_('Token expired')));
|
||||
|
||||
} else {
|
||||
// Check that the token is for this URI
|
||||
$mo = ORM::factory('module',array('name'=>Request::current()->controller()));
|
||||
$mmo = ORM::factory('module_method',array(
|
||||
'module_id'=>$mo->id,
|
||||
'name'=>Request::current()->directory() ? sprintf('%s_%s',Request::current()->directory(),Request::current()->action()) : Request::current()->action()
|
||||
));
|
||||
// @todo Log the token deletion
|
||||
Session::instance()->delete('token');
|
||||
$mmto->delete();
|
||||
|
||||
// Ignore the token if this is not the right method.
|
||||
if ($mmo->id == $mmto->method_id) {
|
||||
} else {
|
||||
// If this is a usage count token, reduce the count.
|
||||
if (! is_null($mmto->uses))
|
||||
$mmto->uses -= 1;
|
||||
|
@@ -30,6 +30,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
|
||||
25,
|
||||
array(
|
||||
'due_date'=>array('label'=>'Due Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'=>'Account'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
|
||||
@@ -48,6 +49,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
|
||||
25,
|
||||
array(
|
||||
'due_date'=>array('label'=>'Due Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'=>'Account'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
|
||||
@@ -66,6 +68,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
|
||||
25,
|
||||
array(
|
||||
'due_date'=>array('label'=>'Due Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>'user/invoice/view/'),
|
||||
@@ -85,6 +88,7 @@ class Controller_Admin_Welcome extends Controller_TemplateDefault {
|
||||
25,
|
||||
array(
|
||||
'date_payment'=>array('label'=>'Pay Date'),
|
||||
'account->accnum()'=>array('label'=>'Num'),
|
||||
'account->name()'=>array('label'=>'Account'),
|
||||
'account->display("status")'=>array('label'=>'Active'),
|
||||
'id'=>array('label'=>'ID','url'=>'user/payment/view/'),
|
||||
|
@@ -135,6 +135,7 @@ class Controller_lnApp_Login extends Controller_TemplateDefault {
|
||||
$mmto = ORM::factory('module_method_token')
|
||||
->method(array('account','user_resetpassword'))
|
||||
->account($ao)
|
||||
->uses(2)
|
||||
->expire(time()+$token_expire*60);
|
||||
|
||||
if ($mmto->generate()) {
|
||||
|
@@ -54,12 +54,6 @@ class Controller_User_Account extends Controller_TemplateDefault_User {
|
||||
'body'=>_('Your updates didnt pass validation.').'<br/>'.$output,
|
||||
));
|
||||
}
|
||||
else
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Record NOT updated'),
|
||||
'type'=>'info',
|
||||
'body'=>_('Your account has NOT been updated.')
|
||||
));
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('Password Reset'),
|
||||
|
@@ -74,7 +74,7 @@ abstract class lnApp_Config extends Kohana_Config {
|
||||
|
||||
public static function logo_uri() {
|
||||
list ($path,$suffix) = explode('.',static::$logo);
|
||||
return Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename()));
|
||||
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),'http');
|
||||
}
|
||||
|
||||
public static function logo() {
|
||||
|
@@ -63,7 +63,7 @@ class Model_Auth_UserDefault extends Model_Auth_User {
|
||||
* Test to see if a record has been changed
|
||||
*/
|
||||
public function changed() {
|
||||
return ! (empty($this->_changed));
|
||||
return (count($this->_changed));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user