Table of Contents

Attachment Directive

Summary

Objective Handle attachments and attachments types
Name attachments
Script /applications/controller/attachment.php
Tables setup_attachments; attachments; list_ambits
Configurations $upload_dir
Dependency nothing in particular

What are we talking about

How does is work

Attachment in WManager can be handled through a simple html tag that allows you to add attachments sections to yours web pages where you can add,delete or download attachments. It is handled through a angular directive that be used all around the application. The syntax to use it is.

<div attachment attachment-refid='REF_ID' attachment-refkey="AMBIT_KEY" custid='YOUR_CL_ID' beid='BE_ID'></div>

What are ambits? Ambits are nothing but the entity to be which attachment will be added for eg. Activity,troubles etc.

Parameter List
attachment-refkey: The key from setup_ambits table
attachment-refid: The id reference for the ambid
custid: The id field from clients table
beid: The be_id for the customer

The tables in which the attachments will be stored is attachment. And the path in which the attachment will be stored is in the config value UPLOAD_DIR. Attachment type is taken from list_ambits table. If the setup_attachment table has more then one ambits it will show types in the dropdown list otherwise attach type will be taken from the hidden field.

On saving the attachment, it will get stored in attachment table and the file will be upload in the configuration folder/customer_id/attachment_id/file.

Controller FileName: /common/new_attachment.php
Attachment List function: attachment_list($ref_id, $ref_key)
Attachment Upload function: upload($ref_key,$ref_id)
Attachment Delete function: delete_file($attachment_id)
Attachment Download function: download_file($attachment_id,$key,$id)

The library Attachment_with_ref will be used by this controller to perform all the upload operations.