Tidying. Preior to implementing Revisions in Documents controller

This commit is contained in:
Karl Cordes 2011-08-11 14:43:40 +10:00
parent 0a6f3dbc4e
commit 69f2e7b633
5 changed files with 7 additions and 56 deletions

View file

@ -145,32 +145,6 @@ class DocumentsController extends AppController {
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid Document', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
$docID = $this->data['Document']['id'];
$this->Document->DocPage->deleteAll(array('document_id'=>$docID));
$this->Document->DocPage->updateCounterCache(array('document_id'=>$docID));
if ($this->Document->saveAll($this->data)) {
$this->Session->setFlash(__('The Document has been saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The Document could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Document->read(null, $id);
}
}
function ajax_edit($id = null) {
$this->layout = 'ajax';

View file

@ -263,7 +263,7 @@ class QuotesController extends AppController {
$number_of_revisions = $this->Quote->findCount('Quote.enquiry_id ='. $enquiryid);
$number_of_revisions++;
$number_of_revisions;
//debug($quote);

View file

@ -1,27 +0,0 @@
<div class="documents form">
<?php echo $form->create('Document');?>
<fieldset>
<legend><?php __('Edit Document');?></legend>
<?php
echo $form->input('id');
echo $form->input('user_id');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('Document.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Document.id'))); ?></li>
<li><?php echo $html->link(__('List Documents', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Invoices', true), array('controller' => 'invoices', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Invoice', true), array('controller' => 'invoices', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Quotes', true), array('controller' => 'quotes', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Quote', true), array('controller' => 'quotes', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Purchase Orders', true), array('controller' => 'purchase_orders', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Purchase Order', true), array('controller' => 'purchase_orders', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Line Items', true), array('controller' => 'line_items', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Line Item', true), array('controller' => 'line_items', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -27,7 +27,7 @@
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'documents', 'action'=>'view', $quote['Quote']['document_id'])); ?>
<?php //echo $html->link(__('Revise', true), array('controller'=>'quotes', 'action'=>'revise', $quote['Quote']['id']));
<?php echo $html->link(__('Revise', true), array('controller'=>'quotes', 'action'=>'revise', $quote['Quote']['id']));
?>

View file

@ -147,7 +147,10 @@
}?>
</h3>
<button>New Quote</button>
<?php echo $this->element('quote_table', $quotes); ?>
<? echo $this->element('quote_table', $quotes);
?>
</div>
@ -218,6 +221,7 @@
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=>'jobs', 'action' => 'view', $job['Job']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>