diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 527cb13fcfd..87a7464dda6 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -156,17 +156,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) $ok=1; foreach ($listfield as $f => $value) { - if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancyCategory','Pcg_version'))) continue; // For some pages, country is not mandatory - if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory - if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; - if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; - if ($value == 'color' && empty($_POST['color'])) continue; - if ($value == 'formula' && empty($_POST['formula'])) continue; - if ((! isset($_POST[$value]) || $_POST[$value]=='') - && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory - && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 - ) - ) + if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory + if ((! isset($_POST[$value]) || $_POST[$value]=='')) { $ok=0; $fieldnamekey=$listfield[$f]; @@ -174,19 +165,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version'; if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; - if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; - if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays'; - if ($fieldnamekey == 'decalage') $fieldnamekey='Offset'; - if ($fieldnamekey == 'module') $fieldnamekey='Module'; - if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; - if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; - if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate'; - if ($fieldnamekey == 'type') $fieldnamekey = 'Type'; - if ($fieldnamekey == 'position') $fieldnamekey = 'Position'; - if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode'; - if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible'; - if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder'; - if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated'; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } @@ -196,9 +174,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) $ok=0; setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors'); } - if (isset($_POST["code"])) + if (isset($_POST["pcg_version"])) { - if ($_POST["code"]=='0') + if ($_POST["pcg_version"]=='0') { $ok=0; setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); @@ -211,28 +189,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) } if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2)) { - if (in_array($tablib[$id], array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries - { - $_POST["country"]=''; - } - else - { - $ok=0; - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); - } + $ok=0; + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); } - if (! is_numeric($_POST["code"])) - { - $ok=0; - setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); - } - - // Clean some parameters - if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0 - if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0 - if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null - if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null - if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd', 'alpha')) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 87e072b8d7e..c2b61fe378e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1058,7 +1058,7 @@ if ($id) $valuetoshow=$langs->trans($valuetoshow); // try to translate $class=''; - if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='width100'; } + if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='maxwidth100'; } if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } if ($fieldlist[$field]=='taux') { @@ -1076,7 +1076,7 @@ if ($id) if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); else $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='width100'; } + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='maxwidth100'; } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, '')); @@ -1602,7 +1602,7 @@ if ($id) $class='tddict'; if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200'; if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; - if ($fieldlist[$field] == 'code') $class.=' width100'; + if ($fieldlist[$field] == 'code') $class.=' maxwidth100'; if ($fieldlist[$field] == 'position') $class.=' right'; if ($fieldlist[$field] == 'localtax1_type') $class.=' nowrap'; if ($fieldlist[$field] == 'localtax2_type') $class.=' nowrap'; @@ -1981,7 +1981,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } $classtd=''; $class=''; - if ($fieldlist[$field]=='code') $classtd='width100'; + if ($fieldlist[$field]=='code') $classtd='maxwidth100'; if (in_array($fieldlist[$field], array('pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class='maxwidth50'; if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent'; print '