';
@@ -1389,14 +1414,12 @@ if ($object->id > 0)
print '';
- if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD))
- {
+ if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD)) {
// List of contacts
show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
}
- if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
- {
+ if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) {
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
// List of todo actions
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index e4d04ace6ae..899c9275d31 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -29,7 +29,9 @@
require '../main.inc.php';
-if (!$user->rights->societe->lire) accessforbidden();
+if (!$user->rights->societe->lire) {
+ accessforbidden();
+}
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
@@ -73,10 +75,18 @@ $now = dol_now();
$form = new Form($db);
$formfile = new FormFile($db);
$companystatic = new Societe($db);
-if (!empty($conf->propal->enabled)) $propalstatic = new Propal($db);
-if (!empty($conf->supplier_proposal->enabled)) $supplierproposalstatic = new SupplierProposal($db);
-if (!empty($conf->commande->enabled)) $orderstatic = new Commande($db);
-if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) $supplierorderstatic = new CommandeFournisseur($db);
+if (!empty($conf->propal->enabled)) {
+ $propalstatic = new Propal($db);
+}
+if (!empty($conf->supplier_proposal->enabled)) {
+ $supplierproposalstatic = new SupplierProposal($db);
+}
+if (!empty($conf->commande->enabled)) {
+ $orderstatic = new Commande($db);
+}
+if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) {
+ $supplierorderstatic = new CommandeFournisseur($db);
+}
llxHeader("", $langs->trans("CommercialArea"));
@@ -118,10 +128,14 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
print '
';
$i = 0;
foreach ($listofsearchfields as $key => $value) {
- if ($i == 0) print '
'.$langs->trans("Search").'
';
+ if ($i == 0) {
+ print '
'.$langs->trans("Search").'
';
+ }
print '
';
print '
';
- if ($i == 0) print '
';
+ if ($i == 0) {
+ print '
';
+ }
print '
';
$i++;
}
@@ -137,7 +151,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
* Draft customer proposals
*/
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
- $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total as total_ttc, p.fk_statut as status";
+ $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@@ -145,12 +159,18 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND p.fk_soc = s.rowid";
$sql .= " AND p.fk_statut = ".Propal::STATUS_DRAFT;
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND s.rowid = ".$socid;
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND s.rowid = ".$socid;
+ }
$resql = $db->query($sql);
if ($resql) {
@@ -236,12 +256,18 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE p.entity IN (".getEntity($supplierproposalstatic->element).")";
$sql .= " AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT;
$sql .= " AND p.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND s.rowid = ".$socid;
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND s.rowid = ".$socid;
+ }
$resql = $db->query($sql);
if ($resql) {
@@ -326,12 +352,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
$sql .= " AND c.fk_statut = ".Commande::STATUS_DRAFT;
$sql .= " AND c.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND c.fk_soc = ".$socid;
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND c.fk_soc = ".$socid;
+ }
$resql = $db->query($sql);
if ($resql) {
@@ -417,12 +449,18 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE cf.entity IN (".getEntity($supplierorderstatic->element).")";
$sql .= " AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT;
$sql .= " AND cf.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND cf.fk_soc = ".$socid;
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND cf.fk_soc = ".$socid;
+ }
$resql = $db->query($sql);
if ($resql) {
@@ -509,11 +547,17 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
$sql .= ", s.canvas";
$sql .= ", s.datec, s.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
$sql .= " AND s.client IN (".Societe::CUSTOMER.", ".Societe::PROSPECT.", ".Societe::CUSTOMER_AND_PROSPECT.")";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND s.rowid = $socid";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND s.rowid = $socid";
+ }
$sql .= " ORDER BY s.tms DESC";
$sql .= $db->plimit($max, 0);
@@ -521,11 +565,9 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
if ($resql) {
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$header = "BoxTitleLastCustomersOrProspects";
- }
- elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
+ } elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$header = "BoxTitleLastModifiedProspects";
- }
- else {
+ } else {
$header = "BoxTitleLastModifiedCustomers";
}
@@ -559,12 +601,10 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
$obj = $companystatic;
$s = '';
- if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
- {
+ if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$s .= ''.dol_substr($langs->trans("Prospect"), 0, 1).'';
}
- if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
- {
+ if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$s .= ''.dol_substr($langs->trans("Customer"), 0, 1).'';
}
/*
@@ -603,11 +643,17 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
$sql .= ", s.canvas";
$sql .= ", s.datec as dc, s.tms as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$user->socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
$sql .= " AND s.fournisseur = ".Societe::SUPPLIER;
- if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND s.rowid = ".$socid;
+ if (!$user->rights->societe->client->voir && !$user->socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND s.rowid = ".$socid;
+ }
$sql .= " ORDER BY s.datec DESC";
$sql .= $db->plimit($max, 0);
@@ -649,8 +695,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
{
$s .= ''.dol_substr($langs->trans("Customer"), 0, 1).'';
}*/
- if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur)
- {
+ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) {
$s .= ''.dol_substr($langs->trans("Supplier"), 0, 1).'';
}
print $s;
@@ -704,12 +749,18 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
$sql .= ", ".MAIN_DB_PREFIX."product as p";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE c.entity IN (".getEntity($staticcontrat->element).")";
$sql .= " AND c.fk_soc = s.rowid";
$sql .= " AND c.fk_product = p.rowid";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND s.rowid = ".$socid;
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND s.rowid = ".$socid;
+ }
$sql .= " ORDER BY c.tms DESC";
$sql .= $db->plimit($max + 1, 0);
@@ -765,7 +816,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T
* Opened (validated) proposals
*/
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
- $sql = "SELECT p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
+ $sql = "SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@@ -773,12 +824,18 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND p.fk_soc = s.rowid";
$sql .= " AND p.fk_statut = ".Propal::STATUS_VALIDATED;
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND s.rowid = ".$socid;
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND s.rowid = ".$socid;
+ }
$sql .= " ORDER BY p.rowid DESC";
$resql = $db->query($sql);
@@ -883,12 +940,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ }
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
$sql .= " AND c.fk_soc = s.rowid";
$sql .= " AND c.fk_statut IN (".Commande::STATUS_VALIDATED.", ".Commande::STATUS_SHIPMENTONPROCESS.")";
- if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
- if ($socid) $sql .= " AND s.rowid = ".$socid;
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ }
+ if ($socid) {
+ $sql .= " AND s.rowid = ".$socid;
+ }
$sql .= " ORDER BY c.rowid DESC";
$resql = $db->query($sql);
diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php
index e496b8ab124..b02ac911bad 100644
--- a/htdocs/comm/propal/index.php
+++ b/htdocs/comm/propal/index.php
@@ -29,8 +29,7 @@ require '../../main.inc.php';
// Security check
$socid = GETPOST('socid', 'int');
-if (isset($user->socid) && $user->socid > 0)
-{
+if (isset($user->socid) && $user->socid > 0) {
$action = '';
$socid = $user->socid;
}
@@ -66,8 +65,7 @@ print '
';
print '
';
// This is useless due to the global search combo
-if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))
-{
+if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) {
print '