Files
pmgr/site/models/contact.php

48 lines
1.1 KiB
PHP

<?php
class Contact extends AppModel {
var $displayField = 'display_name';
var $validate = array(
'id' => array('numeric'),
'display_name' => array('notempty'),
'id_federal' => array('ssn'),
'id_exp' => array('date')
);
var $hasMany = array(
'ContactsMethod',
'ContactsCustomer',
);
var $hasAndBelongsToMany = array(
'Customer',
'ContactAddress' => array(
'joinTable' => 'contacts_methods',
'associationForeignKey' => 'method_id',
'unique' => true,
'conditions' => "method = 'ADDRESS'",
),
'ContactPhone' => array(
'joinTable' => 'contacts_methods',
'associationForeignKey' => 'method_id',
'unique' => true,
'conditions' => "method = 'PHONE'",
),
'ContactEmail' => array(
'joinTable' => 'contacts_methods',
'associationForeignKey' => 'method_id',
'unique' => true,
'conditions' => "method = 'EMAIL'",
),
);
function contactList() {
return $this->find('list',
array('order' =>
//array('last_name', 'first_name', 'middle_name'),
array('display_name'),
));
}
}
?>