Skip to content

Commit

Permalink
fix: Init bar code page must filter by entity
Browse files Browse the repository at this point in the history
  • Loading branch information
FHenry committed Feb 16, 2024
1 parent 3867d16 commit a155de7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions htdocs/barcode/codeinit.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
$nbok = 0;
if (!empty($eraseallthirdpartybarcode)) {
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
$sql .= " AND entity IN (".getEntity('societe').")";
$sql .= " SET barcode = NULL";
$resql = $db->query($sql);
if ($resql) {
Expand All @@ -120,6 +121,7 @@
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
$sql .= " WHERE barcode IS NULL or barcode = ''";
$sql .= " AND entity IN (".getEntity('societe').")";
$sql .= $db->order("datec", "ASC");
$sql .= $db->plimit($maxperinit);

Expand Down Expand Up @@ -211,6 +213,7 @@
if (!empty($eraseallproductbarcode)) {
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
$sql .= " SET barcode = NULL";
$sql .= " WHERE entity IN (".getEntity('product').")";
$resql = $db->query($sql);
if ($resql) {
setEventMessages($langs->trans("AllBarcodeReset"), null, 'mesgs');
Expand All @@ -222,6 +225,7 @@
$sql = "SELECT rowid, ref, fk_product_type";
$sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE barcode IS NULL or barcode = ''";
$sql .= " AND entity IN (".getEntity('product').")";
$sql .= $db->order("datec", "ASC");
$sql .= $db->plimit($maxperinit);

Expand Down Expand Up @@ -322,6 +326,7 @@ function confirm_erase() {
}

$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe";
$sql .= " WHERE entity IN (".getEntity('societe').")";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
Expand Down Expand Up @@ -376,6 +381,7 @@ function confirm_erase() {
$sql = "SELECT count(rowid) as nb, fk_product_type, datec";
$sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE barcode IS NULL OR barcode = ''";
$sql .= " AND entity IN (".getEntity('product').")";
$sql .= " GROUP BY fk_product_type, datec";
$sql .= " ORDER BY datec";
$resql = $db->query($sql);
Expand Down

0 comments on commit a155de7

Please sign in to comment.