$this->whereAddIn('comptype', explode(',', $q['query']['comptype']), 'string');
}
- /*if (!empty($q['query']['deleted_by'])) {
- $deleted_by = $this->escape($q['query']['deleted_by']);
- $this->whereAdd("deleted_by = '$deleted_by'");
- }*/
+
// depricated - should be moved to module specific (texon afair)
if (!empty($q['query']['province'])) {
function beforeUpdate($old, $q,$roo)
{
+
+ if(!empty($q['_flag_delete']) && $q['_flag_delete'] * 1 == 1){
+ $this->deleted_dt = $this->sqlValue("NOW()");
+ $this->deleted_by = $roo->getAuthUser()->id;
+ }
+
+ if(!empty($q['_flag_undelete']) && $q['_flag_undelete'] * 1 == 1){
+ $this->deleted_dt = "";
+ $this->deleted_by = 0;
+ }
if(!empty($q['_check_name'])){
if($this->checkName()){
$roo->jok('OK');
function beforeDelete($req, $roo)
{
- if(!empty($req['_flag_delete']) && $req['_flag_delete'] * 1 == 1){
- $delete_dt = date('Y-m-d H:i:s');
- $this->query("UPDATE {$x->tableName()} SET deleted_by = {$this->getAuthUser()} , deleted_dt = {$delete_dt} WHERE id = {$req['_delete']}");
- //$this->addEvent("UPDATE", false, "update core_company record");
- $this->jok("Updated");
- }echo "here"; exit;
+
// should check for members....
if(!empty($this->is_system) &&
($old->code != $this->code || $old->name != $this->name)
){
$roo->jerr('This company is not allow to delete');
}
+
+
}
function onDelete($req, $roo)
{
-
$img = DB_DataObject::factory('Images');
$img->ontable = $this->tableName();
$img->onid = $this->id;
return $this->id == $au->company_id;
}
-
+ print_R($au->hasPerm("Core.Companies", $lvl));exit;
return $au->hasPerm("Core.Companies", $lvl);
}