commit
934657cc2f
@ -906,7 +906,9 @@ abstract class DolibarrModules
|
||||
dol_syslog(get_class($this)."::insert_permissions Add permission to user id=".$obj2->rowid);
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch($obj2->rowid);
|
||||
$tmpuser->addrights($r_id);
|
||||
if (!empty($tmpuser->id)) {
|
||||
$tmpuser->addrights($r_id);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if (! empty($user->admin)) // Reload permission for current user if defined
|
||||
|
||||
@ -167,7 +167,9 @@ class Fichinter extends CommonObject
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf);
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch($this->author);
|
||||
$result=$interface->run_triggers('FICHINTER_CREATE',$this,$tmpuser,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
|
||||
@ -274,8 +274,8 @@ CurrencyMAD=Dirham
|
||||
CurrencySingMAD=Dirham
|
||||
CurrencyMGA=Ariary
|
||||
CurrencySingMGA=Ariary
|
||||
CurrencyMUR=Roupies mauritiennes
|
||||
CurrencySingMUR=Roupie mauritienne
|
||||
CurrencyMUR=Roupies mauriciennes
|
||||
CurrencySingMUR=Roupie mauriciennes
|
||||
CurrencyNOK=Couronnes norvégiennes
|
||||
CurrencySingNOK=Couronne norvégienne
|
||||
CurrencySUR=Roubles
|
||||
|
||||
@ -128,7 +128,7 @@ $sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, u.rowid as agen
|
||||
$sql.= " u.login, u.name, u.firstname,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge" ;
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge" ;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE);
|
||||
@ -160,11 +160,12 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr
|
||||
if ($agentid > 0)
|
||||
$sql.= " GROUP BY s.rowid";
|
||||
else
|
||||
$sql.= " GROUP BY u.rowid";
|
||||
$sql.= " GROUP BY u.rowid, s.nom, s.rowid, s.code_client, s.client, u.login, u.name, u.firstname, f.type ";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
dol_syslog('margin::agentMargins.php sql='.$sql,LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -157,7 +157,7 @@ $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client, s.client,";
|
||||
$sql.= " f.facnumber, f.total as total_ht,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
@ -178,11 +178,12 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr
|
||||
if ($client)
|
||||
$sql.= " GROUP BY f.rowid";
|
||||
else
|
||||
$sql.= " GROUP BY s.rowid";
|
||||
$sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid ";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
dol_syslog('margin::customerMargins.php sql='.$sql,LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -159,7 +159,7 @@ $sql = "SELECT DISTINCT d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref
|
||||
$sql.= " f.facnumber, f.total as total_ht,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||
@ -182,11 +182,11 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr
|
||||
if ($id > 0)
|
||||
$sql.= " GROUP BY f.rowid";
|
||||
else
|
||||
$sql.= " GROUP BY d.fk_product";
|
||||
$sql.= " GROUP BY d.fk_product, p.label, p.rowid, p.fk_product_type, p.ref, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
dol_syslog('margin::productMargins.php sql='.$sql,LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -133,7 +133,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql.= " d.total_ht as selling_price,";
|
||||
$sql.= $db->ifsql('f.type =2','(d.buy_price_ht * d.qty *-1)','(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','d.qty *-1','d.qty')." as qty,";
|
||||
$sql.= $db->ifsql('f.type =2','((d.price + d.buy_price_ht) * d.qty)','((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= $db->ifsql('f.type =2','d.total_ht + (d.buy_price_ht * d.qty)','d.total_ht - (d.buy_price_ht * d.qty)')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -153,7 +153,8 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
|
||||
dol_syslog('margin:tabs:productMargins.php sql='.$sql,LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -131,7 +131,7 @@ if ($socid > 0)
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.buy_price_ht * d.qty *-1)','sum(d.buy_price_ht * d.qty)')." as buying_price, ";
|
||||
$sql.= $db->ifsql('f.type =2','sum((d.price + d.buy_price_ht) * d.qty)','sum((d.price - d.buy_price_ht) * d.qty)')." as marge," ;
|
||||
$sql.= $db->ifsql('f.type =2','sum(d.total_ht + (d.buy_price_ht * d.qty))','sum(d.total_ht - (d.buy_price_ht * d.qty))')." as marge," ;
|
||||
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.rowid as facid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
@ -144,11 +144,12 @@ if ($socid > 0)
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
$sql.= " GROUP BY f.rowid";
|
||||
$sql.= " GROUP BY f.rowid, s.nom, s.rowid, s.code_client, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
dol_syslog('margin:tabs:thirdpartyMargins.php sql='.$sql,LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user