mirror of
https://github.com/brmlab/brmbiolab_sklad.git
synced 2025-06-09 21:54:01 +02:00
Initial commit
This commit is contained in:
commit
3b93da31de
1004 changed files with 265840 additions and 0 deletions
42
app/Model/Item.php
Normal file
42
app/Model/Item.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
App::uses('AppModel', 'Model');
|
||||
|
||||
class Item extends AppModel
|
||||
{
|
||||
|
||||
public $name = 'Item';
|
||||
public $displayField = 'name';
|
||||
public $belongsTo = array(
|
||||
'ItemType',
|
||||
'StockUnitType'
|
||||
);
|
||||
public $hasMany = array(
|
||||
'StockHistory' => array(
|
||||
'order' => 'StockHistory.created DESC'
|
||||
)
|
||||
);
|
||||
public $validate = array(
|
||||
'name' => array(
|
||||
'isUnique' => array(
|
||||
'rule' => 'isUnique',
|
||||
'message' => 'Name must be unique'
|
||||
),
|
||||
'minLength' => array(
|
||||
'rule' => array('minLength', 3),
|
||||
'message' => 'Name must be at least 3 letters'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public function beforeFind($query)
|
||||
{
|
||||
if (!isset($query['conditions']['is_deleted'])) {
|
||||
$query['conditions']['is_deleted'] = 0;
|
||||
return $query;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue