Add attachment size

This commit is contained in:
Karl Cordes 2022-01-08 14:17:38 +11:00
parent 925ef2133c
commit c6d1c7bf36
2 changed files with 19 additions and 9 deletions

View file

@ -4,9 +4,13 @@
<th>Filename</th> <th>Filename</th>
<th>Name</th> <th>Name</th>
<th>Desc</th> <th>Desc</th>
<th>Size</th>
</thead> </thead>
<tbody> <tbody>
<?php <?php
$totalSize = 0;
foreach($attachments as $index => $attachment) { foreach($attachments as $index => $attachment) {
?> ?>
<tr> <tr>
@ -16,8 +20,19 @@ foreach($attachments as $index => $attachment) {
</td> </td>
<td><?php echo $attachment['Attachment']['name']; ?></td> <td><?php echo $attachment['Attachment']['name']; ?></td>
<td><?php echo $attachment['Attachment']['description']; ?></td> <td><?php echo $attachment['Attachment']['description']; ?></td>
<td><?php echo $number->toReadableSize($attachment['Attachment']['size']); ?></td>
<?php $totalSize += $attachment['Attachment']['size']; ?>
</tr> </tr>
<?php } ?> <?php } ?>
<tr class="attachment-total">
<td></td>
<td></td>
<td></td>
<td>Total size:</td>
<td><?php echo $number->toReadableSize($totalSize); ?></td>
</tr>
</tbody> </tbody>
</table> </table>

View file

@ -8,12 +8,7 @@ echo $javascript->link('document_attachments');
?> ?>
<?=$this->element('pdf_created_message'); ?> <?=$this->element('pdf_created_message'); ?>
<?php if(!empty($smtp_errors)) { ?>
<h2>Email error</h2>
<pre>
<?php print_r($smtp_errors); ?>
</pre>
<?php } ?>
<? <?
echo $this->element($docTypeElement); echo $this->element($docTypeElement);
?> ?>
@ -75,11 +70,11 @@ foreach($attachments as $index => $attachment) {
<?php } <?php }
?> ?>
<tr> <tr class="attachment-total">
<td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td>Total size:</td>
<td><?php echo $number->toReadableSize($totalSize); ?></td> <td><?php echo $number->toReadableSize($totalSize); ?></td>
</tr> </tr>