Fix database prefix usage

This commit is contained in:
Raphaël Doursenaud 2014-06-26 15:51:14 +02:00
parent 018771c0f5
commit f5980a1d20
2 changed files with 4 additions and 4 deletions

View File

@ -61,8 +61,8 @@ if(empty($year)) {
}
$sql = "SELECT cp.rowid, cp.fk_user, cp.date_debut, cp.date_fin, cp.halfday";
$sql.= " FROM llx_holiday cp";
$sql.= " LEFT JOIN llx_user u ON cp.fk_user = u.rowid";
$sql.= " FROM " . MAIN_DB_PREFIX . "holiday cp";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "user u ON cp.fk_user = u.rowid";
$sql.= " WHERE cp.statut = 3"; // Approved
// TODO Use BETWEEN instead of date_format
$sql.= " AND (date_format(cp.date_debut, '%Y-%c') = '$year-$month' OR date_format(cp.date_fin, '%Y-%c') = '$year-$month')";

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
function dispatched($order_id)
{
global $db;
$sql = 'SELECT fk_product, SUM(qty) from llx_commande_fournisseur_dispatch';
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch';
$sql .= ' WHERE fk_commande = ' . $order_id . ' GROUP BY fk_product';
$sql .= ' ORDER by fk_product';
$resql = $db->query($sql);
@ -44,7 +44,7 @@ function dispatched($order_id)
while($res = $db->fetch_object($resql))
$dispatched[] = $res;
}
$sql = 'SELECT fk_product, SUM(qty) from llx_commande_fournisseurdet';
$sql = 'SELECT fk_product, SUM(qty) FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet';
$sql .= ' WHERE fk_commande = ' . $order_id . ' GROUP BY fk_product';
$sql .= ' ORDER by fk_product';
$resql = $db->query($sql);