Fix: use 0 instead false
This commit is contained in:
parent
0eadef9a7a
commit
a25facef7c
@ -22,7 +22,7 @@ Following changes may create regression for some external modules, but were nece
|
||||
* Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used.
|
||||
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
|
||||
exists, but if an external module need action on it, it must provides itself its trigger file.
|
||||
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', false) instead getEntity('xxx') or getEntity('xxx', 0)
|
||||
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
|
||||
|
||||
***** ChangeLog for 5.0.3 compared to 5.0.2 *****
|
||||
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
||||
|
||||
@ -93,7 +93,7 @@ if (! empty($id)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON l.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -187,7 +187,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -228,7 +228,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_factu
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
@ -284,7 +284,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_factu
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
@ -341,7 +341,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
@ -387,7 +387,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
|
||||
@ -164,7 +164,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_factu
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
@ -201,7 +201,7 @@ if (strlen(trim($search_country))) {
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tva_intra);
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
|
||||
@ -220,7 +220,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ if (! empty($id)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON erd.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " WHERE er.fk_statut > 0 AND erd.rowid = " . $id;
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog("/accounting/expensereport/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -206,7 +206,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid =
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
@ -259,7 +259,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid =
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
@ -313,7 +313,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -173,7 +173,7 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (erd.tva_tx like '" . $search_vat . "%')";
|
||||
}
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
|
||||
@ -203,7 +203,7 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
||||
}
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ $sql .= " JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_ex
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "user as u ON u.rowid = er.fk_user_author";
|
||||
$sql .= " WHERE er.fk_statut > 0 ";
|
||||
$sql .= " AND erd.fk_code_ventilation > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND er.date_debut >= '" . $db->idate($date_start) . "' AND er.date_debut <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " ORDER BY er.date_debut";
|
||||
|
||||
@ -96,7 +96,7 @@ $sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_factu
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " WHERE f.fk_statut > 0 ";
|
||||
$sql .= " AND fd.fk_code_ventilation > 0 ";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$sql .= " AND f.type IN (0,1,2)";
|
||||
else
|
||||
|
||||
@ -96,7 +96,7 @@ if (! empty($id)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON l.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog("/accounting/supplier/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -204,7 +204,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
@ -258,7 +258,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
@ -312,7 +312,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -182,7 +182,7 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
|
||||
@ -217,7 +217,7 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', false) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
|
||||
@ -223,7 +223,7 @@ class Deplacement extends CommonObject
|
||||
{
|
||||
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
|
||||
$sql.= " WHERE entity IN (".getEntity('deplacement', false).")";
|
||||
$sql.= " WHERE entity IN (".getEntity('deplacement', 0).")";
|
||||
if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'";
|
||||
else $sql.= " AND rowid = ".$id;
|
||||
|
||||
|
||||
@ -3965,7 +3965,7 @@ class Facture extends CommonInvoice
|
||||
function newCycle()
|
||||
{
|
||||
$sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f';
|
||||
$sql.= " WHERE f.entity in (".getEntity('facture', false).")";
|
||||
$sql.= " WHERE f.entity in (".getEntity('facture', 0).")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($resql->num_rows > 0)
|
||||
|
||||
@ -504,7 +504,7 @@ class Contrat extends CommonObject
|
||||
if ($ref)
|
||||
{
|
||||
$sql.= " WHERE ref='".$this->db->escape($ref)."'";
|
||||
$sql.= " AND entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " AND entity IN (".getEntity('contract', 0).")";
|
||||
}
|
||||
else $sql.= " WHERE rowid=".$id;
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ $sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= '".$db->idate($now)."')))";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
if ($user->societe_id) $sql.=' AND c.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 cd.statut";
|
||||
@ -144,7 +144,7 @@ $sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND (cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now)."')";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
if ($user->societe_id) $sql.=' AND c.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 cd.statut";
|
||||
@ -230,7 +230,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = c.fk_soc";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql.= " AND c.statut = 0";
|
||||
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;
|
||||
@ -302,7 +302,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " ".MAIN_DB_PREFIX.
|
||||
$sql.= " ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql.= " AND c.statut > 0";
|
||||
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;
|
||||
@ -372,7 +372,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= ") LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql.= " AND cd.fk_contrat = c.rowid";
|
||||
$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;
|
||||
@ -450,7 +450,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql.= " AND c.statut = 1";
|
||||
$sql.= " AND cd.statut = 0";
|
||||
$sql.= " AND cd.fk_contrat = c.rowid";
|
||||
@ -529,7 +529,7 @@ $sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " ) LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('contract', false).")";
|
||||
$sql.= " WHERE c.entity IN (".getEntity('contract', 0).")";
|
||||
$sql.= " AND c.statut = 1";
|
||||
$sql.= " AND cd.statut = 4";
|
||||
$sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
|
||||
|
||||
@ -4361,7 +4361,7 @@ class Form
|
||||
$TCurrency = array();
|
||||
|
||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'multicurrency';
|
||||
$sql.= " WHERE entity IN ('".getEntity('mutlicurrency', false)."')";
|
||||
$sql.= " WHERE entity IN ('".getEntity('mutlicurrency', 0)."')";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -843,7 +843,7 @@ class FormMail extends Form
|
||||
$sql = "SELECT label, topic, content, content_lines, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', false).")";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
@ -910,7 +910,7 @@ class FormMail extends Form
|
||||
$sql = "SELECT label, topic, content, lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', false).")";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
$sql.= $this->db->order("lang,label","ASC");
|
||||
@ -947,7 +947,7 @@ class FormMail extends Form
|
||||
$sql = "SELECT rowid, label, topic, content, content_lines, lang, position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
|
||||
$sql.= " WHERE type_template='".$this->db->escape($type_template)."'";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', false).")";
|
||||
$sql.= " AND entity IN (".getEntity('c_email_templates', 0).")";
|
||||
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
|
||||
if ($active >= 0) $sql.=" AND active = ".$active;
|
||||
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
|
||||
|
||||
@ -1681,7 +1681,7 @@ class Project extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.fk_statut = 1";
|
||||
$sql.= " AND p.entity IN (".getEntity('project', false).')';
|
||||
$sql.= " AND p.entity IN (".getEntity('project', 0).')';
|
||||
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
|
||||
@ -1704,7 +1704,7 @@ class Task extends CommonObject
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project', false).')';
|
||||
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
|
||||
$sql.= " AND p.fk_statut = 1";
|
||||
$sql.= " AND t.fk_projet = p.rowid";
|
||||
$sql.= " AND t.progress < 100"; // tasks to do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user