add typent filter on thirdparty (#29443)

This commit is contained in:
Charlène Benke 2024-04-24 21:11:37 +02:00 committed by GitHub
parent 75103c251b
commit ef2ad8b59b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.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
@ -68,6 +69,7 @@ if (!$sortfield) {
$selected_cat = GETPOST('search_categ', 'intcomma');
$selected_catsoc = GETPOST('search_categ_soc', 'intcomma');
$selected_soc = GETPOST('search_soc', 'intcomma');
$typent_id = GETPOST('typent_id', 'int');
$subcat = false;
if (GETPOST('subcat', 'alpha') === 'yes') {
$subcat = true;
@ -207,6 +209,9 @@ if (!empty($selected_soc)) {
if (!empty($selected_type)) {
$tableparams['search_type'] = $selected_type;
}
if (!empty($typent_id)) {
$tableparams['typent_id'] = $typent_id;
}
$tableparams['subcat'] = ($subcat === true) ? 'yes' : '';
// Adding common parameters
@ -301,7 +306,9 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= ",".MAIN_DB_PREFIX."facturedet as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
if ($typent_id >0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
}
$parameters = array();
$hookmanager->executeHooks('printFieldListFrom', $parameters);
$sql .= $hookmanager->resPrint;
@ -393,6 +400,11 @@ if ($modecompta == 'CREANCES-DETTES') {
if ($selected_soc > 0) {
$sql .= " AND f.fk_soc = ".((int) $selected_soc);
}
if ($typent_id >0) {
$sql .= " AND soc.fk_typent = ".((int) $typent_id);
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$parameters = array();
@ -461,6 +473,12 @@ if ($modecompta == 'CREANCES-DETTES') {
print '<br>';
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_catsoc, 'search_categ_soc', 0, $langs->trans("CustomersProspectsCategoriesShort"));
// type of thirdparty
print '&nbsp;&nbsp;';
print $langs->trans("Type").': ';
$formcompany = new FormCompany($db);
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1);
print '<br>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));