NEW Can filter on EEC, not EEC, etc... in binding step of accountancy
This commit is contained in:
parent
6ded9e843d
commit
1c74dcc270
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills","compta","accountancy","productbatch"));
|
||||
@ -229,7 +230,18 @@ else if ($search_year > 0)
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$sql .= natural_search("co.code", $search_country);
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
foreach ($arrayofcode as $key => $value)
|
||||
{
|
||||
$country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'";
|
||||
if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
|
||||
}
|
||||
if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code","co.label"), $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
@ -308,7 +320,7 @@ if ($result) {
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" placeholder="%" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2');
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
|
||||
|
||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills","compta","accountancy","other","productbatch"));
|
||||
@ -266,7 +267,18 @@ else if ($search_year > 0)
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$sql .= natural_search("co.code", $search_country);
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
foreach ($arrayofcode as $key => $value)
|
||||
{
|
||||
$country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'";
|
||||
if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
|
||||
}
|
||||
if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code","co.label"), $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
@ -373,7 +385,7 @@ if ($result) {
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2');
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
|
||||
|
||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","bills","other","accountancy","productbatch"));
|
||||
@ -223,7 +224,18 @@ else if ($search_year > 0)
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$sql .= natural_search("co.code", $search_country);
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
foreach ($arrayofcode as $key => $value)
|
||||
{
|
||||
$country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'";
|
||||
if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
|
||||
}
|
||||
if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code","co.label"), $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
@ -312,7 +324,7 @@ if ($result) {
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2');
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1);
|
||||
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
|
||||
|
||||
@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills","compta","accountancy","other","productbatch"));
|
||||
@ -265,7 +266,18 @@ else if ($search_year > 0)
|
||||
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$sql .= natural_search("co.label", $search_country);
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
foreach ($arrayofcode as $key => $value)
|
||||
{
|
||||
$country_code_in_EEC.=($country_code_in_EEC ? "," : "")."'".$value."'";
|
||||
if ($value != $mysoc->country_code) $country_code_in_EEC_without_me.=($country_code_in_EEC_without_me ? "," : "")."'".$value."'";
|
||||
}
|
||||
if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'";
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code","co.label"), $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
@ -374,7 +386,7 @@ if ($result) {
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2');
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
|
||||
|
||||
@ -665,13 +665,14 @@ class Form
|
||||
* @param string $morecss More css class
|
||||
* @param string $usecodeaskey ''=Use id as key (default), 'code3'=Use code on 3 alpha as key, 'code2"=Use code on 2 alpha as key
|
||||
* @param int $showempty Show empty choice
|
||||
* @param int $disablefavorites Disable favorites
|
||||
* @param int $disablefavorites 1=Disable favorites,
|
||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||
* @return string HTML string with select
|
||||
*/
|
||||
function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0)
|
||||
function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0, $addspecialentries=0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
@ -713,9 +714,25 @@ class Form
|
||||
if (empty($disablefavorites)) array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray);
|
||||
else $countryArray = dol_sort_array($countryArray, 'label');
|
||||
|
||||
if ($showempty)
|
||||
{
|
||||
$out.='<option value=""> </option>'."\n";
|
||||
}
|
||||
|
||||
if ($addspecialentries) // Add dedicated entries for groups of countries
|
||||
{
|
||||
//if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
|
||||
$out.= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
|
||||
$out.= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>';
|
||||
if ($mysoc->isInEEC()) $out.= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>';
|
||||
$out.= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>';
|
||||
$out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';
|
||||
}
|
||||
|
||||
foreach ($countryArray as $row)
|
||||
{
|
||||
if (empty($showempty) && empty($row['rowid'])) continue;
|
||||
//if (empty($showempty) && empty($row['rowid'])) continue;
|
||||
if (empty($row['rowid'])) continue;
|
||||
|
||||
if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) $atleastonefavorite++;
|
||||
if (empty($row['favorite']) && $atleastonefavorite)
|
||||
|
||||
@ -38,6 +38,10 @@ GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accountin
|
||||
DetailByAccount=Show detail by account
|
||||
AccountWithNonZeroValues=Accounts with non-zero values
|
||||
ListOfAccounts=List of accounts
|
||||
CountriesInEEC=Countries in EEC
|
||||
CountriesNotInEEC=Countries not in EEC
|
||||
CountriesInEECExceptMe=Countries in EEC except %s
|
||||
CountriesExceptMe=All countries except %s
|
||||
|
||||
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
|
||||
MainAccountForSuppliersNotDefined=Main accounting account for vendors not defined in setup
|
||||
|
||||
Loading…
Reference in New Issue
Block a user