Fixed removing attachments
This commit is contained in:
parent
a73fd66440
commit
296336e431
|
|
@ -139,9 +139,9 @@ class DocumentsController extends AppController {
|
||||||
|
|
||||||
function removeAttachments() {
|
function removeAttachments() {
|
||||||
$this->layout = 'ajax';
|
$this->layout = 'ajax';
|
||||||
|
foreach($this->data['DocumentAttachment'] as $attachment) {
|
||||||
|
|
||||||
foreach($this->data as $attachment) {
|
$this->Document->DocumentAttachment->delete($attachment['id']);
|
||||||
$this->Document->DocumentAttachment->delete($attachment);
|
|
||||||
}
|
}
|
||||||
echo 'SUCCESS';
|
echo 'SUCCESS';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
foreach($attachments as $attachment) {
|
foreach($attachments as $index => $attachment) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $form->input('DocumentAttachment.id', array('type'=>'checkbox', 'value'=> $attachment['DocumentAttachment']['id'], 'label' => false, 'class'=>'documentAttachment-checkbox')); ?></td>
|
<td><?php echo $form->input("DocumentAttachment.{$index}.id", array('type'=>'checkbox', 'value'=> $attachment['DocumentAttachment']['id'], 'label' => false, 'class'=>'documentAttachment-checkbox')); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php echo $html->link($attachment['Attachment']['filename'], '/attachments/view/'.$attachment['Attachment']['id']); ?>
|
<?php echo $html->link($attachment['Attachment']['filename'], '/attachments/view/'.$attachment['Attachment']['id']); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ echo $form->input("DocPage.content", array('class'=>'page', 'label'=>'Page', 'be
|
||||||
foreach($attachments as $index => $attachment) {
|
foreach($attachments as $index => $attachment) {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $form->input("DocumentAttachment[{$index}].id",
|
<td><?php echo $form->input("DocumentAttachment.{$index}.id",
|
||||||
array('type'=>'checkbox',
|
array('type'=>'checkbox',
|
||||||
'value'=> $attachment['DocumentAttachment']['id'],
|
'value'=> $attachment['DocumentAttachment']['id'],
|
||||||
'label' => false, 'class'=>'documentAttachment-checkbox')); ?></td>
|
'label' => false, 'class'=>'documentAttachment-checkbox')); ?></td>
|
||||||
|
|
|
||||||
|
|
@ -544,15 +544,8 @@ function savePages() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$.post('/documents/ajax_edit', docPages, function(data) {
|
$.post('/documents/ajax_edit', docPages, function(data) {
|
||||||
if(data =='SUCCESS') {
|
|
||||||
$("#flashMessage").html("Pages Saved Successfully");
|
$("#flashMessage").html("Pages Saved Successfully");
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#flashMessage").html("Unable to Save Pages");
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#flashMessage").show();
|
$("#flashMessage").show();
|
||||||
|
|
||||||
loadLineItems();
|
loadLineItems();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue