52 lines
1.2 KiB
PHP
Executable file
52 lines
1.2 KiB
PHP
Executable file
<?php
|
|
class Invoice extends AppModel {
|
|
|
|
var $name = 'Invoice';
|
|
|
|
// var $recursive = 2;
|
|
|
|
var $validate = array(
|
|
'issue_date' => array('date'),
|
|
'due_date' => array('date'),
|
|
'title' => array('notempty'),
|
|
'paid' => array('numeric'),
|
|
'enquiry_id' => array('numeric'),
|
|
'user_id' => array('numeric')
|
|
);
|
|
|
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
|
var $belongsTo = array(
|
|
'Enquiry' => array(
|
|
'className' => 'Enquiry',
|
|
'foreignKey' => 'enquiry_id',
|
|
'counterCache'=> true
|
|
),
|
|
'Customer' => array(
|
|
'className' => 'Customer',
|
|
'foreignKey' => 'customer_id'
|
|
),
|
|
'Job' => array(
|
|
'className' => 'Job',
|
|
'foreignKey' => 'job_id'
|
|
),
|
|
'Currency' => array(
|
|
'className' => 'Currency',
|
|
'foreignKey' => 'currency_id'
|
|
),
|
|
'Document' => array(
|
|
'className' => 'Document',
|
|
'foreignKey' => 'document_id'
|
|
)
|
|
);
|
|
|
|
|
|
var $hasAndBelongsToMany = array(
|
|
|
|
'Email' => array(
|
|
'className' => 'Email',
|
|
'joinTable' => 'emails_invoices',
|
|
)
|
|
);
|
|
|
|
}
|
|
?>
|