diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 83ddd1bd888..ba935a51a1e 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -17,7 +17,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * */ /** @@ -33,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")); @@ -173,7 +173,8 @@ $sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,"; $sql.= " fd.situation_percent,"; -$sql.= " co.label as country, s.tva_intra"; +$sql.= " co.code as country_code, co.label as country,"; +$sql.= " s.tva_intra"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -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.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); @@ -307,7 +319,10 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + //print ''; + print ''; print ''; print ''; print ''; @@ -370,9 +385,10 @@ if ($result) { print ''; print '' . price($objp->total_ht) . ''; + print '' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . ''; - print '' . $objp->country .''; + print '' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')'; print '' . $objp->tva_intra . ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index b5fec4a0e7c..53674d4cbcb 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -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")); @@ -212,7 +213,8 @@ $sql = "SELECT f.rowid as facid, f.facnumber as ref, f.datef, f.type as ftype,"; $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; $sql.= " aa.rowid as aarowid,"; -$sql.= " co.label as country, s.tva_intra"; +$sql.= " co.code as country_code, co.label as country,"; +$sql.= " s.tva_intra"; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; @@ -265,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.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); @@ -371,7 +384,10 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; + print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth200', 'code2', 1, 0, 1); + //print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index ae368a20de1..b328cf73455 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -236,8 +236,6 @@ if ($result) { if ($search_day) $param .= '&search_day='.urlencode($search_day); if ($search_month) $param .= '&search_month='.urlencode($search_month); if ($search_year) $param .= '&search_year='.urlencode($search_year); - if ($search_country) $param .= "&search_country=" . urlencode($search_country); - if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra); print '
' . "\n"; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 326d249f86d..b2df1231a4e 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -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")); @@ -172,7 +173,9 @@ print ''; echo $dialog; - if ($parameters['currentcontext'] == 'thirdpartycard' && $object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8) { + if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { echo ''; } elseif ($parameters['currentcontext'] == 'membercard') { echo ''; } elseif ($parameters['currentcontext'] == 'contactcard') { echo ''; } - if (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'thirdpartycard' && $object->forme_juridique_code == 11 || $object->forme_juridique_code == 12 || $object->forme_juridique_code == 13 || $object->forme_juridique_code == 15 || $object->forme_juridique_code == 17 || $object->forme_juridique_code == 18 || $object->forme_juridique_code == 19 || $object->forme_juridique_code == 35 || $object->forme_juridique_code == 60 || $object->forme_juridique_code == 200 || $object->forme_juridique_code == 311 || $object->forme_juridique_code == 312 || $object->forme_juridique_code == 316 || $object->forme_juridique_code == 401 || $object->forme_juridique_code == 600 || $object->forme_juridique_code == 700 || $object->forme_juridique_code == 1005 || $object->typent_id == 8) { + if (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { echo ''; } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'membercard') { echo ''; @@ -435,7 +437,7 @@ class ActionsDatapolicies $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); // On vérifie si il est utilisé - if (($societe->forme_juridique_code == 11 || $societe->forme_juridique_code == 12 || $societe->forme_juridique_code == 13 || $societe->forme_juridique_code == 15 || $societe->forme_juridique_code == 17 || $societe->forme_juridique_code == 18 || $societe->forme_juridique_code == 19 || $societe->forme_juridique_code == 35 || $societe->forme_juridique_code == 60 || $societe->forme_juridique_code == 200 || $societe->forme_juridique_code == 311 || $societe->forme_juridique_code == 312 || $societe->forme_juridique_code == 316 || $societe->forme_juridique_code == 401 || $societe->forme_juridique_code == 600 || $societe->forme_juridique_code == 700 || $societe->forme_juridique_code == 1005 || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { + if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; $form = new Form($this->db); @@ -448,7 +450,7 @@ class ActionsDatapolicies $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); - if ($societe->forme_juridique_code != 11 && $societe->forme_juridique_code != 12 && $societe->forme_juridique_code != 13 && $societe->forme_juridique_code != 15 && $societe->forme_juridique_code != 17 && $societe->forme_juridique_code != 18 && $societe->forme_juridique_code != 19 && $societe->forme_juridique_code != 35 && $societe->forme_juridique_code != 60 && $societe->forme_juridique_code != 200 && $societe->forme_juridique_code != 311 && $societe->forme_juridique_code != 312 && $societe->forme_juridique_code != 316 && $societe->forme_juridique_code != 401 && $societe->forme_juridique_code != 600 && $societe->forme_juridique_code != 700 && $societe->forme_juridique_code != 1005 && $societe->typent_id != 8) { + if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; $jsscript .= '