Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW add company type on filter #30267

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions htdocs/compta/stats/casoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright (C) 2015 Raphaël Doursenaud <[email protected]>
* Copyright (C) 2018 Frédéric France <[email protected]>
* Copyright (C) 2022 Alexandre Spangaro <[email protected]>
* Copyright (C) 2024 Charlene Benke <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -35,6 +36,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';

// Load translation files required by the page
Expand Down Expand Up @@ -94,6 +96,7 @@
$date_endyear = GETPOSTINT("date_endyear");
$date_endmonth = GETPOSTINT("date_endmonth");
$date_endday = GETPOSTINT("date_endday");
$typent_id = GETPOST('typent_id', 'int');
if (empty($year)) {
$year_current = dol_print_date(dol_now(), '%Y');
$month_current = dol_print_date(dol_now(), '%m');
Expand Down Expand Up @@ -191,6 +194,9 @@
$tableparams['search_town'] = $search_town;
$tableparams['search_country'] = $search_country;
$tableparams['subcat'] = ($subcat === true) ? 'yes' : '';
if (!empty($typent_id)) {
$tableparams['typent_id'] = $typent_id;
}

// Adding common parameters
$allparams = array_merge($commonparams, $headerparams, $tableparams);
Expand Down Expand Up @@ -345,6 +351,9 @@
if ($search_country > 0) {
$sql .= ' AND s.fk_pays = '.((int) $search_country);
}
if ($typent_id >0) {
$sql .= " AND s.fk_typent = ".((int) $typent_id);
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
Expand Down Expand Up @@ -449,7 +458,7 @@

// Category filter
print '<tr class="liste_titre">';
print '<td class="nowraponall">';
print '<td class="nowraponall" colspan=4>';
print img_picto('', 'category', 'class="paddingrightonly"');
print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
print ' ';
Expand All @@ -458,8 +467,18 @@
if ($subcat) {
print ' checked';
}
print'></td>';
print '<td colspan="7" class="right">';

print'>';
// type filter (produit/service)
print ' ';
print '&nbsp;&nbsp;';
print $langs->trans("Type").': ';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In look and feel of recent version, labels of filters must be included as the placeholder of the combobox (to move into the param$shwo_empty of selectarray

$formcompany = new FormCompany($db);
$sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of $conf->global-> is forbidden. Use getDolGlobal...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, i have made this ugrade for a customer on 14.0.5 ...

print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);

print '</td>';
print '<td colspan="3" class="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"), 'search.png', '', '', 1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print '</tr>';
Expand Down
Loading