[Vtigercrm-developers] Create file/attachment field

Rubén A. Estrada Orozco rulotec1 at gmail.com
Sat Jan 22 02:37:46 GMT 2022


Thanks for the tips guys.

I ended up using uitype 61 and had to modify CRMEntity.php
and layouts/v7/modules/Vtiger/uitypes/File.tpl.
I also added the file modules/ProjectTask/models/Record.php because I
needed the field in the ProjectTask module.

I'm attaching the diff file for anyone interested.

I have to say: CRMEntity.php is a huge violation of the Open Closed
Principle (systems should be closed for modification but open for
extension). One should not have to hack into the CRMEntity class to add a
new uitype. uitype specific  code should go into uitype specific classes.
Ideally, we should be able to add a new uitype without touching existing
code.

Alan, how do you manage to find old threads so easily?  I couldn't find a
way to search this thing:
http://lists.vtigercrm.com/pipermail/vtigercrm-developers/
Before, you could use nable:
http://vtiger-crm.2324883.n4.nabble.com/vtigercrm-developers-f4.html but it
is dead now :(


Saludos

Rubén


On Fri, Jan 21, 2022 at 4:05 AM Alan Lord <alanslists at gmail.com> wrote:

> On 21/01/2022 02:53, Rubén A. Estrada Orozco wrote:
> > Hi everyone,
> >
> > I'm trying to create an  upload field. Like the contact's image field
> > but this one should allow for pdfs, doc, xls, etc... not just images.
> > The use case is: make file fields mandatory, so that the user has to
> > upload something. Currently, with the documents module you can have
> > related files, but you cannot make them mandatory.
>
> I've discussed this before - see thread below. It's not exactly trivial
> but not too hard - you'll need to clone some functionality from other
> vtiger modules which support file upload.
>
>
> http://lists.vtigercrm.com/pipermail/vtigercrm-developers/2020-February/038421.html
>
> HTH
>
> Al
>
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20220121/fb8eb582/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 98f46db28ba485071961a6db4cba2adfd89bc6a0.diff
Type: text/x-patch
Size: 3555 bytes
Desc: not available
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20220121/fb8eb582/attachment.bin>


More information about the vtigercrm-developers mailing list