Skip to content
Snippets Groups Projects
Commit 6a87fcfd authored by Preexo's avatar Preexo
Browse files

replaced deprecated spliti with preg_split

parent b2f90568
No related branches found
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ class Accounts_Module_Model extends Vtiger_Module_Model {
$position = stripos($listQuery, 'where');
if($position) {
$split = spliti('where', $listQuery);
$split = preg_split('/where/', $listQuery);
$overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery. ' WHERE ' . $condition;
......
......@@ -51,7 +51,7 @@ class Campaigns_Module_Model extends Vtiger_Module_Model {
$pos = stripos($listQuery, 'where');
if ($pos) {
$split = spliti('where', $listQuery);
$split = preg_split('/where/', $listQuery);
$overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery. ' WHERE ' . $condition;
......
......@@ -85,7 +85,7 @@ class Inventory_Module_Model extends Vtiger_Module_Model {
*/
public function getExportQuery($focus, $query) {
$baseTableName = $focus->table_name;
$splitQuery = spliti(' FROM ', $query);
$splitQuery = preg_split('/ from /', $query);
$columnFields = explode(',', $splitQuery[0]);
foreach ($columnFields as $key => &$value) {
if($value == ' vtiger_inventoryproductrel.discount_amount'){
......@@ -96,7 +96,7 @@ class Inventory_Module_Model extends Vtiger_Module_Model {
$value = ' vtiger_currency_info.currency_name AS currency_id';
}
}
$joinSplit = spliti(' WHERE ',$splitQuery[1]);
$joinSplit = preg_split('/ WHERE /',$splitQuery[1]);
$joinSplit[0] .= " LEFT JOIN vtiger_currency_info ON vtiger_currency_info.id = $baseTableName.currency_id";
$splitQuery[1] = $joinSplit[0] . ' WHERE ' .$joinSplit[1];
......
......@@ -75,7 +75,7 @@ class PriceBooks_Module_Model extends Vtiger_Module_Model {
AND vtiger_pricebook.active = 1";
}
if ($pos) {
$split = spliti(' where ', $listQuery);
$split = preg_split('/ where /', $listQuery);
$overRideQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$overRideQuery = $listQuery . ' WHERE ' . $condition;
......
......@@ -133,7 +133,7 @@ class Vtiger_FindDuplicate_Model extends Vtiger_Base_Model {
$position = stripos($query, 'from');
if ($position) {
$split = spliti('from ', $query);
$split = preg_split('/from /', $query);
$splitCount = count($split);
$query = 'SELECT count(*) AS count ';
for ($i=1; $i<$splitCount; $i++) {
......
......@@ -225,7 +225,7 @@ class Vtiger_RelationListView_Model extends Vtiger_Base_Model {
$orderByFieldModuleModel = $relationModule->getFieldByColumn($orderBy);
if($orderByFieldModuleModel && $orderByFieldModuleModel->isReferenceField()) {
//If reference field then we need to perform a join with crmentity with the related to field
$queryComponents = $split = spliti(' where ', $query);
$queryComponents = $split = preg_split('/ where /', $query);
$selectAndFromClause = $queryComponents[0];
$whereCondition = $queryComponents[1];
$qualifiedOrderBy = 'vtiger_crmentity'.$orderByFieldModuleModel->get('column');
......@@ -383,10 +383,10 @@ class Vtiger_RelationListView_Model extends Vtiger_Base_Model {
$query = $queryGenerator->getQuery();
$queryComponents = spliti(' FROM ', $query);
$queryComponents = preg_split('/ from /', $query);
$query = $queryComponents[0].' ,vtiger_crmentity.crmid FROM '.$queryComponents[1];
$whereSplitQueryComponents = spliti(' WHERE ', $query);
$whereSplitQueryComponents = preg_split('/ WHERE /', $query);
$joinQuery = ' INNER JOIN '.$parentModuleBaseTable.' ON '.$parentModuleBaseTable.'.'.$parentModuleDirectRelatedField." = ".$relatedModuleBaseTable.'.'.$relatedModuleEntityIdField;
$query = "$whereSplitQueryComponents[0] $joinQuery WHERE $parentModuleBaseTable.$parentModuleEntityIdField = $parentRecordId AND $whereSplitQueryComponents[1]";
......@@ -437,7 +437,7 @@ class Vtiger_RelationListView_Model extends Vtiger_Base_Model {
$relationQuery = ereg_replace("[ \t\n\r]+", " ", $relationQuery);
$position = stripos($relationQuery,' from ');
if ($position) {
$split = spliti(' FROM ', $relationQuery);
$split = preg_split('/ from /', $relationQuery);
$splitCount = count($split);
$relationQuery = 'SELECT COUNT(DISTINCT vtiger_crmentity.crmid) AS count';
for ($i=1; $i<$splitCount; $i++) {
......@@ -476,7 +476,7 @@ class Vtiger_RelationListView_Model extends Vtiger_Base_Model {
$pos = stripos($relationQuery, 'where');
if ($pos) {
$split = spliti('where', $relationQuery);
$split = preg_split('/where/', $relationQuery);
$updatedQuery = $split[0] . ' WHERE ' . $split[1] . ' AND ' . $condition;
} else {
$updatedQuery = $relationQuery . ' WHERE ' . $condition;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment