Added user archive soft delete feature. Partially addresses #60. Need to confirm the condition is being used everywhere, like new Documents etc
This commit is contained in:
parent
7efd7b08a2
commit
5d6fcb0009
|
|
@ -162,7 +162,7 @@ class EnquiriesController extends AppController {
|
|||
$countries = $this->Enquiry->Country->find('list', array('order'=> 'Country.name asc'));
|
||||
$principles = $this->Enquiry->Principle->find('list', array('order' => 'Principle.name asc'));
|
||||
$statuses = $this->Enquiry->Status->find('list');
|
||||
$users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username'), 'conditions'=>array('User.type'=>'user')));
|
||||
$users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username'), 'conditions'=>array('User.type'=>'user', 'User.archived' => 0)));
|
||||
$this->set(compact('users', 'customers', 'states', 'countries', 'principles', 'statuses', 'contacts', 'customer'));
|
||||
$customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $customer['Customer']['id'])));
|
||||
$this->set('billing_addresses', $customerAddresses);
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@ class UsersController extends AppController {
|
|||
var $components = array('Acl', 'Auth', 'Cookie');
|
||||
var $paginate = array(
|
||||
'limit' => 500,
|
||||
'order' => 'User.id asc',
|
||||
'Users' => array('order' => array('User.id' => 'asc'),
|
||||
'Users' => array('order' => array('User.archived' => 'ASC', 'User.id' => 'asc'),
|
||||
),
|
||||
'Enquiry' => array('order' => array('Enquiry.id' => 'desc'), 'limit' => 250)
|
||||
'Enquiry' => array('order' => array('Enquiry.id' => 'desc'), 'limit' => 250),
|
||||
);
|
||||
|
||||
function beforeFilter() {
|
||||
|
|
|
|||
|
|
@ -67,5 +67,6 @@ class User extends AppModel {
|
|||
function getUsersList() {
|
||||
return $this->find('list', array('conditions'=>array('User.type'=>'user')));
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
echo "UNPAID";
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
echo "N/A";
|
||||
echo "N/A"; //@TODO fix this.
|
||||
echo "</td>";
|
||||
}
|
||||
else {
|
||||
|
|
@ -92,4 +92,4 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<?php debug($invoices); ?>
|
||||
<?php debug($invoices); ?>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
echo $form->input('last_name');
|
||||
echo $form->input('email');
|
||||
echo $form->input('job_title');
|
||||
echo $form->input('archived');
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $form->end('Submit');?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ echo $paginator->counter(array(
|
|||
<th><?php echo $paginator->sort('last_name');?></th>
|
||||
<th><?php echo $paginator->sort('email');?></th>
|
||||
<th><?php echo $paginator->sort('job_title');?></th>
|
||||
<th><?php echo $paginator->sort('archived');?></th>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
|
@ -21,10 +22,17 @@ $i = 0;
|
|||
foreach ($users as $user):
|
||||
$class = null;
|
||||
if ($i++ % 2 == 0) {
|
||||
$class = ' class="altrow"';
|
||||
$class = 'altrow';
|
||||
}
|
||||
if($user['User']['archived']) {
|
||||
$class .= ' archived';
|
||||
$archived = 'archived';
|
||||
}
|
||||
else {
|
||||
$archived = '';
|
||||
}
|
||||
?>
|
||||
<tr<?php echo $class;?>>
|
||||
<tr class="<?php echo $class;?>">
|
||||
<td>
|
||||
<?php echo $user['User']['id']; ?>
|
||||
</td>
|
||||
|
|
@ -44,6 +52,9 @@ foreach ($users as $user):
|
|||
<td>
|
||||
<?php echo $user['User']['job_title']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $archived; ?>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<?php echo $html->link(__('View', true), array('action'=>'view', $user['User']['id'])); ?>
|
||||
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $user['User']['id'])); ?>
|
||||
|
|
|
|||
|
|
@ -1663,3 +1663,10 @@ h2.document-attachments {
|
|||
margin-top: 0.5em;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
|
||||
/* Hello, old friend */
|
||||
|
||||
tr.archived {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue