Fixed bug with adding attachments from the same principle. Closes #67
This commit is contained in:
parent
5b9b2139ce
commit
476768a32d
|
|
@ -118,7 +118,7 @@ class DocumentsController extends AppController {
|
|||
|
||||
function saveAttachments() {
|
||||
$this->layout = 'ajax';
|
||||
if($this->data) {
|
||||
if($this->data) {
|
||||
$attachments = array();
|
||||
foreach($this->data['DocumentAttachment']['attachment_id'] as $i => $attachment_id) {
|
||||
$docID = $this->data['DocumentAttachment']['document_id'];
|
||||
|
|
|
|||
|
|
@ -46,7 +46,9 @@ echo $form->input("DocPage.content", array('class'=>'page', 'label'=>'Page', 'be
|
|||
<?php
|
||||
foreach($attachments as $index => $attachment) {
|
||||
?>
|
||||
<tr>
|
||||
<tr>
|
||||
<?php echo $form->input('DocumentAttachment.document_id',
|
||||
array('type'=>'hidden', 'value'=> $document['Document']['id'])); ?>
|
||||
<td><?php echo $form->input("DocumentAttachment.{$index}.id",
|
||||
array('type'=>'checkbox',
|
||||
'value'=> $attachment['DocumentAttachment']['id'],
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ $(function() {
|
|||
buttons: {
|
||||
"Add Attachment": function() {
|
||||
|
||||
var attachmentInputs = $('#DocumentAttachmentAddForm').find('input');
|
||||
var attachmentInputs = $('#DocumentAttachmentAddForm').find('input:checked, #DocumentAttachmentDocumentId');
|
||||
|
||||
$.post('/documents/saveAttachments', attachmentInputs, function(data) {
|
||||
$("#addAttachmentModal").dialog( "close" );
|
||||
|
|
|
|||
Loading…
Reference in a new issue