From 4bd5774422c82cf4f15e3c167ca4d1077c823143 Mon Sep 17 00:00:00 2001 From: yogeshwar <yogeshwar.g@vtigersolutions.com> Date: Thu, 23 May 2024 10:40:12 +0530 Subject: [PATCH] E-ALL - Organization Module --- include/ListView/ListViewSession.php | 1 + include/utils/EditViewUtils.php | 7 +++++-- .../Inventory/partials/LineItemsContent.tpl | 16 ++++++++-------- .../Inventory/partials/LineItemsEdit.tpl | 2 +- .../v7/modules/Vtiger/uitypes/Salutation.tpl | 2 +- modules/Accounts/Accounts.php | 1 + modules/Inventory/models/Record.php | 19 +++++++++---------- modules/Inventory/views/Edit.php | 2 +- modules/Vtiger/actions/GetData.php | 2 +- modules/Vtiger/uitypes/Reference.php | 2 ++ 10 files changed, 30 insertions(+), 24 deletions(-) diff --git a/include/ListView/ListViewSession.php b/include/ListView/ListViewSession.php index 790aab942..168b08b1e 100644 --- a/include/ListView/ListViewSession.php +++ b/include/ListView/ListViewSession.php @@ -76,6 +76,7 @@ class ListViewSession { $cv = new CustomView(); $viewId = $cv->getViewId($currentModule); $recordNavigationInfo = array(); + $searchKey = array(); if(!empty($_SESSION[$currentModule.'_DetailView_Navigation'.$viewId])){ $recordNavigationInfo = Zend_Json::decode($_SESSION[$currentModule.'_DetailView_Navigation'.$viewId]); $pageNumber =0; diff --git a/include/utils/EditViewUtils.php b/include/utils/EditViewUtils.php index 48d0bb95b..3b35f4924 100755 --- a/include/utils/EditViewUtils.php +++ b/include/utils/EditViewUtils.php @@ -89,6 +89,7 @@ function getAssociatedProducts($module, $focus, $seid = '', $refModuleName = fal $log->debug("Entering getAssociatedProducts(".$module.",".get_class($focus).",".$seid."='') method ..."); global $adb; $output = ''; + $taxtype = ''; global $theme,$current_user; $no_of_decimal_places = getCurrencyDecimalPlaces(); @@ -468,8 +469,10 @@ function getAssociatedProducts($module, $focus, $seid = '', $refModuleName = fal if($tax_percent == '' || $tax_percent == 'NULL') $tax_percent = 0; $taxamount = ($subTotal-$finalDiscount)*$tax_percent/100; - list($before_dot, $after_dot) = explode('.', $taxamount); - if($after_dot[$no_of_decimal_places] == 5) { + $split_taxamounts =explode('.', $taxamount); + $before_dot=isset($split_taxamounts[0]) ? $split_taxamounts[0] : ''; + $after_dot=isset($split_taxamounts[1]) ? $split_taxamounts[1] : ''; + if(isset($after_dot[$no_of_decimal_places]) && $after_dot[$no_of_decimal_places] == 5) { $taxamount = round($taxamount, $no_of_decimal_places, PHP_ROUND_HALF_UP); } else { $taxamount = number_format($taxamount, $no_of_decimal_places,'.',''); diff --git a/layouts/v7/modules/Inventory/partials/LineItemsContent.tpl b/layouts/v7/modules/Inventory/partials/LineItemsContent.tpl index 7f8a3dff9..61abbcdd9 100644 --- a/layouts/v7/modules/Inventory/partials/LineItemsContent.tpl +++ b/layouts/v7/modules/Inventory/partials/LineItemsContent.tpl @@ -24,7 +24,7 @@ {assign var="subprod_names" value="subprod_names"|cat:$row_no} {assign var="subprod_qty_list" value="subprod_qty_list"|cat:$row_no} {assign var="entityIdentifier" value="entityType"|cat:$row_no} - {assign var="entityType" value=$data.$entityIdentifier} + {assign var="entityType" value=(isset($data.$entityIdentifier)) ? $data.$entityIdentifier : ""} {assign var="discount_type" value="discount_type"|cat:$row_no} {assign var="discount_percent" value="discount_percent"|cat:$row_no} @@ -42,7 +42,7 @@ {assign var="FINAL" value=$RELATED_PRODUCTS.1.final_details} {assign var="productDeleted" value="productDeleted"|cat:$row_no} - {assign var="productId" value=$data[$hdnProductId]} + {assign var="productId" value=(isset($data[$hdnProductId])) ? $data[$hdnProductId] : ""} {assign var="listPriceValues" value=Products_Record_Model::getListPriceValues($productId)} {if $MODULE eq 'PurchaseOrder'} {assign var="listPriceValues" value=array()} @@ -57,7 +57,7 @@ <a><img src="{vimage_path('drag.png')}" border="0" title="{vtranslate('LBL_DRAG',$MODULE)}"/></a> <input type="hidden" class="rowNumber" value="{$row_no}" /> </td> - {if $IMAGE_EDITABLE} + {if isset($IMAGE_EDITABLE) && $IMAGE_EDITABLE} <td class='lineItemImage' style="text-align:center;"> <img src='{$data.$image}' height="42" width="42"> </td> @@ -66,20 +66,20 @@ {if $PRODUCT_EDITABLE} <td> <!-- Product Re-Ordering Feature Code Addition Starts --> - <input type="hidden" name="hidtax_row_no{$row_no}" id="hidtax_row_no{$row_no}" value="{$tax_row_no}"/> + <input type="hidden" name="hidtax_row_no{$row_no}" id="hidtax_row_no{$row_no}" value="{(isset($tax_row_no)) ? $tax_row_no : ""}"/> <!-- Product Re-Ordering Feature Code Addition ends --> <div class="itemNameDiv form-inline"> <div class="row"> <div class="col-lg-10"> <div class="input-group" style="width:100%"> - <input type="text" id="{$productName}" name="{$productName}" value="{$data.$productName}" class="productName form-control {if $row_no neq 0} autoComplete {/if} " placeholder="{vtranslate('LBL_TYPE_SEARCH',$MODULE)}" + <input type="text" id="{$productName}" name="{$productName}" value="{(isset($data.$productName)) ? $data.$productName : ""}" class="productName form-control {if $row_no neq 0} autoComplete {/if} " placeholder="{vtranslate('LBL_TYPE_SEARCH',$MODULE)}" data-rule-required=true {if !empty($data.$productName)} disabled="disabled" {/if}> - {if !$data.$productDeleted} + {if isset($data.$productDeleted) && !$data.$productDeleted} <span class="input-group-addon cursorPointer clearLineItem" title="{vtranslate('LBL_CLEAR',$MODULE)}"> <i class="fa fa-times-circle"></i> </span> {/if} - <input type="hidden" id="{$hdnProductId}" name="{$hdnProductId}" value="{$data.$hdnProductId}" class="selectedModuleId"/> + <input type="hidden" id="{$hdnProductId}" name="{$hdnProductId}" value="{(isset($data.$hdnProductId)) ? $data.$hdnProductId : ""}" class="selectedModuleId"/> <input type="hidden" id="lineItemType{$row_no}" name="lineItemType{$row_no}" value="{$entityType}" class="lineItemType"/> <div class="col-lg-2"> {if $row_no eq 0} @@ -101,7 +101,7 @@ </div> </div> </div> - <input type="hidden" value="{$data.$subproduct_ids}" id="{$subproduct_ids}" name="{$subproduct_ids}" class="subProductIds" /> + <input type="hidden" value="{(isset($data.$subproduct_ids)) ? $data.$subproduct_ids : ""}" id="{$subproduct_ids}" name="{$subproduct_ids}" class="subProductIds" /> <div id="{$subprod_names}" name="{$subprod_names}" class="subInformation"> <span class="subProductsContainer"> {foreach key=SUB_PRODUCT_ID item=SUB_PRODUCT_INFO from=$data.$subprod_qty_list} diff --git a/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl b/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl index 6942eda2b..a32fe88aa 100644 --- a/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl +++ b/layouts/v7/modules/Inventory/partials/LineItemsEdit.tpl @@ -67,7 +67,7 @@ {/if} <input type="hidden" class="numberOfCurrencyDecimal" value="{$USER_MODEL->get('no_of_currency_decimals')}" /> -<input type="hidden" name="totalProductCount" id="totalProductCount" value="{$row_no}" /> +<input type="hidden" name="totalProductCount" id="totalProductCount" value="{(isset($row_no)) ? $row_no : ""}" /> <input type="hidden" name="subtotal" id="subtotal" value="" /> <input type="hidden" name="total" id="total" value="" /> diff --git a/layouts/v7/modules/Vtiger/uitypes/Salutation.tpl b/layouts/v7/modules/Vtiger/uitypes/Salutation.tpl index 537cf772c..ed6a34b6d 100644 --- a/layouts/v7/modules/Vtiger/uitypes/Salutation.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/Salutation.tpl @@ -14,7 +14,7 @@ <select class="inputElement select2" style="width:78px;" name="{$SALUTATION_FIELD_MODEL->get('name')}" > {if $SALUTATION_FIELD_MODEL->isEmptyPicklistOptionAllowed()}<option value="">{vtranslate('LBL_NONE', $MODULE)}</option>{/if} {foreach item=PICKLIST_VALUE key=PICKLIST_NAME from=$PICKLIST_VALUES} - <option value="{Vtiger_Util_Helper::toSafeHTML($PICKLIST_NAME)}" {if trim(decode_html($SALUTATION_FIELD_MODEL->get('fieldvalue'))) eq trim($PICKLIST_NAME)} selected {/if}>{$PICKLIST_VALUE}</option> + <option value="{Vtiger_Util_Helper::toSafeHTML($PICKLIST_NAME)}" {if isset($SALUTATION_FIELD_MODEL->get('fieldvalue')) && trim(decode_html($SALUTATION_FIELD_MODEL->get('fieldvalue'))) eq trim($PICKLIST_NAME)} selected {/if}>{$PICKLIST_VALUE}</option> {/foreach} </select> {/if} diff --git a/modules/Accounts/Accounts.php b/modules/Accounts/Accounts.php index 1076fcf2b..cb8fd9a84 100644 --- a/modules/Accounts/Accounts.php +++ b/modules/Accounts/Accounts.php @@ -1646,6 +1646,7 @@ class Accounts extends CRMEntity { $singular_modname = 'SINGLE_' . $related_module; $button = ''; + $query = ''; if ($actions) { if (is_string($actions)) $actions = explode(',', strtoupper($actions)); diff --git a/modules/Inventory/models/Record.php b/modules/Inventory/models/Record.php index 8019e8a07..318244586 100644 --- a/modules/Inventory/models/Record.php +++ b/modules/Inventory/models/Record.php @@ -349,8 +349,8 @@ class Inventory_Record_Model extends Vtiger_Record_Model { $productIdsList = array(); foreach ($productDetails as $key => $lineItemDetail) { - $productId = $lineItemDetail['hdnProductId'.$key]; - $entityType = $lineItemDetail['entityType'.$key]; + $productId = isset($lineItemDetail['hdnProductId'.$key]) ? $lineItemDetail['hdnProductId'.$key] : ""; + $entityType = isset($lineItemDetail['entityType'.$key]) ? $lineItemDetail['entityType'.$key] : ""; $productIdsList[$entityType][] = $productId; } @@ -362,19 +362,18 @@ class Inventory_Record_Model extends Vtiger_Record_Model { //Getting image details of each product $imageDetailsList = array(); - if ($productIdsList['Products']) { + if (isset($productIdsList['Products']) && $productIdsList['Products']) { $imageDetailsList = Products_Record_Model::getProductsImageDetails($productIdsList['Products']); } foreach ($productDetails as $key => $lineItemDetail) { - $productId = $lineItemDetail['hdnProductId'.$key]; - $entityType = $lineItemDetail['entityType'.$key]; - + $productId = isset($lineItemDetail['hdnProductId'.$key]) ? $lineItemDetail['hdnProductId'.$key] : ""; + $entityType = isset($lineItemDetail['entityType'.$key]) ? $lineItemDetail['entityType'.$key] : ""; + //updating list price details - $productDetails[$key]['listPrice'.$key] = number_format((float)$convertedPriceDetails[$entityType][$productId], $numOfCurrencyDecimals, '.', ''); - + $productDetails[$key]['listPrice'.$key] = isset($convertedPriceDetails[$entityType][$productId]) ? number_format((float)$convertedPriceDetails[$entityType][$productId], $numOfCurrencyDecimals, '.', ''):""; //updating cost price details - $purchaseCost = (float)$userCurrencyInfo['conversion_rate'] * (float)$lineItemDetail['purchaseCost'.$key]; + $purchaseCost = isset($lineItemDetail['purchaseCost'.$key]) ? (float)$userCurrencyInfo['conversion_rate'] * (float)$lineItemDetail['purchaseCost'.$key] :0; $productDetails[$key]['purchaseCost'.$key] = number_format($purchaseCost, $numOfCurrencyDecimals, '.', ''); if($moduleName === 'PurchaseOrder') { @@ -382,7 +381,7 @@ class Inventory_Record_Model extends Vtiger_Record_Model { } //Image detail - if ($imageDetailsList[$productId]) { + if (isset($imageDetailsList[$productId]) && $imageDetailsList[$productId]) { $imageDetails = $imageDetailsList[$productId]; $productDetails[$key]['productImage'.$key] = $imageDetails[0]['path'].'_'.$imageDetails[0]['orgname']; } diff --git a/modules/Inventory/views/Edit.php b/modules/Inventory/views/Edit.php index ee927809f..f6762d408 100644 --- a/modules/Inventory/views/Edit.php +++ b/modules/Inventory/views/Edit.php @@ -120,7 +120,7 @@ Class Inventory_Edit_View extends Vtiger_Edit_View { } } - $deductTaxes = $relatedProducts ? $relatedProducts[1]['final_details']['deductTaxes'] : null; + $deductTaxes = $relatedProducts && isset($relatedProducts[1]['final_details']['deductTaxes']) ? $relatedProducts[1]['final_details']['deductTaxes'] : null; if (!$deductTaxes) { $deductTaxes = Inventory_TaxRecord_Model::getDeductTaxesList(); } diff --git a/modules/Vtiger/actions/GetData.php b/modules/Vtiger/actions/GetData.php index 148a59b83..d36dd292f 100644 --- a/modules/Vtiger/actions/GetData.php +++ b/modules/Vtiger/actions/GetData.php @@ -11,7 +11,7 @@ class Vtiger_GetData_Action extends Vtiger_IndexAjax_View { public function requiresPermission(\Vtiger_Request $request) { - $permissions = array('module_parameter' => 'source_module', 'action' => 'DetailView', 'record_parameter' => 'record'); + $permissions[] = array('module_parameter' => 'source_module', 'action' => 'DetailView', 'record_parameter' => 'record'); return $permissions; } diff --git a/modules/Vtiger/uitypes/Reference.php b/modules/Vtiger/uitypes/Reference.php index 2769a4553..f18a14085 100644 --- a/modules/Vtiger/uitypes/Reference.php +++ b/modules/Vtiger/uitypes/Reference.php @@ -68,6 +68,8 @@ class Vtiger_Reference_UIType extends Vtiger_Base_UIType { * @return link */ public function getEditViewDisplayValue($value) { + // file_put_contents("vtesting.log", sprintf("ENTRIES: %s\n", var_export($value, true)), FILE_APPEND); + if(!$value) return $value; $referenceModule = $this->getReferenceModule($value); if($referenceModule) { $referenceModuleName = $referenceModule->get('name'); -- GitLab