~mparic/+junk/openauctionlive

« back to all changes in this revision

Viewing changes to app/models/bidder.php

  • Committer: Michael Paric
  • Date: 2012-01-07 20:21:14 UTC
  • Revision ID: mparic@compbizsolutions.com-20120107202114-6q89jiel6y3rbwgc
Updated validation rules to prevent duplicate Bid and Bidder entries; updated return message color for successful form entry to differentiate from error; added simlink in img/ for image to be used in reports - just change what auction_logo.jpg points to instead of changing View code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    
32
32
    var $validate = array(
33
33
        'first_name' => array('rule' => array('notEmpty')),
34
 
        'last_name' => array('rule' => array('notEmpty')),
 
34
        'last_name' => array(
 
35
                        'notemtpy' => array(
 
36
                                'rule' => array('notempty'),
 
37
                                'message' => 'Last Name is Required'
 
38
                        ),
 
39
                        'isDuplicateEntry' => array(
 
40
                                'rule' => array('isDuplicateEntry'),
 
41
                                'message' => 'Duplicate Bidder Name'
 
42
                        )
 
43
                ),
35
44
        'phone' => array('rule' => array('phone'))
36
45
      );
 
46
          
 
47
        function isDuplicateEntry() {
 
48
                $params = array('conditions'=>array('Bidder.first_name'=>$this->data['Bidder']['first_name'],'Bidder.last_name'=>$this->data['Bidder']['last_name']),'recursive'=>-1);
 
49
                $results = $this->find('first',$params);
 
50
                return (($results) ? false : true);
 
51
        }
37
52
  
38
53
}
 
 
b'\\ No newline at end of file'