Remove call of $mc->dao than hangs. Replaced with $mc use.

This commit is contained in:
Laurent Destailleur 2020-02-19 15:51:27 +01:00
parent 91899d2f56
commit 3fafbb372b
2 changed files with 21 additions and 7 deletions

View File

@ -77,7 +77,13 @@ if ($user->socid > 0) {
accessforbidden();
}
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity));
if (empty($entity) && ! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
$tmparray = $mc->getEntitiesList();
$entity = '0,'.join(',', array_keys($tmparray));
}
if (empty($entity)) $entity = $conf->entity;
/*
@ -400,13 +406,18 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0);
print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n</a>";
// Export is for current company only !
// Export is for current company only
if (!empty($conf->multicompany->enabled) && is_object($mc))
{
$mc->getInfo($conf->entity);
print '<span class="marginleftonly marginrightonly">('.$langs->trans("Entity").' : ';
$mc->dao->getEntities();
$mc->dao->fetch($conf->entity);
print $mc->dao->label;
print "<td>";
if (! empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
} else {
print $mc->label;
}
print "</td>";
print ")</span>\n";
}

View File

@ -286,11 +286,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
else print $langs->trans("NotDefined");
print "</td>";
print "<td>".$ref."</td>";
if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED ){
if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) {
if($obj->family == 'invoice'){
$mc->getInfo($obj->entity);
print "<td>".$mc->label."</td>";
}else print "<td></td>";
}
else {
print "<td></td>";
}
}
print "<td>".$refcomp."</td>";
if ($obj->total_ttc < 0) { print '<td class="nowrap right">'.price(abs($total_ttc))."</td><td>&nbsp;</td>"; };