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

Rubén A. Estrada Orozco rulotec1 at gmail.com
Mon Feb 21 17:08:01 GMT 2022


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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20220221/9e1f28ae/attachment.html>


More information about the vtigercrm-developers mailing list