Merge pull request #8437 from hregis/7.0_bug6
Fix: uniformize getEntity('intervention')
This commit is contained in:
commit
d63c8356f4
@ -167,7 +167,7 @@ function societe_prepare_head(Societe $object)
|
||||
}
|
||||
|
||||
// Related items
|
||||
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Referers");
|
||||
|
||||
@ -124,7 +124,7 @@ class Interventions extends DolibarrApi
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('fichinter').')';
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('intervention').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
|
||||
@ -128,7 +128,7 @@ class Fichinter extends CommonObject
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql.= " ".$clause." fi.entity IN (".getEntity($this->element).")";
|
||||
$sql.= " ".$clause." fi.entity IN (".getEntity('intervention').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -348,7 +348,10 @@ class Fichinter extends CommonObject
|
||||
$sql.= " f.tms as datem,";
|
||||
$sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
if ($ref) $sql.= " WHERE f.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref) {
|
||||
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " AND f.ref='".$this->db->escape($ref)."'";
|
||||
}
|
||||
else $sql.= " WHERE f.rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -783,7 +786,6 @@ class Fichinter extends CommonObject
|
||||
$sql.= " f.fk_user_valid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql.= " WHERE f.rowid = ".$id;
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -887,7 +889,6 @@ class Fichinter extends CommonObject
|
||||
// Delete object
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinter";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("Fichinter::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -951,7 +952,6 @@ class Fichinter extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||
$sql.= " SET datei = '".$this->db->idate($date_delivery)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND fk_statut = 0";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
@ -985,7 +985,6 @@ class Fichinter extends CommonObject
|
||||
$sql.= " SET description = '".$this->db->escape($description)."',";
|
||||
$sql.= " fk_user_modif = ".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -1018,7 +1017,6 @@ class Fichinter extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
|
||||
$sql.= " SET fk_contrat = '".$contractid."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
@ -1401,7 +1399,7 @@ class FichinterLigne extends CommonObjectLine
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$this->id=$this->rowid;
|
||||
$this->id=$this->id;
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -1463,7 +1461,7 @@ class FichinterLigne extends CommonObjectLine
|
||||
$sql.= ",date='".$this->db->idate($this->datei)."'";
|
||||
$sql.= ",duree=".$this->duration;
|
||||
$sql.= ",rang='".$this->db->escape($this->rang)."'";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("FichinterLigne::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1472,7 +1470,7 @@ class FichinterLigne extends CommonObjectLine
|
||||
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$this->id=$this->rowid;
|
||||
$this->id=$this->id;
|
||||
$result=$this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -1541,7 +1539,6 @@ class FichinterLigne extends CommonObjectLine
|
||||
$sql.= " , dateo = ".(! empty($obj->dateo)?"'".$this->db->idate($obj->dateo)."'":"null");
|
||||
$sql.= " , datee = ".(! empty($obj->datee)?"'".$this->db->idate($obj->datee)."'":"null");
|
||||
$sql.= " WHERE rowid = ".$this->fk_fichinter;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog("FichinterLigne::update_total", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1580,10 +1577,10 @@ class FichinterLigne extends CommonObjectLine
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::deleteline lineid=".$this->rowid);
|
||||
dol_syslog(get_class($this)."::deleteline lineid=".$this->id);
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->rowid;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@ -81,8 +81,8 @@ $sql = "SELECT count(f.rowid), f.fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity IN (".getEntity('societe').")";
|
||||
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
if ($user->societe_id) $sql.=' AND f.fk_soc = '.$user->societe_id;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " GROUP BY f.fk_statut";
|
||||
@ -180,8 +180,8 @@ if (! empty($conf->ficheinter->enabled))
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut = 0";
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
@ -228,8 +228,8 @@ $sql.= " s.nom as name, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity IN (".getEntity('commande').")";
|
||||
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
//$sql.= " AND c.fk_statut > 2";
|
||||
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
@ -299,8 +299,8 @@ if (! empty($conf->ficheinter->enabled))
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut = 1";
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
|
||||
@ -194,8 +194,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
||||
if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid ";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
|
||||
$sql.= " AND f.fk_soc = s.rowid";
|
||||
if ($search_ref) {
|
||||
$sql .= natural_search('f.ref', $search_ref);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ if (! empty($conf->societe->enabled)) $tmparray['societe/index.php?mainmenu=comp
|
||||
if (! empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=project&leftmenu=']='ProjectsArea';
|
||||
if (! empty($conf->holiday->enabled) || ! empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu=']='HRMArea'; // TODO Complete list with first level of menus
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu=']='ProductsAndServicesArea';
|
||||
if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu=']='CommercialArea';
|
||||
if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu=']='CommercialArea';
|
||||
if (! empty($conf->compta->enabled) || ! empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu=']='AccountancyTreasuryArea';
|
||||
if (! empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu=']='MembersArea';
|
||||
if (! empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu=']='Agenda';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user