[Vtigercrm-developers] Add new fields to line item

Martin Allen martin.allen at exe-squared.co.uk
Tue May 4 13:22:09 GMT 2021


It is quite easy to do (after you’ve done it once !) you can add the fields using vtlib functionality (and copying the table details etc from existing fields) – then you just have to update the relevant template (as currently the templates only populate specific fields, so have to add your new fields to the right templates)

There was a tiny bit of JavaScript that got changed, which if I  remember correctly was all around data validation.

I do have some notes  somewhere on how to do it, but they are not easy to read !

From: vtigercrm-developers-bounces at lists.vtigercrm.com <vtigercrm-developers-bounces at lists.vtigercrm.com> On Behalf Of Sukhdev Mohan
Sent: 04 May 2021 14:14
To: vtigercrm-developers at lists.vtigercrm.com
Subject: Re: [Vtigercrm-developers] Add new fields to line item

Ciao Angelo,
This is interesting. I know for sure that the payment version of Vtiger let’s you do that. Now the question is how do we replicate this, your solution seems reasonable and could be fast to implement. We could cooperate sure, also we are both from Italy and speak Italian, communications could be easier.

Best Regards,
Sukhdev Mohan | Software Developer







Il giorno 4 mag 2021, alle ore 09:28, info sito <info at angelopaglialonga.com<mailto:info at angelopaglialonga.com>> ha scritto:

Hi Sukhdev!
I would create line item fields possibly via vtlib , use js to load on document ready your new columns (reading them via ajax from table) and use an aftersave event to save new columns values via mysql query.

It you’re interested we could develop it together , what do you think?
_______________

Angelo Paglialonga
Consulente per soluzioni CRM ad alto ROI.

Telefono: 3386077866
Skype: angelo.paglialonga
Web: https://www.angelopaglialonga.com<https://www.angelopaglialonga.com/>




Il giorno 3 mag 2021, alle ore 17:36, Sukhdev Mohan <s.mohan at myti.it<mailto:s.mohan at myti.it>> ha scritto:

Wow thanks

Will this work with quotes?

Il lun 3 mag 2021, 17:34 Patrick Allen Zulueta <alexander.allenz at gmail.com<mailto:alexander.allenz at gmail.com>> ha scritto:
This works with vtiger 6 and Vtiger 7, sometimes gives error but in reports, not in salesorder/quotes, etc.

In Vtiger 7 change path vlayout by v7

Here the successful VTIGER 6.5 code for adding custom field in the item line.
The example is for adding the column dept in the quote details (in the db the colum name is cf_quotes_dept)

Thanks to https://danssy.wordpress.com/2017/01/26/vtiger-6-5-add-column-to-item-details-in-invoice-salesorder-quotes/ blog.

5 files have to be updated in VTIGER 6.5.

I will work soon on the VTIGER 7 code to set up the same field. I'll let you know. To follow ....

Cathy


A. Add a column “cf_quotes_dept” to the vtiger_inventoryproductrel table. With a VARCHAR type.

B. Edit the layouts/vlayout/modules/Inventory/LineItemsContent.tpl

a) Add:
b) Add: {assign var="dept" value="dept"|cat:$row_no}

C. Edit layouts/vlayout/modules/Inventory/LineItemsEdit.tpl
a) Add: {vtranslate('LBL_DEPTLINE',$MODULE)}


D. Edit layouts/vlayout/modules/Inventory/LineItemsDetail.tpl:
a) Add: Dept
b) Add: {$LINE_ITEM_DETAIL["dept$INDEX"]}

c)
E. Edit include/utils/EditViewUtils.php

a) Add: $product_Detail[$i]['dept'.$i]=$dept
b) Add: $dept=$adb->query_result($result,$i-1,'cf_quotes_dept');

c)
F. Edit include/utils/InventoryUtils.php
a) Add: $dept = vtlib_purify($_REQUEST['dept'.$i]);
b) Modifiy:
$query ="insert into vtiger_inventoryproductrel(id, productid, sequence_no, quantity, listprice, comment, description,cf_quotes_dept) values(?,?,?,?,?,?,?,?)";
$qparams = array($focus->id,$prod_id,$prod_seq,$qty,$listprice,$comment,$description,$dept);

El lunes, 3 de mayo de 2021, Sukhdev Mohan <s.mohan at myti.it<mailto:s.mohan at myti.it>> escribió:
Hi,

How do you add new fields to line Item?

Best Regards,
Sukhdev Mohan | Software Developer







_______________________________________________
http://www.vtiger.com/
_______________________________________________
http://www.vtiger.com/

_______________________________________________
http://www.vtiger.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20210504/d7b5e492/attachment-0001.html>


More information about the vtigercrm-developers mailing list