Fix combo box for thirdparties in invoice stats used bad component
This commit is contained in:
parent
51b6318f88
commit
128f6d9a5c
@ -42,7 +42,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('bills', 'companies', 'other'));
|
$langs->loadLangs(array('bills', 'companies', 'other'));
|
||||||
|
|
||||||
$mode = GETPOST("mode") ?GETPOST("mode") : 'customer';
|
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
|
||||||
if ($mode == 'customer' && !$user->rights->facture->lire) {
|
if ($mode == 'customer' && !$user->rights->facture->lire) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ if (!count($arrayyears)) {
|
|||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.$mode;
|
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/stats/index.php?mode='.urlencode($mode);
|
||||||
$head[$h][1] = $langs->trans("ByMonthYear");
|
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||||
$head[$h][2] = 'byyear';
|
$head[$h][2] = 'byyear';
|
||||||
$h++;
|
$h++;
|
||||||
@ -261,12 +261,12 @@ complete_head_from_modules($conf, $langs, null, $head, $h, $type);
|
|||||||
print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
print dol_get_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
||||||
|
|
||||||
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
|
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
|
||||||
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
|
$filter = '';
|
||||||
//Array passed as an argument to Form::selectarray to build a proper select input
|
if ($mode == 'customer') {
|
||||||
$companies = array();
|
$filter = 's.client in (1,2,3)';
|
||||||
|
}
|
||||||
foreach ($tmp_companies as $value) {
|
if ($mode == 'supplier') {
|
||||||
$companies[$value['key']] = $value['label'];
|
$filter = 's.fournisseur = 1';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||||
@ -281,14 +281,8 @@ print '<table class="noborder centpercent">';
|
|||||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||||
// Company
|
// Company
|
||||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||||
if ($mode == 'customer') {
|
|
||||||
$filter = 's.client in (1,2,3)';
|
|
||||||
}
|
|
||||||
if ($mode == 'supplier') {
|
|
||||||
$filter = 's.fournisseur = 1';
|
|
||||||
}
|
|
||||||
print img_picto('', 'company', 'class="pictofixedwidth"');
|
print img_picto('', 'company', 'class="pictofixedwidth"');
|
||||||
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1);
|
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// ThirdParty Type
|
// ThirdParty Type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user