projects
/
Pman.Core
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of http://git.roojs.com/Pman.Core
[Pman.Core]
/
DataObjects
/
Core_company.php
diff --git
a/DataObjects/Core_company.php
b/DataObjects/Core_company.php
index
e6b8e7c
..
cb0af57
100644
(file)
--- a/
DataObjects/Core_company.php
+++ b/
DataObjects/Core_company.php
@@
-12,7
+12,7
@@
class Pman_Core_DataObjects_Core_Company extends DB_DataObject
public $__table = 'core_company'; // table name
public $code; // string(32) not_null
public $name; // string(128)
public $__table = 'core_company'; // table name
public $code; // string(32) not_null
public $name; // string(128)
- public $remarks; // blob(65535) blob
+ public $remarks; // blob(65535) blob
eforeDeleteb
public $owner_id; // int(11) not_null
public $address; // blob(65535) blob
public $tel; // string(32)
public $owner_id; // int(11) not_null
public $address; // blob(65535) blob
public $tel; // string(32)
@@
-104,14
+104,19
@@
class Pman_Core_DataObjects_Core_Company extends DB_DataObject
) as comptype_display_name
");
) as comptype_display_name
");
- if(!empty($q['query']['name'])){
- $s = $this->escape($q['query']['name']);
+ if(!empty($q['query']['name']) || !empty($q['search']['name'])){
+
+ $s = (!empty($q['query']['name'])) ? $this->escape($q['query']['name']) : $this->escape($q['search']['name']);
+
$this->whereAdd("
{$tn}.name LIKE '%$s%'
");
}
$this->whereAdd("
{$tn}.name LIKE '%$s%'
");
}
- if(!empty($q['search']['name_starts'])){
- $s = $this->escape($q['search']['name_starts']);
+
+ if(!empty($q['query']['name_starts']) || !empty($q['search']['name_starts'])){
+
+ $s = (!empty($q['query']['name_starts'])) ? $this->escape($q['query']['name_starts']) : $this->escape($q['search']['name_starts']);
+
$this->whereAdd("
{$tn}.name LIKE '$s%'
");
$this->whereAdd("
{$tn}.name LIKE '$s%'
");
@@
-248,6
+253,14
@@
class Pman_Core_DataObjects_Core_Company extends DB_DataObject
function beforeInsert($q, $roo)
{
function beforeInsert($q, $roo)
{
+ // we still use comptype in some old systems...
+
+ if (!empty($q['comptype_id'])) {
+ $en = DB_DataObject::Factory('core_enum');
+ $en->get($q['comptype_id']);
+ $this->comptype = $en->name;
+ }
+
if(!empty($q['_check_name'])){
if($this->checkName()){
$roo->jok('OK');
if(!empty($q['_check_name'])){
if($this->checkName()){
$roo->jok('OK');
@@
-259,14
+272,21
@@
class Pman_Core_DataObjects_Core_Company extends DB_DataObject
function beforeUpdate($old, $q,$roo)
{
function beforeUpdate($old, $q,$roo)
{
- echo "wtf"; exit;
+ // we still use comptype in some old systems...
+
+ if (!empty($q['comptype_id'])) {
+ $en = DB_DataObject::Factory('core_enum');
+ $en->get($q['comptype_id']);
+ $this->comptype = $en->name;
+ }
+
+
if(!empty($q['_flag_delete'])){
if(!empty($q['_flag_delete'])){
- if($q['_flag_delete'] * 1 == 1){
-
- $this->deleted_dt = $this->sqlValue("NOW()");
- $this->deleted_by = $roo->getAuthUser()->id;
- }
-
+ $this->deleted_dt = $this->sqlValue("NOW()");
+ $this->deleted_by = $roo->getAuthUser()->id;
+ }
+
+ if(!empty($q['_flag_undelete'])){
$this->deleted_dt = "";
$this->deleted_by = 0;
}
$this->deleted_dt = "";
$this->deleted_by = 0;
}
@@
-308,7
+328,7
@@
class Pman_Core_DataObjects_Core_Company extends DB_DataObject
$img->onid = $this->id;
$img->find();
while ($img->fetch()) {
$img->onid = $this->id;
$img->find();
while ($img->fetch()) {
- $img->beforeDelete();
+ $img->beforeDelete(
array(), $roo
);
$img->delete();
}
return true;
$img->delete();
}
return true;