Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orden por defecto en SalesModal #1690

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Core/Base/AjaxForms/SalesModalHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,14 @@ protected static function getProducts(): array
if (count($words) === 1) {
$sql .= " AND (LOWER(v.codbarras) = " . $dataBase->var2str(self::$query)
. " OR LOWER(v.referencia) LIKE '%" . self::$query . "%'"
. " OR LOWER(p.descripcion) LIKE '%" . self::$query . "%')";
. " OR LOWER(p.descripcion) LIKE '%" . self::$query . "%'"
. " OR LOWER(v.descripcion_alt) LIKE '%" . self::$query . "%')";
} elseif (count($words) > 1) {
$sql .= " AND (LOWER(v.referencia) LIKE '%" . self::$query . "%' OR (";
foreach ($words as $wc => $word) {
$sql .= $wc > 0 ?
" AND LOWER(p.descripcion) LIKE '%" . $word . "%'" :
"LOWER(p.descripcion) LIKE '%" . $word . "%'";
" AND (LOWER(p.descripcion) LIKE '%" . $word . "%' OR LOWER(v.descripcion_alt) LIKE '%" . $word . "%')" :
"(LOWER(p.descripcion) LIKE '%" . $word . "%' OR LOWER(v.descripcion_alt) LIKE '%" . $word . "%')";
}
$sql .= "))";
}
Expand All @@ -261,6 +262,9 @@ protected static function getProducts(): array
case 'stock_desc':
$sql .= " ORDER BY 8 DESC";
break;
default:
$sql .= " ORDER BY 8 DESC";
break;
}

$results = $dataBase->selectLimit($sql);
Expand Down
10 changes: 7 additions & 3 deletions Core/Lib/AjaxForms/SalesModalHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,14 @@ protected static function getProducts(): array
if (count($words) === 1) {
$sql .= " AND (LOWER(v.codbarras) = " . $dataBase->var2str(self::$query)
. " OR LOWER(v.referencia) LIKE '%" . self::$query . "%'"
. " OR LOWER(p.descripcion) LIKE '%" . self::$query . "%')";
. " OR LOWER(p.descripcion) LIKE '%" . self::$query . "%'"
. " OR LOWER(v.descripcion_alt) LIKE '%" . self::$query . "%')";
} elseif (count($words) > 1) {
$sql .= " AND (LOWER(v.referencia) LIKE '%" . self::$query . "%' OR (";
foreach ($words as $wc => $word) {
$sql .= $wc > 0 ?
" AND LOWER(p.descripcion) LIKE '%" . $word . "%'" :
"LOWER(p.descripcion) LIKE '%" . $word . "%'";
" AND (LOWER(p.descripcion) LIKE '%" . $word . "%' OR LOWER(v.descripcion_alt) LIKE '%" . $word . "%')" :
"(LOWER(p.descripcion) LIKE '%" . $word . "%' OR LOWER(v.descripcion_alt) LIKE '%" . $word . "%')";
}
$sql .= "))";
}
Expand All @@ -257,6 +258,9 @@ protected static function getProducts(): array
case 'stock_desc':
$sql .= " ORDER BY 8 DESC";
break;
default:
$sql .= " ORDER BY 8 DESC";
break;
}

$results = $dataBase->selectLimit($sql);
Expand Down