diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index a31c09375b0..4c5e0689a30 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -266,7 +266,7 @@ $tabsql[DICT_ACTIONCOMM] = "SELECT a.id as rowid, a.code as code, a.libelle A $tabsql[DICT_CHARGESOCIALES] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1"; $tabsql[DICT_TYPENT] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[DICT_CURRENCIES] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; -$tabsql[DICT_TVA] = "SELECT t.rowid, t.entity, t.type_vat, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid AND t.entity IN (".getEntity($tabname[DICT_TVA]).")"; +$tabsql[DICT_TVA] = "SELECT t.rowid, t.entity, t.code, t.type_vat, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid AND t.entity IN (".getEntity($tabname[DICT_TVA]).")"; $tabsql[DICT_TYPE_CONTACT] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[DICT_PAYMENT_TERM] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity IN (".getEntity($tabname[DICT_PAYMENT_TERM]).")"; $tabsql[DICT_PAIEMENT] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity IN (".getEntity($tabname[DICT_PAIEMENT]).")"; @@ -360,7 +360,7 @@ $tabfield[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfield[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; $tabfield[DICT_TYPENT] = "code,libelle,country_id,country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : ''); $tabfield[DICT_CURRENCIES] = "code,label,unicode"; -$tabfield[DICT_TVA] = "country_id,country,type_vat,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; +$tabfield[DICT_TVA] = "country_id,country,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[DICT_TYPE_CONTACT] = "element,source,code,libelle,position"; $tabfield[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder"; $tabfield[DICT_PAIEMENT] = "code,libelle,type"; @@ -407,7 +407,7 @@ $tabfieldvalue[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldvalue[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code"; $tabfieldvalue[DICT_TYPENT] = "code,libelle,country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : ''); $tabfieldvalue[DICT_CURRENCIES] = "code,label,unicode"; -$tabfieldvalue[DICT_TVA] = "country,type_vat,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; +$tabfieldvalue[DICT_TVA] = "country,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldvalue[DICT_TYPE_CONTACT] = "element,source,code,libelle,position"; $tabfieldvalue[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder"; $tabfieldvalue[DICT_PAIEMENT] = "code,libelle,type"; @@ -454,7 +454,7 @@ $tabfieldinsert[DICT_ACTIONCOMM] = "code,libelle,type,color,position"; $tabfieldinsert[DICT_CHARGESOCIALES] = "code,libelle,fk_pays,accountancy_code"; $tabfieldinsert[DICT_TYPENT] = "code,libelle,fk_country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : ''); $tabfieldinsert[DICT_CURRENCIES] = "code_iso,label,unicode"; -$tabfieldinsert[DICT_TVA] = "fk_pays,type_vat,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note,entity"; +$tabfieldinsert[DICT_TVA] = "fk_pays,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note,entity"; $tabfieldinsert[DICT_TYPE_CONTACT] = "element,source,code,libelle,position"; $tabfieldinsert[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity"; $tabfieldinsert[DICT_PAIEMENT] = "code,libelle,type,entity"; @@ -729,7 +729,7 @@ if ($id == DICT_TYPE_CONTACT) { // Define type_vatList (used for dictionary "llx_c_tva") $type_vatList = array( - "0" => $langs->trans("All"), + "0" => $langs->trans("Sell").'+'.$langs->trans("Buy"), "1" => $langs->trans("Sell"), "2" => $langs->trans("Buy") ); @@ -1308,7 +1308,7 @@ if (GETPOSTINT('id') == DICT_SOCIALNETWORKS && $from == 'socialnetworksetup') { $linkback = ''; if ($id && empty($from)) { $title .= ' - '.$langs->trans($tablib[$id]); - $linkback = ''.$langs->trans("BackToDictionaryList").''; + $linkback = ''.img_picto($langs->trans("BackToDictionaryList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToDictionaryList").''; } $titlepicto = 'title_setup'; if ($id == DICT_TVA && GETPOST('from') == 'accountancy') { @@ -1518,7 +1518,7 @@ if ($id > 0) { } if ($value == 'localtax1') { $valuetoshow = $langs->trans("RateOfTaxN", '2'); - $class = "center"; + $class = "center minwidth75"; } if ($value == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; @@ -1527,7 +1527,7 @@ if ($id > 0) { } if ($value == 'localtax2') { $valuetoshow = $langs->trans("RateOfTaxN", '3'); - $class = "center"; + $class = "center minwidth75"; } if ($value == 'type_vat') { $valuetoshow = $langs->trans("VATType"); @@ -1865,6 +1865,11 @@ if ($id > 0) { print ''; print ''; $colspan++; + } elseif ($value == 'type_vat') { + print ''; + print $form->selectarray('search_'.$value, $type_vatList, (empty($obj->{$value}) ? '' : $obj->{$value}), 1); + print ''; + $colspan++; } else { print ''; print ''; @@ -1946,27 +1951,27 @@ if ($id > 0) { if ($value == 'type_vat') { $valuetoshow = $langs->trans("VATType"); - $cssprefix = "center "; + $cssprefix = "center minwidth75 "; $sortable = 0; } if ($value == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; - $cssprefix = "center "; + $cssprefix = "center minwidth75 "; $sortable = 0; } if ($value == 'localtax1') { $valuetoshow = $langs->trans("RateOfTaxN", '2'); - $cssprefix = "center "; + $cssprefix = "center minwidth75 "; $sortable = 0; } if ($value == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; - $cssprefix = "center "; + $cssprefix = "center minwidth75 "; $sortable = 0; } if ($value == 'localtax2') { $valuetoshow = $langs->trans("RateOfTaxN", '3'); - $cssprefix = "center "; + $cssprefix = "center minwidth75 "; $sortable = 0; } if ($value == 'organization') { @@ -2429,11 +2434,7 @@ if ($id > 0) { } elseif ($value == 'localtax1' || $value == 'localtax2') { $class = "center"; } elseif ($value == 'type_vat') { - if ($obj->type_vat != 0) { - $valuetoshow = $type_vatList[$valuetoshow]; - } else { - $valuetoshow = $langs->transnoentitiesnoconv("All"); - } + $valuetoshow = $type_vatList[(int) $valuetoshow]; $class = "center"; } elseif ($value == 'localtax1_type') { if ($obj->localtax1 != 0) { @@ -2808,7 +2809,7 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '') } } if (!$transfound) { - print ''; + print ''; } else { print ''; } @@ -2819,10 +2820,10 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '') print ''; if ($tabname == 'c_paiement' && in_array($obj->{$value}, array('LIQ', 'CB', 'CHQ', 'VIR'))) { // Case of code that should not be modified - print ''; + print ''; print $obj->{$value}; } else { - print ''; + print ''; } print ''; } elseif ($value == 'unit') { @@ -2833,27 +2834,27 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '') 'point' => $langs->trans('SizeUnitpoint'), 'inch' => $langs->trans('SizeUnitinch') ); - print $form->selectarray('unit', $units, (!empty($obj->{$value}) ? $obj->{$value} : ''), 0, 0, 0); + print $form->selectarray('unit', $units, (empty($obj->{$value}) ? '' : $obj->{$value}), 0, 0, 0); print ''; } elseif ($value == 'type_vat') { // VAT type 0: all, 1: sell, 2: purchase print ''; - print $form->selectarray($value, $type_vatList, (!empty($obj->{$value}) ? $obj->{$value} : '')); + print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ? '' : $obj->{$value}), 1); print ''; } elseif ($value == 'localtax1_type' || $value == 'localtax2_type') { // Le type de taxe locale print ''; - print $form->selectarray($value, $localtax_typeList, (!empty($obj->{$value}) ? $obj->{$value} : '')); + print $form->selectarray($value, $localtax_typeList, (empty($obj->{$value}) ? '' : $obj->{$value})); print ''; } elseif ($value == 'accountancy_code' || $value == 'accountancy_code_sell' || $value == 'accountancy_code_buy') { print ''; if (isModEnabled('accounting')) { $fieldname = $value; - $accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0); - print $formaccounting->select_account($accountancy_account, '.'. $value, 1, array(), 1, 1, 'maxwidth200 maxwidthonsmartphone'); + $accountancy_account = (empty($obj->$fieldname) ? 0 : $obj->$fieldname); + print $formaccounting->select_account($accountancy_account, '.'. $value, 1, array(), 1, 1, 'maxwidth125 maxwidthonsmartphone'); } else { $fieldname = $value; - print ''; + print ''; } print ''; } elseif ($value == 'fk_tva') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 856aa4dedf6..a63b8a86c1c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5011,7 +5011,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'ai', 'angle-double-down', 'angle-double-up', 'asset', - 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'birthday-cake', 'bom', 'bookcal', 'bookmark', 'briefcase-medical', 'bug', 'building', + 'back', 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'birthday-cake', 'bom', 'bookcal', 'bookmark', 'briefcase-medical', 'bug', 'building', 'card', 'calendarlist', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', 'cash-register', 'category', 'chart', 'check', 'clock', 'clone', 'close_title', 'code', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cross', 'cubes', 'check-circle', 'check-square', 'circle', 'stop-circle', 'currency', 'multicurrency', @@ -5059,7 +5059,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $srco $arrayconvpictotofa = array( 'account' => 'university', 'accounting_account' => 'clipboard-list', 'accountline' => 'receipt', 'accountancy' => 'search-dollar', 'action' => 'calendar-alt', 'add' => 'plus-circle', 'address' => 'address-book', 'ai' => 'magic', 'asset' => 'money-check-alt', 'autofill' => 'fill', - 'bank_account' => 'university', + 'back' => 'arrow-left', 'bank_account' => 'university', 'bill' => 'file-invoice-dollar', 'billa' => 'file-excel', 'billr' => 'file-invoice-dollar', 'billd' => 'file-medical', 'bookcal' => 'calendar-check', 'supplier_invoice' => 'file-invoice-dollar', 'supplier_invoicea' => 'file-excel', 'supplier_invoicer' => 'file-invoice-dollar', 'supplier_invoiced' => 'file-medical', diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 36b67257183..d699f403c40 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -150,7 +150,6 @@ ALTER TABLE llx_societe_perentity MODIFY COLUMN accountancy_code_customer varcha ALTER TABLE llx_societe_perentity MODIFY COLUMN accountancy_code_supplier varchar(32); - -- Copy categories from llx_category_bank into llx_categorie INSERT INTO llx_categorie (entity, fk_parent, label, type, description, color, position, visible, date_creation) diff --git a/htdocs/install/mysql/tables/llx_c_tva.sql b/htdocs/install/mysql/tables/llx_c_tva.sql index 97c1d5e3071..ac10520fc01 100644 --- a/htdocs/install/mysql/tables/llx_c_tva.sql +++ b/htdocs/install/mysql/tables/llx_c_tva.sql @@ -23,18 +23,17 @@ create table llx_c_tva rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, fk_pays integer NOT NULL, - type_vat smallint NOT NULL DEFAULT 0, -- 0: all, 1: sell, 2: purchase code varchar(10) DEFAULT '', -- a key to describe vat entry, for example FR20 + type_vat smallint NOT NULL DEFAULT 0, -- 0: all, 1: sell, 2: purchase taux double NOT NULL, localtax1 varchar(20) NOT NULL DEFAULT '0', localtax1_type varchar(10) NOT NULL DEFAULT '0', localtax2 varchar(20) NOT NULL DEFAULT '0', localtax2_type varchar(10) NOT NULL DEFAULT '0', use_default tinyint DEFAULT 0, -- set to 1 to be the default vat when no vat defined on product - recuperableonly integer NOT NULL DEFAULT 0, + recuperableonly integer NOT NULL DEFAULT 0, -- VAT NPR for France note varchar(128), active tinyint DEFAULT 1 NOT NULL, accountancy_code_sell varchar(32) DEFAULT NULL, accountancy_code_buy varchar(32) DEFAULT NULL )ENGINE=innodb; - diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2012ea56071..c19455e7109 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1138,7 +1138,7 @@ VATIsUsedDesc=By default when creating proposals, invoices, orders etc. the Sale VATIsNotUsedDesc=By default the proposed Sales tax is 0 which can be used for cases like associations, individuals or small companies. VATIsUsedExampleFR=In France, it means companies or organizations having a real fiscal system (Simplified real or normal real). A system in which VAT is declared. VATIsNotUsedExampleFR=In France, it means associations that are non Sales tax declared or companies, organizations or liberal professions that have chosen the micro enterprise fiscal system (Sales tax in franchise) and paid a franchise Sales tax without any Sales tax declaration. This choice will display the reference "Non applicable Sales tax - art-293B of CGI" on invoices. -VATType=Tax type +VATType=Tax usage ##### Local Taxes ##### TypeOfSaleTaxes=Type of sales tax LTRate=Rate