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

QUAL replace MAIN_DB_PREFIX with db prefix in shipment dispatch #33088

Merged
Merged
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
18 changes: 9 additions & 9 deletions htdocs/expedition/dispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
}
if (!$error && $modebatch == "batch") {
$sql = "SELECT pb.rowid ";
$sql .= " FROM ".MAIN_DB_PREFIX."product_batch as pb";
$sql .= " JOIN ".MAIN_DB_PREFIX."product_stock as ps";
$sql .= " FROM ".$db->prefix()."product_batch as pb";
$sql .= " JOIN ".$db->prefix()."product_stock as ps";
$sql .= " ON ps.rowid = pb.fk_product_stock";
$sql .= " WHERE pb.batch = '".$db->escape($lot)."'";
$sql .= " AND ps.fk_product = ".((int) $prod_id) ;
Expand Down Expand Up @@ -241,7 +241,7 @@
$sellby = dol_mktime(0, 0, 0, GETPOSTINT('dlc'.$suffixkeyfordate.'month'), GETPOSTINT('dlc'.$suffixkeyfordate.'day'), GETPOSTINT('dlc'.$suffixkeyfordate.'year'), '');
$eatby = dol_mktime(0, 0, 0, GETPOSTINT('dluo'.$suffixkeyfordate.'month'), GETPOSTINT('dluo'.$suffixkeyfordate.'day'), GETPOSTINT('dluo'.$suffixkeyfordate.'year'));

$sqlsearchdet = "SELECT rowid FROM ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element;
$sqlsearchdet = "SELECT rowid FROM ".$db->prefix().$expeditionlinebatch->table_element;
$sqlsearchdet .= " WHERE fk_expeditiondet = ".((int) $idline);
$sqlsearchdet .= " AND batch = '".$db->escape($lot)."'";
$resqlsearchdet = $db->query($sqlsearchdet);
Expand All @@ -254,20 +254,20 @@
}

if ($objsearchdet) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element." SET";
$sql = "UPDATE ".$db->prefix().$expeditionlinebatch->table_element." SET";
$sql .= " eatby = ".($eatby ? "'".$db->idate($eatby)."'" : "null");
$sql .= " , sellby = ".($sellby ? "'".$db->idate($sellby)."'" : "null");
$sql .= " , qty = ".((float) $newqty);
$sql .= " , fk_warehouse = ".((int) $warehouse_id);
$sql .= " WHERE rowid = ".((int) $objsearchdet->rowid);
} else {
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element." (";
$sql = "INSERT INTO ".$db->prefix().$expeditionlinebatch->table_element." (";
$sql .= "fk_expeditiondet, eatby, sellby, batch, qty, fk_origin_stock, fk_warehouse)";
$sql .= " VALUES (".((int) $idline).", ".($eatby ? "'".$db->idate($eatby)."'" : "null").", ".($sellby ? "'".$db->idate($sellby)."'" : "null").", ";
$sql .= " '".$db->escape($lot)."', ".((float) $newqty).", 0, ".((int) $warehouse_id).")";
}
} else {
$sql = " DELETE FROM ".MAIN_DB_PREFIX.$expeditionlinebatch->table_element;
$sql = " DELETE FROM ".$db->prefix().$expeditionlinebatch->table_element;
$sql .= " WHERE fk_expeditiondet = ".((int) $idline);
$sql .= " AND batch = '".$db->escape($lot)."'";
}
Expand Down Expand Up @@ -567,7 +567,7 @@
// Get list of lines of the shipment $products_dispatched, with qty dispatched for each product id
$products_dispatched = array();
$sql = "SELECT ed.fk_elementdet as rowid, sum(ed.qty) as qty";
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql .= " FROM ".$db->prefix()."expeditiondet as ed";
$sql .= " WHERE ed.fk_expedition = ".((int) $object->id);
$sql .= " GROUP BY ed.fk_elementdet";

Expand Down Expand Up @@ -602,8 +602,8 @@
}
$sql .= $hookmanager->resPrint;

$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid";
$sql .= " FROM ".$db->prefix()."commandedet as l";
$sql .= " LEFT JOIN ".$db->prefix()."product as p ON l.fk_product=p.rowid";
$sql .= " WHERE l.fk_commande = ".((int) $objectsrc->id);
if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
$sql .= " AND l.product_type = 0";
Expand Down