diff --git a/include/QueryGenerator/EnhancedQueryGenerator.php b/include/QueryGenerator/EnhancedQueryGenerator.php index 74ef79dbaeb87dee4a5a748d34b65a7fc960afe3..3f6bcb5d52ffad4f4a780d691264bfcf3ff0248c 100644 --- a/include/QueryGenerator/EnhancedQueryGenerator.php +++ b/include/QueryGenerator/EnhancedQueryGenerator.php @@ -196,7 +196,7 @@ class EnhancedQueryGenerator extends QueryGenerator { } } $this->endGroup(); - $groupConditionGlue = $groupcolumns['condition']; + $groupConditionGlue = isset($groupcolumns['condition']) ? $groupcolumns['condition'] : ""; if ($groupConditionGlue) { $this->addConditionGlue($groupConditionGlue); } diff --git a/include/Webservices/DataTransform.php b/include/Webservices/DataTransform.php index 5964d59f0a867a2d3a403061cf32b8ab5b8c4af1..d23d95a902bd6edc7b794f9e990e1c270f450e06 100644 --- a/include/Webservices/DataTransform.php +++ b/include/Webservices/DataTransform.php @@ -315,7 +315,7 @@ $row[$fieldName."_raw"] = $row[$fieldName]; $row[$fieldName] = CurrencyField::convertToUserFormat($row[$fieldName],$current_user); } else if($fieldObj->getUIType() == '72') { - $currencyConversionRate = $row['conversion_rate']; + $currencyConversionRate = isset($row['conversion_rate']) ? $row['conversion_rate'] : 0; if (!empty($currencyConversionRate)) { $rawBaseCurrencyValue = CurrencyField::convertToDollar($row[$fieldName], $currencyConversionRate); $row[$fieldName."_raw"] = $rawBaseCurrencyValue; diff --git a/include/fields/DateTimeField.php b/include/fields/DateTimeField.php index 1bfd3f4e08c88675918318333e8622590551ee5e..aa94fa6f7bf97f1004cc13d71d6457b1d98e3d95 100644 --- a/include/fields/DateTimeField.php +++ b/include/fields/DateTimeField.php @@ -137,11 +137,15 @@ class DateTimeField { list($d, $m, $y) = explode('-', $date); break; case 'mm-dd-yyyy': - list($m, $d, $y) = explode('-', $date); - break; + if (substr_count($date, '-') == 2) { + list($m, $d, $y) = explode('-', $date); + } + break; case 'yyyy-mm-dd': - list($y, $m, $d) = explode('-', $date); - break; + if (substr_count($date, '-') == 2) { + list($y, $m, $d) = explode('-', $date); + } + break; } if (!empty($y) && !empty($m) && !empty($d)) { diff --git a/layouts/v7/modules/Vtiger/ListViewActions.tpl b/layouts/v7/modules/Vtiger/ListViewActions.tpl index 17a4d2330aae7ac915b01bad2197ff28725f5002..9a5616c318dd624cd55b5c98d38e045faa21670f 100644 --- a/layouts/v7/modules/Vtiger/ListViewActions.tpl +++ b/layouts/v7/modules/Vtiger/ListViewActions.tpl @@ -39,7 +39,7 @@ <i class="fa fa-trash"></i> </button> {/if} - {if isset($commentAction)} + {if isset($commentAction) && $commentAction} <button type="button" class="btn btn-default" id="{$MODULE}_listView_massAction_{$commentAction->getLabel()}" onclick="Vtiger_List_Js.triggerMassAction('{$commentAction->getUrl()}')" title="{vtranslate('LBL_COMMENT', $MODULE)}" disabled="disabled"> <i class="fa fa-comment"></i> diff --git a/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl b/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl index 15aac76b931d09840a8d07d82799c52f1a45be61..8f77d1b0f59d4b448c5d6ef83b4779fd02a141c7 100644 --- a/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl +++ b/layouts/v7/modules/Vtiger/ListViewRecordActions.tpl @@ -20,7 +20,7 @@ {else} {assign var=STARRED value=false} {/if} - {if isset($QUICK_PREVIEW_ENABLED ) && $QUICK_PREVIEW_ENABLED eq 'true'} + {if isset($QUICK_PREVIEW_ENABLED) && $QUICK_PREVIEW_ENABLED eq 'true'} <span> <a class="quickView fa fa-eye icon action" data-app="{$SELECTED_MENU_CATEGORY}" title="{vtranslate('LBL_QUICK_VIEW', $MODULE)}"></a> </span> diff --git a/modules/Products/Products.php b/modules/Products/Products.php index d39e6ce4c74b465521b249ba8f30a4f5fc5a93ff..570da446870583381075ccec1040b1c624dafd24 100755 --- a/modules/Products/Products.php +++ b/modules/Products/Products.php @@ -14,6 +14,7 @@ class Products extends CRMEntity { var $table_name = 'vtiger_products'; var $table_index= 'productid'; var $column_fields = Array(); + var $isWorkFlowFieldUpdate; /** * Mandatory table for supporting custom fields. @@ -87,18 +88,18 @@ class Products extends CRMEntity { function save_module($module) { //Inserting into product_taxrel table - if($_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'ProcessDuplicates' && !$this->isWorkFlowFieldUpdate) + if(isset($_REQUEST['ajxaction']) != 'DETAILVIEW' && isset($_REQUEST['action']) != 'ProcessDuplicates' && !$this->isWorkFlowFieldUpdate) { - if ($_REQUEST['ajxaction'] != 'CurrencyUpdate') { + if (isset($_REQUEST['ajxaction']) != 'CurrencyUpdate') { $this->insertTaxInformation('vtiger_producttaxrel', 'Products'); } - if ($_REQUEST['action'] != 'MassEditSave' ) { + if (isset($_REQUEST['action']) != 'MassEditSave' ) { $this->insertPriceInformation('vtiger_productcurrencyrel', 'Products'); } } - if($_REQUEST['action'] == 'SaveAjax' && isset($_REQUEST['base_currency']) && isset($_REQUEST['unit_price'])){ + if(isset($_REQUEST['action']) == 'SaveAjax' && isset($_REQUEST['base_currency']) && isset($_REQUEST['unit_price'])){ $this->insertPriceInformation('vtiger_productcurrencyrel', 'Products'); } // Update unit price value in vtiger_productcurrencyrel @@ -122,7 +123,7 @@ class Products extends CRMEntity { $tax_per = ''; //Save the Product - tax relationship if corresponding tax check box is enabled //Delete the existing tax if any - if($this->mode == 'edit' && $_REQUEST['action'] != 'MassEditSave') + if($this->mode == 'edit' && isset($_REQUEST['action']) != 'MassEditSave') { for($i=0;$i<php7_count($tax_details);$i++) { @@ -135,13 +136,13 @@ class Products extends CRMEntity { { $tax_name = $tax_details[$i]['taxname']; $tax_checkname = $tax_details[$i]['taxname']."_check"; - if($_REQUEST[$tax_checkname] == 'on' || $_REQUEST[$tax_checkname] == 1) + if(isset($_REQUEST[$tax_checkname]) && ($_REQUEST[$tax_checkname] == 'on' || $_REQUEST[$tax_checkname] == 1)) { $taxid = getTaxId($tax_name); $tax_per = $_REQUEST[$tax_name]; - $taxRegions = $_REQUEST[$tax_name.'_regions']; - if ($taxRegions || $_REQUEST[$tax_name.'_defaultPercentage'] != '') { + $taxRegions = isset($_REQUEST[$tax_name.'_regions']); + if ($taxRegions || isset($_REQUEST[$tax_name.'_defaultPercentage']) != '') { $tax_per = $_REQUEST[$tax_name.'_defaultPercentage']; } else { $taxRegions = array(); @@ -155,7 +156,7 @@ class Products extends CRMEntity { $log->debug("Going to save the Product - $tax_name tax relationship"); - if ($_REQUEST['action'] === 'MassEditSave') { + if (isset($_REQUEST['action']) === 'MassEditSave') { $adb->pquery('DELETE FROM vtiger_producttaxrel WHERE productid=? AND taxid=?', array($this->id, $taxid)); } @@ -181,7 +182,7 @@ class Products extends CRMEntity { $currency_details = getAllCurrencies('all'); //Delete the existing currency relationship if any - if($this->mode == 'edit' && $_REQUEST['action'] !== 'CurrencyUpdate') + if($this->mode == 'edit' && isset($_REQUEST['action']) !== 'CurrencyUpdate') { for($i=0;$i<php7_count($currency_details);$i++) { @@ -204,7 +205,7 @@ class Products extends CRMEntity { $requestPrice = CurrencyField::convertToDBFormat($_REQUEST['unit_price'], null, true); $actualPrice = CurrencyField::convertToDBFormat($_REQUEST[$cur_valuename], null, true); $isQuickCreate = false; - if($_REQUEST['action']=='SaveAjax' && isset($_REQUEST['base_currency']) && $_REQUEST['base_currency'] == $cur_valuename){ + if(isset($_REQUEST['action'])=='SaveAjax' && isset($_REQUEST['base_currency']) && $_REQUEST['base_currency'] == $cur_valuename){ $actualPrice = $requestPrice; $isQuickCreate = true; } @@ -216,7 +217,7 @@ class Products extends CRMEntity { $log->debug("Going to save the Product - $curname currency relationship"); - if ($_REQUEST['action'] === 'CurrencyUpdate') { + if (isset($_REQUEST['action']) === 'CurrencyUpdate') { $adb->pquery('DELETE FROM vtiger_productcurrencyrel WHERE productid=? AND currencyid=?', array($this->id, $curid)); } @@ -1058,9 +1059,10 @@ class Products extends CRMEntity { $button = ''; - if(isPermitted("Products",1,"") == 'yes') + if((isPermitted("Products",1,"") == 'yes') && vtranslate('LBL_NEW_PRODUCT', 'Products') != '') { - $button .= '<input title="'.$app_strings['LBL_NEW_PRODUCT'].'" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Products\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_PRODUCT'].'"> '; + $newProductLabel = vtranslate('LBL_NEW_PRODUCT', 'Products'); + $button .= '<input title="'.$newProductLabel.'" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Products\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$newProductLabel.'"> '; } if($singlepane_view == 'true') $returnset = '&return_module=Products&return_action=DetailView&is_parent=1&return_id='.$id; diff --git a/modules/Products/actions/ExportData.php b/modules/Products/actions/ExportData.php index a958b5ee67095840ddfb4445fdcd946cb43d3d97..78df02696c3b0f9a6d8064a3fb477632f64f62ad 100644 --- a/modules/Products/actions/ExportData.php +++ b/modules/Products/actions/ExportData.php @@ -13,6 +13,7 @@ class Products_ExportData_Action extends Vtiger_ExportData_Action { var $allTaxes = array(); var $allRegions = array(); var $taxHeaders = array(); + var $headers = array(); public function getAllTaxes() { if (!$this->allTaxes) { diff --git a/modules/Products/actions/MassSave.php b/modules/Products/actions/MassSave.php index bf5f5dede43fbf9e228c8ca32e18acf097cba8d4..258cfe08064a221f18983fab29bac6bb714e2d97 100644 --- a/modules/Products/actions/MassSave.php +++ b/modules/Products/actions/MassSave.php @@ -32,6 +32,7 @@ class Products_MassSave_Action extends Vtiger_MassSave_Action { foreach($recordModels as $id => $model) { foreach ($fieldModelList as $fieldName => $fieldModel) { + $uiType = $fieldModel->get('uitype'); $fieldDataType = $fieldModel->getFieldDataType(); // This is added as we are marking massedit in vtiger6 as not an ajax operation // and this will force the date fields to be saved in user format. If the user format diff --git a/modules/Products/models/Module.php b/modules/Products/models/Module.php index ec0493ad048972fbf487f2afffd6aae1c4438705..1df90d2e377507e4d4fb2d72bce7b51ccc989921 100644 --- a/modules/Products/models/Module.php +++ b/modules/Products/models/Module.php @@ -225,7 +225,8 @@ class Products_Module_Model extends Vtiger_Module_Model { } public function getAdditionalImportFields() { - if (!$this->importableFields) { + if (!isset($this->importableFields)) { + $this->importableFields = array(); $taxModels = Inventory_TaxRecord_Model::getProductTaxes(); foreach ($taxModels as $taxId => $taxModel) { if ($taxModel->isDeleted()) { @@ -251,7 +252,6 @@ class Products_Module_Model extends Vtiger_Module_Model { } } - $this->importableFields = array(); foreach ($taxHeaders as $fieldName => $fieldLabel) { $fieldModel = new Vtiger_Field_Model(); $fieldModel->name = $fieldName; diff --git a/modules/Products/models/Record.php b/modules/Products/models/Record.php index 8659fecc8afd68462483b06f058eb94b55ef5756..198bb8afcf23630040486c5ff23a70f1c0b092f1 100644 --- a/modules/Products/models/Record.php +++ b/modules/Products/models/Record.php @@ -355,6 +355,7 @@ class Products_Record_Model extends Vtiger_Record_Model { $result = $db->pquery($sql, array($recordId)); $count = $db->num_rows($result); + $imageOriginalNamesList=array(); for($i=0; $i<$count; $i++) { $imageId = $db->query_result($result, $i, 'attachmentsid'); @@ -370,7 +371,6 @@ class Products_Record_Model extends Vtiger_Record_Model { $imageNamesList[] = $imageName; $imageUrlsList[] = $url; } - $imageOriginalNamesList=array(); if(is_array($imageOriginalNamesList)) { $countOfImages = php7_count($imageOriginalNamesList); for($j=0; $j<$countOfImages; $j++) { diff --git a/modules/Products/models/RelationListView.php b/modules/Products/models/RelationListView.php index 1b164d1badc59212dd9ee52061bcc5d07083c966..a3c19f32ed29c77a562797537f5ff4ff1127b42b 100644 --- a/modules/Products/models/RelationListView.php +++ b/modules/Products/models/RelationListView.php @@ -10,6 +10,8 @@ class Products_RelationListView_Model extends Vtiger_RelationListView_Model { + protected $tab_label; + /** * Function to get the links for related list * @return <Array> List of action models <Vtiger_Link_Model> diff --git a/modules/Vtiger/models/Field.php b/modules/Vtiger/models/Field.php index ab3a9af5209ae83018d225a9c80ed475970ea2c1..05e49e664fd823c044dd860db1aeeb8c46deedc4 100644 --- a/modules/Vtiger/models/Field.php +++ b/modules/Vtiger/models/Field.php @@ -157,7 +157,7 @@ class Vtiger_Field_Model extends Vtiger_Field { public function getModule() { if(!isset($this->module) || !$this->module) { - $moduleObj = $this->block->module; + $moduleObj = isset($this->block->module) ? $this->block->module : ""; if(empty($moduleObj)) { return false; } diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportUndoResult.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportUndoResult.tpl index a2a5a5b64f5f83872b8909a9a8e056ecc9c967b5..dbe0902335d93e68a7588fac448365c63bb65e05 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportUndoResult.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/ImportUndoResult.tpl @@ -21,7 +21,7 @@ </span> <hr style="margin-top:12px;margin-bottom:12px;"> <table class = "table table-borderless"> - {if $ERROR_MESSAGE neq ''} + {if isset($ERROR_MESSAGE) && $ERROR_MESSAGE neq ''} <span> <h4> {$ERROR_MESSAGE} diff --git a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl index 7d1078fdf99827c6de839c82f2fb9e1951c288d2..c94085a3d772eabaf28bc9a9431415141da5ddb3 100644 --- a/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl +++ b/pkg/vtiger/modules/Import/layouts/v7/modules/Import/Import_Mapping.tpl @@ -9,7 +9,7 @@ {strip} <input type="hidden" name="merge_type" value='{$USER_INPUT->get('merge_type')}' /> - <input type="hidden" name="merge_fields" value='{$MERGE_FIELDS}' /> + <input type="hidden" name="merge_fields" value='{if isset($MERGE_FIELDS)}{$MERGE_FIELDS}{else}""{/if}' /> <input type="hidden" name="lineitem_currency" value='{if isset($LINEITEM_CURRENCY)}{$LINEITEM_CURRENCY}{else}''{/if}'> <input type="hidden" id="mandatory_fields" name="mandatory_fields" value='{$ENCODED_MANDATORY_FIELDS}' /> <input type="hidden" name="field_mapping" id="field_mapping" value="" />