[Vtigercrm-developers] Saving custom hidden field in Quote line item

Sukhdev Mohan s.mohan at myti.it
Mon Feb 21 17:18:16 GMT 2022


Checking this out right now.

Yeah it could save us the trouble of debugging each part of the the code base… By Field editor you mean the Layout page in settings? Or the Vtlib api? Is there any other tool?

It’s be also nice to have an updated list of UITYPEs, some of the previous ones you may find on google or web archive are outdated or doesn’t work...

Sukhdev Mohan
Developer

MyTi S.r.l - share the path
Via Branze 44, Brescia
www.myti.it

Bleen - Declaro - Dundas - Elibra
On 21 Feb 2022, 18:14 +0100, Rubén A. Estrada Orozco <rulotec1 at gmail.com>, wrote:
> Hi Sukhdev,
>
> I worked on this just a few days ago. To add a line item field you have to edit the following files:
>
>   - include/utils/EditViewUtils.php # in order to read your field from the DB and show it in DetailView
>   - include/utils/InventoryUtils.php # in order to save your field into the DB when saving a record
>   - layouts/v7/modules/Inventory/LineItemsDetail.tpl # to display your field in the DetailView
>   - layouts/v7/modules/Inventory/partials/LineItemsContent.tpl # to display your field in EditView
>   - layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl # to display the table header of your field in EditView
>
> I should say... it's a pretty common request from clients to add fields to the line items section. It would be great to do it via the Fields Editor.
>
> Saludos
>
> Rubén
>
>
> > On Mon, Feb 21, 2022 at 11:01 AM Sukhdev Mohan <s.mohan at myti.it> wrote:
> > > Hi all,
> > >
> > > I want to save a hidden input value into vtiger_inventoryproductrel along with the other line item properties. I’ve already crated the field and a the column and followed the naming convention (myvar$row_no) but when I save the value isn’t saved. I’m not understanding where I’m missing.
> > >
> > > It seems that some thing happens in getRecordModelFromRequest() in modules/Vtiger/actions/Save.php
> > > This code seems to transfer the the values from the form to the RecordModel but there is no logic for columnName$row_no and all the others properties are being settled correctly. What am I missing?
> > > $fieldModelList = $moduleModel->getFields();
> > >      foreach ($fieldModelList as $fieldName => $fieldModel) {
> > >   $fieldValue = $request->get($fieldName, null);
> > >   $fieldDataType = $fieldModel->getFieldDataType();
> > >   if($fieldDataType == 'time'){
> > >      $fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
> > >   }
> > >   if($fieldValue !== null) {
> > >      if(!is_array($fieldValue) && $fieldDataType != 'currency') {
> > >         $fieldValue = trim($fieldValue);
> > >      }
> > >      $recordModel->set($fieldName, $fieldValue);
> > >   }
> > > }
> > >
> > >
> > > Sukhdev Mohan
> > > Developer
> > > _______________________________________________
> > > http://www.vtiger.com/
> _______________________________________________
> http://www.vtiger.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20220221/88b8f1a7/attachment.html>


More information about the vtigercrm-developers mailing list