Skip to content

Commit

Permalink
Fix compatibility with multicompany module
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 2, 2017
1 parent 8ccc57e commit da72bab
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions htdocs/expensereport/index.php
Expand Up @@ -70,12 +70,16 @@
$totalnb=$totalsum=0;
$sql = "SELECT tf.code, tf.label, count(de.rowid) as nb, sum(de.total_ht) as km";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."expensereport_det as de, ".MAIN_DB_PREFIX."c_type_fees as tf";
$sql.= " WHERE de.fk_expensereport = d.rowid AND de.fk_c_type_fees = tf.id";
$sql.= " WHERE de.fk_expensereport = d.rowid AND d.entity IN (".getEntity('expensereport', 1)." AND de.fk_c_type_fees = tf.id";
// RESTRICT RIGHTS
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous))
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
&& (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
{
$sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n";
$childids = $user->getAllChildIds();
$childids[]=$user->id;
$sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n";
}

$sql.= " GROUP BY tf.code, tf.label";

$result = $db->query($sql);
Expand Down

0 comments on commit da72bab

Please sign in to comment.