|
@@ -1042,7 +1042,7 @@ class Form
|
|
|
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX ."societe as s";
|
|
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
- $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
|
|
|
+ $sql.= " WHERE s.entity IN (".getEntity('societe').")";
|
|
|
if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id;
|
|
|
if ($filter) $sql.= " AND (".$filter.")";
|
|
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
@@ -1282,7 +1282,7 @@ class Form
|
|
|
if ($showsoc > 0) $sql.= " , s.nom as company";
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX ."socpeople as sp";
|
|
|
if ($showsoc > 0) $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX ."societe as s ON s.rowid=sp.fk_soc";
|
|
|
- $sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
|
|
+ $sql.= " WHERE sp.entity IN (".getEntity('societe').")";
|
|
|
if ($socid > 0) $sql.= " AND sp.fk_soc=".$socid;
|
|
|
if (! empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND sp.statut <> 0";
|
|
|
$sql.= " ORDER BY sp.lastname ASC";
|
|
@@ -1905,7 +1905,7 @@ class Form
|
|
|
$sql .= " LEFT JOIN llx_product_attribute_combination pac ON pac.fk_product_child = p.rowid";
|
|
|
}
|
|
|
|
|
|
- $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
|
|
+ $sql.= ' WHERE p.entity IN ('.getEntity('product').')';
|
|
|
if (count($warehouseStatusArray))
|
|
|
{
|
|
|
$sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.implode(',',$warehouseStatusArray).'))';
|
|
@@ -2140,7 +2140,7 @@ class Form
|
|
|
$sql = "SELECT price, price_ttc, price_base_type, tva_tx";
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_price";
|
|
|
$sql.= " WHERE fk_product='".$objp->rowid."'";
|
|
|
- $sql.= " AND entity IN (".getEntity('productprice', 1).")";
|
|
|
+ $sql.= " AND entity IN (".getEntity('productprice').")";
|
|
|
$sql.= " AND price_level=".$price_level;
|
|
|
$sql.= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
|
|
|
$sql.= " LIMIT 1";
|
|
@@ -2364,7 +2364,7 @@ class Form
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
|
|
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
|
|
|
- $sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
|
|
+ $sql.= " WHERE p.entity IN (".getEntity('product').")";
|
|
|
$sql.= " AND p.tobuy = 1";
|
|
|
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$this->db->escape($filtertype);
|
|
|
if (! empty($filtre)) $sql.=" ".$filtre;
|
|
@@ -2574,7 +2574,7 @@ class Form
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
|
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
|
|
|
- $sql.= " WHERE p.entity IN (".getEntity('productprice', 1).")";
|
|
|
+ $sql.= " WHERE p.entity IN (".getEntity('productprice').")";
|
|
|
$sql.= " AND p.tobuy = 1";
|
|
|
$sql.= " AND s.fournisseur = 1";
|
|
|
$sql.= " AND p.rowid = ".$productid;
|
|
@@ -3316,7 +3316,7 @@ class Form
|
|
|
|
|
|
$sql = "SELECT rowid, label, bank, clos as status";
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
|
|
- $sql.= " WHERE entity IN (".getEntity('bank_account', 1).")";
|
|
|
+ $sql.= " WHERE entity IN (".getEntity('bank_account').")";
|
|
|
if ($statut != 2) $sql.= " AND clos = '".$statut."'";
|
|
|
if ($filtre) $sql.=" AND ".$filtre;
|
|
|
$sql.= " ORDER BY label";
|
|
@@ -4352,7 +4352,7 @@ class Form
|
|
|
$TCurrency = array();
|
|
|
|
|
|
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
|
|
|
- $sql.= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
|
|
|
+ $sql.= " WHERE entity IN ('".getEntity('mutlicurrency', false)"')";
|
|
|
$resql = $db->query($sql);
|
|
|
if ($resql)
|
|
|
{
|
|
@@ -5596,14 +5596,14 @@ class Form
|
|
|
if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent;
|
|
|
|
|
|
$possiblelinks=array(
|
|
|
- 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal',1).')'),
|
|
|
- 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande',1).')'),
|
|
|
- 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture',1).')'),
|
|
|
- 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract',1).')'),
|
|
|
- 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention',1).')'),
|
|
|
- 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal',1).')'),
|
|
|
- 'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur',1).')'),
|
|
|
- 'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn',1).')')
|
|
|
+ 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
|
|
|
+ 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
|
|
|
+ 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
|
|
|
+ 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
|
|
|
+ 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
|
|
|
+ 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
|
|
|
+ 'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
|
|
+ 'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')')
|
|
|
);
|
|
|
}
|
|
|
|