71 lines
1.7 KiB
PHP
Executable file
71 lines
1.7 KiB
PHP
Executable file
<?php
|
|
class Customer extends AppModel {
|
|
|
|
var $name = 'Customer';
|
|
|
|
|
|
|
|
|
|
var $validate = array(
|
|
'name' => array(
|
|
'rule' => 'isUnique',
|
|
'message' => 'This Customer name is already taken or has been left blank',
|
|
'required' => true,
|
|
'allowEmpty' => false),
|
|
'abn' => array(
|
|
|
|
'numbers' => array(
|
|
'rule' => 'numeric',
|
|
'message' => 'ABN must only contain numbers - no letters or punctuation',
|
|
'required' => true,
|
|
'allowEmpty' => true),
|
|
'minlength' => array(
|
|
'rule' => array('minLength', '11'),
|
|
'message' => 'ABN must be exactly 11 numbers long')
|
|
)
|
|
);
|
|
|
|
|
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
|
var $hasMany = array(
|
|
'Address' => array('className' => 'Address',
|
|
'foreignKey' => 'customer_id',
|
|
'dependent' => false,
|
|
'conditions' => '',
|
|
'fields' => '',
|
|
'order' => '',
|
|
'limit' => '',
|
|
'offset' => '',
|
|
'exclusive' => '',
|
|
'finderQuery' => '',
|
|
'counterQuery' => ''
|
|
),
|
|
'Contact' => array('className' => 'Contact',
|
|
'foreignKey' => 'customer_id',
|
|
'dependent' => false,
|
|
'conditions' => '',
|
|
'fields' => '',
|
|
'order' => '',
|
|
'limit' => '',
|
|
'offset' => '',
|
|
'exclusive' => '',
|
|
'finderQuery' => '',
|
|
'counterQuery' => ''
|
|
),
|
|
'Enquiry' => array('className' => 'Enquiry',
|
|
'foreignKey' => 'customer_id',
|
|
'dependent' => false,
|
|
'conditions' => '',
|
|
'fields' => '',
|
|
'order' => '',
|
|
'limit' => '',
|
|
'offset' => '',
|
|
'exclusive' => '',
|
|
'finderQuery' => '',
|
|
'counterQuery' => ''
|
|
)
|
|
);
|
|
|
|
}
|
|
?>
|