Topic: Attachment for Customers and Suppliers

Hello:

I suggest be included in the file of customers and suppliers a tab for attachment documents of each client or supplier.I refer to those documents that do not imply an accounting operation. For example: copy of  tax ID, tax id validation, and others.

Regars...

Rafael

2 (edited by rafat 07/30/2019 12:43:18 pm)

Re: Attachment for Customers and Suppliers

I like this wish list.. It should be very simple.. as its only an attachment to the customer / supplier record.
We always need some documents to do business with cust/sup like Trade license  VAT registration ..etc..
Nice Suggestion Rafael.

Re: Attachment for Customers and Suppliers

We will add it to next core update. @Joe  consider it for next release

Re: Attachment for Customers and Suppliers

Thanks rafat.  It will be a very useful option....

Re: Attachment for Customers and Suppliers

@Joe ....Please,.... can you inform if this option has been added to the next core update..???

6 (edited by apmuthu 10/08/2019 06:03:23 am)

Re: Attachment for Customers and Suppliers

Finally, for FA 2.4.7+, Customer / Supplier Attachments are now possible with the changed files attached and inclusion of one inc file.

No DB changes. No external dependencies.

No "#" number ID for Customers / Suppliers as no transactions are involved.

Thanks to @Rmendez for checking it out and persisting with it.

Please test and revert on any issues.

Post's attachments

CustSuppAttachments_apmuthu.zip 25.2 kb, 5 downloads since 2019-10-08 

You don't have the permssions to download the attachments of this post.

Re: Attachment for Customers and Suppliers

Screenshots attached.

Post's attachments

CSAttach_Screenshots.zip 21.8 kb, 15 downloads since 2019-10-06 

You don't have the permssions to download the attachments of this post.

Re: Attachment for Customers and Suppliers

Thanks Apmuthu.  When testing it give this error.......

Unhandled exception [0]: Call to undefined function GetRow()

In this file.....................includes/ui/attachment.inc En la línea 303...

What is the solution??

Re: Attachment for Customers and Suppliers

Updated file attachment. Thanks for the eagle eye.

Re: Attachment for Customers and Suppliers

@apmuthu

I am able to add attachments via Setup ->Attach Documents with no problems.
Adding attachments thru Sales->Add and Manage Customers->Attachments gives an error

"The existing Docs could not be removed"

Same with Suppliers.

Re: Attachment for Customers and Suppliers

@apmuthu

Other isue.............. is that its no possible to add a new customer or suplier when you upload the files of this option.

Re: Attachment for Customers and Suppliers

There is an issue with date2sql conversion necessary before inserting into db for this method in attachment.inc file.

The Setup =>Attachments method uses the line 136 of attachments.php file to do the insertion correctly.

Re: Attachment for Customers and Suppliers

File Attachment using Sales => Add / Manage Customers => Attachments now works for Adding file.

The changed files download has been updated in this post.

Re: Attachment for Customers and Suppliers

Yes.. Its working now.

There is an error somehow in 247 when attaching an MS Office files like .docx. It does not attach and error log has the following:

<b>DATABASE ERROR :</b> Attachment could not be inserted<br>error code : 1406<br>error message : Data too long for column 'filetype' at row 1.

Its working OK with 246.

Re: Attachment for Customers and Suppliers

@apmuthu

Theres are some errore when editing attachments. Say this.....

Undefined index: type_no
Undefined index: trans_no
Undefined index: title
Undefined index: filename
Undefined index: date

In this files...................../includes/ui/simple_crud_class.inc .......En la línea 258

and this error .......

Undefined index: date........in this file........../includes/ui/attachment.inc ..........En la línea 118
Undefined index: title.........in this file........./includes/ui/attachment.inc ...........En la línea 119

Re: Attachment for Customers and Suppliers

@itronics is working on it. We finally need to get rid of the includes/ui/attachment.inc file and get it working consistently across user interfaces.

Known issues:

1. Attaching MS Office documents like docx, xlsx, pptx, etc will result in error as the mime type exceeds 60 characters - need to increase the size of the field attachments.filetype to say 100 from the current 60 characters.

2. Edit of the attachment record in Sales => Add and Manage Customers => Attachments tab does not work as yet.

17 (edited by apmuthu 10/12/2019 01:39:55 pm)

Re: Attachment for Customers and Suppliers

This feature has finally been incorporated into the FA Core by @itronics. Thanks a lot for the spit and polish and fully working state.

Commits:
https://github.com/FrontAccountingERP/FA/commit/3d95c6844745f183ebab970251cd254dd6cbdcec
https://github.com/FrontAccountingERP/FA/commit/15576cedd9e46caac2884c2815875e7ec9fd4802

Attached are the changed files for FA 2.4.7+ as on date.

Those who have used the old code will need to take note of:

To preserve some FA types numbering scheme consistency, the type_no used are 41 and 42 as customer/supplier attachment type (instead of 5 and 6  in original code).

Seems the original code was not ready for production, expect nobody will have problem with renumbering existing records in attachments table's field type_no with something like:

UPDATE 0_attachments SET type_no=41 WHERE type_no=5;
UPDATE 0_attachments SET type_no=42 WHERE type_no=6;

Use Table prefix as appropriate instead of the 0_ above.

Post's attachments

CustSuppAtt_Janusz.zip 24.9 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Attachment for Customers and Suppliers

Further testing reveals that popup windows need to be enabled for the FA site for the Setup => Attachments View button functionality to work. The Sales => Add?Manage Customers => Attachments View Attachment button works okay even without such settings.

This is so because, the former uses a "button" tag whilst the latter uses the "a href" tag.

# Setup => Attachments (needs popup exception for FA domain)
# Sales => Add/Manage Customer => Attachments (no need for pop settings)

The HTML code inspection reveals the Concerned Lines:
# Lines 199 and 227 in admin/attachments.php

<td><button type="submit" class="editbutton" name="view3" value="1" title="View">
<img src="../themes/default/images/view.gif" 
     style="vertical-align:middle;width:12px;height:12px;border:0;">
</button>
</td>

# Line 95 in includes/ui/attachments.inc

<td style="text-align: center;">
<a target="_blank" class="viewlink" 
   href="../../admin/attachments.php?vw=3" 
   onclick="javascript:openWindow(this.href,this.target); return false;" 
   accesskey="V">
<img src="../../themes/default/images/view.gif" 
     style="vertical-align:middle;width:12px;height:12px;border:0;">
</a>
</td>

Re: Attachment for Customers and Suppliers

@itronics  and @apmuthu

Thanks for the excellent job to make possible this funcionality. 

Trying to add a new customer it's not possible with the files downloaded.   Please fix it........

Re: Attachment for Customers and Suppliers

No problem adding customer.

See screenshots attached.

Provide more information regarding your issue with debug and sql_trails along with platform versions.

Post's attachments

AddedCustomer.zip 62.7 kb, 1 downloads since 2019-10-10 

You don't have the permssions to download the attachments of this post.

Re: Attachment for Customers and Suppliers

@apmuthu

Sorry....I refer to supplier.....doesn't save new supplier!!!!

Customer is ok...as Apmuthu say.

Re: Attachment for Customers and Suppliers

@Rmendez: Thanks for testing it.

The use of the string 'false' instead of the boolean false and the out of order include have contributed to the problem and has been rectified in the attachment which includes the diff file and the screenshot of successful addition of new supplier.

A few more files (need to properly check on what has worked till now anyway) that have this kind of construct (and 'true' as well) are:

reporting/includes/fpdi/pdf_parser.php
reporting/includes/tcpdf.php
includes/JsHttpRequest.php

@itronics / @joe: can commit it.

Post's attachments

purchasing.zip 25.8 kb, 3 downloads since 2019-10-11 

You don't have the permssions to download the attachments of this post.

Re: Attachment for Customers and Suppliers

@apmuthu

Thanks ,.. its working fine now.

Two minor things still needs addressing;

1) Mime (filetype) length for MS Office docs needs increasing.
2) In Setup->Attach Documents->Supplier/Customer if one does not choose a customer/supplier the system continues with no warning/error. Maybe a message needs to popup to enter a customer / supplier first.

Re: Attachment for Customers and Suppliers

@ApMuthu

Thanks for the fix. But in the three mentioned files 'false'/'true' string appears in completely different context i.e. as text representation of boolean value, so there s no need for change here.

@rafat
I will fix those issues too.

Re: Attachment for Customers and Suppliers

I have pushed additional  fixes to repo, hopefully all will work now as expected. Regarding change in attachments.filetype length it will be addressed in 2.5 upgrade scripts.
Thank you.
J.