~mparic/+junk/openauctionlive

« back to all changes in this revision

Viewing changes to app/controllers/agents_controller.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:
68
68
          $this->isAuthorized();
69
69
                if (!empty($this->data)) {
70
70
                        $this->Agent->create();
71
 
      $this->data['Agent']['password'] = Security::hash($this->data['Agent']['setPassword'],'sha1',true);
72
 
      $this->data['Agent']['phone'] = preg_replace('/[[:punct:]]|[[:space:]]/','',$this->data['Agent']['phone']);
 
71
                $this->data['Agent']['password'] = Security::hash($this->data['Agent']['setPassword'],'sha1',true);
 
72
                $this->data['Agent']['phone'] = preg_replace('/[[:punct:]]|[[:space:]]/','',$this->data['Agent']['phone']);
73
73
                        if ($this->Agent->save($this->data)) {
74
 
                                $this->Session->setFlash(__('The agent has been saved', true));
 
74
                                $this->Session->setFlash(__('The agent has been saved', true),'default', array('class'=>'success-message'));
75
75
                                $this->redirect(array('action' => 'index'));
76
76
                        } else {
77
 
                          $this->data['Agent']['setPassword'] = null;
78
 
        $this->data['Agent']['username'] = null;
 
77
                                $this->data['Agent']['setPassword'] = null;
 
78
                        $this->data['Agent']['username'] = null;
79
79
                                $this->Session->setFlash(__('The agent could not be saved. Try again.', true));
80
80
                        }
81
81
                }
89
89
                        $this->redirect(array('action' => 'index'));
90
90
                }
91
91
                if (!empty($this->data)) {
92
 
                  // Hash Password if Submitted               
93
 
                  if ($this->data['Agent']['newPassword'])
94
 
      {
95
 
        $this->data['Agent']['password'] = Security::hash($this->data['Agent']['newPassword'],'sha1',true);
96
 
      }
97
 
      $this->data['Agent']['phone'] = preg_replace('/[[:punct:]]|[[:space:]]/','',$this->data['Agent']['phone']);
98
 
      //pr($this->data);exit(); 
 
92
                        // Hash Password if Submitted                 
 
93
                        if ($this->data['Agent']['newPassword']) {
 
94
                        $this->data['Agent']['password'] = Security::hash($this->data['Agent']['newPassword'],'sha1',true);
 
95
                }
 
96
                        $this->data['Agent']['phone'] = preg_replace('/[[:punct:]]|[[:space:]]/','',$this->data['Agent']['phone']);
 
97
                //pr($this->data);exit(); 
99
98
                        if ($this->Agent->save($this->data)) {
100
 
                                $this->Session->setFlash(__('The agent has been saved', true));
 
99
                                $this->Session->setFlash(__('The agent has been saved', true),'default', array('class'=>'success-message'));
101
100
                                $this->redirect(array('action' => 'index'));
102
101
                        } else {
103
102
                                $this->Session->setFlash(__('The agent could not be saved. Try again.', true));
116
115
                        $this->redirect(array('action'=>'index'));
117
116
                }
118
117
                if ($this->Agent->delete($id)) {
119
 
                        $this->Session->setFlash(__('Agent deleted', true));
 
118
                        $this->Session->setFlash(__('Agent deleted', true),'default', array('class'=>'success-message'));
120
119
                        $this->redirect(array('action'=>'index'));
121
120
                }
122
121
                $this->Session->setFlash(__('Agent was not deleted', true));