Added Payment, other minor fixes
This commit is contained in:
@@ -98,7 +98,7 @@ abstract class lnApp_Config extends Kohana_Config {
|
||||
* Show a date using a site configured format
|
||||
*/
|
||||
public static function date($date) {
|
||||
return $date ? date(Kohana::config('config.date_format'),$date) : '>Not Set<';
|
||||
return $date ? date(Kohana::config('config.date_format'),$date) : '>Not Set<';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -39,7 +39,7 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
*/
|
||||
public function name($withcompany=FALSE) {
|
||||
if ($withcompany)
|
||||
return sprintf('%s %s (%s)',$this->first_name,$this->last_name,$this->company);
|
||||
return sprintf('%s %s%s',$this->first_name,$this->last_name,$this->company ? sprintf(' (%s)',$this->company) : '');
|
||||
else
|
||||
return sprintf('%s %s',$this->first_name,$this->last_name);
|
||||
}
|
||||
@@ -121,11 +121,55 @@ class Model_Account extends Model_Auth_UserDefault {
|
||||
// Log the logout
|
||||
$alo = ORM::factory('account_log');
|
||||
$alo->account_id = $this->id;
|
||||
$alo->ip = $_SERVER['REMOTE_ADDR'];
|
||||
$alo->ip = Request::$client_ip;
|
||||
$alo->details = $message;
|
||||
$alo->save();
|
||||
|
||||
return $alo->saved();
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for accounts matching a term
|
||||
*/
|
||||
public function list_autocomplete($term,$index='id') {
|
||||
$return = array();
|
||||
|
||||
$this->clear();
|
||||
$value = 'name(TRUE)';
|
||||
|
||||
// Build our where clause
|
||||
// First Name, Last name
|
||||
if (preg_match('/\ /',$term)) {
|
||||
list($fn,$ln) = explode(' ',$term,2);
|
||||
|
||||
$this->where_open()
|
||||
->where('first_name','like','%'.$fn.'%')
|
||||
->and_where('last_name','like','%'.$ln.'%')
|
||||
->where_close()
|
||||
->or_where('company','like','%'.$term.'%');
|
||||
|
||||
} elseif (is_numeric($term)) {
|
||||
$this->where('id','like','%'.$term.'%');
|
||||
|
||||
} elseif (preg_match('/\@/',$term)) {
|
||||
$this->where('email','like','%'.$term.'%');
|
||||
$value = 'email';
|
||||
|
||||
} else {
|
||||
$this->where('company','like','%'.$term.'%')
|
||||
->or_where('first_name','like','%'.$term.'%')
|
||||
->or_where('last_name','like','%'.$term.'%')
|
||||
->or_where('email','like','%'.$term.'%');
|
||||
}
|
||||
|
||||
// @todo This should limit the results so that users dont see other users services.
|
||||
foreach ($this->find_all() as $o)
|
||||
$return[$o->$index] = array(
|
||||
'value'=>$o->$index,
|
||||
'label'=>sprintf('ACC %s: %s',$o->id,Table::resolve($o,$value)),
|
||||
);
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -118,5 +118,9 @@ abstract class ORMOSB extends ORM {
|
||||
|
||||
return $plugin ? sprintf('%s/%s/%s/%s',$request->controller(),$request->directory(),$plugin,$request->action()) : sprintf('%s/%s/%s',$request->controller(),$request->directory(),$request->action());
|
||||
}
|
||||
|
||||
public function changed() {
|
||||
return $this->_changed;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -47,7 +47,7 @@ abstract class StaticListModule extends StaticList {
|
||||
*/
|
||||
public static function form($name,$default='',$addblank=FALSE) {
|
||||
// Override our argument list as defined in parent
|
||||
list($name,$table,$default,$key,$value,$where) = func_get_args();
|
||||
list($name,$table,$default,$key,$value,$where,$addblank,$attributes) = func_get_args();
|
||||
|
||||
// @todo - our query type should come from our configuration?
|
||||
$db = DB::select()->from($table);
|
||||
@@ -69,6 +69,9 @@ abstract class StaticListModule extends StaticList {
|
||||
|
||||
// Else we return a select list
|
||||
$x = array();
|
||||
if ($addblank)
|
||||
$x[] = '';
|
||||
|
||||
foreach ($db as $record) {
|
||||
$x[$record[$key]] = $record[$value];
|
||||
|
||||
@@ -77,7 +80,7 @@ abstract class StaticListModule extends StaticList {
|
||||
static::$record[$table] = $record;
|
||||
}
|
||||
|
||||
return Form::select($name,$x,$default);
|
||||
return Form::select($name,$x,$default,$attributes);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user