From d843b1fbe442a198103cb9a66bcae4bd4fb08e35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Jul 2015 13:03:12 +0200 Subject: [PATCH] Fix: No html form tag inside a table tag. Must be out of table. --- htdocs/product/admin/product.php | 155 +++++++++++++------------------ 1 file changed, 62 insertions(+), 93 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index c8105c8b61a..949d180a5ba 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -45,14 +45,14 @@ $value = GETPOST('value','alpha'); // Pricing Rules $select_pricing_rules=array( -'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price -'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level -'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer + 'PRODUCT_PRICE_UNIQ'=>$langs->trans('PriceCatalogue'), // Unique price + 'PRODUIT_MULTIPRICES'=>$langs->trans('MultiPricesAbility'), // Several prices according to a customer level + 'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer ); if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity'); // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice - $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity'); + $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("Experimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice + $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'] = $langs->trans('MultiPricesAbility') . '+' . $langs->trans('PriceByQuantity').' ('.$langs->trans("Experimental").')'; } // Clean param @@ -63,6 +63,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_ /* * Actions */ + if ($action == 'setcodeproduct') { if (dolibarr_set_const($db, "PRODUCT_CODEPRODUCT_ADDON",$value,'chaine',0,'',$conf->entity) > 0) @@ -105,15 +106,15 @@ if ($action == 'setModuleOptions') } } -if ($action == 'nbprod') +if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') > 0) { - $res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", $value,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity); } -else if ($action == 'PRODUIT_MULTIPRICES_LIMIT') +if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0) { - $res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", $value,'chaine',0,'',$conf->entity); + $res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", GETPOST('value_PRODUIT_MULTIPRICES_LIMIT'),'chaine',0,'',$conf->entity); } -if ($action == 'pricingrule') +if ($action == 'other') { $princingrules = GETPOST('princingrule','alpha'); foreach ($select_pricing_rules as $rule=>$label) // Loop on each possible mode @@ -145,33 +146,34 @@ if ($action == 'pricingrule') } } -else if ($action == 'sousproduits') +if ($action == 'other') { - $sousproduits = GETPOST('activate_sousproduits','alpha'); - $res = dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $sousproduits,'chaine',0,'',$conf->entity); + $value = GETPOST('activate_sousproduits','alpha'); + $res = dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $value,'chaine',0,'',$conf->entity); } -else if ($action == 'viewProdDescInForm') +if ($action == 'other') { - $view = GETPOST('activate_viewProdDescInForm','alpha'); - $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $view,'chaine',0,'',$conf->entity); + $value = GETPOST('activate_viewProdDescInForm','alpha'); + $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $value,'chaine',0,'',$conf->entity); } -else if ($action == 'viewProdTextsInThirdpartyLanguage') +if ($action == 'other') { - $view = GETPOST('activate_viewProdTextsInThirdpartyLanguage','alpha'); - $res = dolibarr_set_const($db, "PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE", $view,'chaine',0,'',$conf->entity); + $value = GETPOST('activate_viewProdTextsInThirdpartyLanguage','alpha'); + $res = dolibarr_set_const($db, "PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE", $value,'chaine',0,'',$conf->entity); } -elseif ($action == 'mergePropalProductCard') { - $view = GETPOST('activate_mergePropalProductCard','alpha'); - $res = dolibarr_set_const($db, "PRODUIT_PDF_MERGE_PROPAL", $view,'chaine',0,'',$conf->entity); +if ($action == 'other') { + $value = GETPOST('activate_mergePropalProductCard','alpha'); + $res = dolibarr_set_const($db, "PRODUIT_PDF_MERGE_PROPAL", $value,'chaine',0,'',$conf->entity); } -else if ($action == 'usesearchtoselectproduct') +if ($action == 'other') { - $usesearch = GETPOST('activate_usesearchtoselectproduct','alpha'); - $res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $usesearch,'chaine',0,'',$conf->entity); + $value = GETPOST('activate_usesearchtoselectproduct','alpha'); + $res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $value,'chaine',0,'',$conf->entity); } -else if ($action == 'set') +if ($action == 'set') { $const = "PRODUCT_SPECIAL_".strtoupper(GETPOST('spe','alpha')); + $value = GETPOST('value'); if (GETPOST('value','alpha')) $res = dolibarr_set_const($db, $const, $value,'chaine',0,'',$conf->entity); else $res = dolibarr_del_const($db, $const,$conf->entity); } @@ -181,13 +183,13 @@ else if ($action == 'set') $res = dolibarr_set_const($db, "PRODUIT_USE_ECOTAXE", $ecotaxe,'chaine',0,'',$conf->entity); }*/ -else if ($action == 'useUnits') +if ($action == 'other') { - $useUnits = GETPOST('activate_units', 'alpha'); - $res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $useUnits, 'chaine', 0, '', $conf->entity); + $value = GETPOST('activate_units', 'alpha'); + $res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $value, 'chaine', 0, '', $conf->entity); } -if($action) +if ($action) { if (! $res > 0) $error++; @@ -319,6 +321,12 @@ print "
"; print_titre($langs->trans("ProductOtherConf")); + + +print '
'; +print ''; +print ''; + $var=true; print ''; print ''; @@ -326,15 +334,17 @@ print ''."\n"; print ''."\n"; print ''."\n"; + /* - * Formulaire parametres divers + * Other parameters */ +$rowspan = 4; +if (! empty($conf->global->PRODUIT_MULTIPRICES)) $rowspan++; +if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++; +if (! empty($conf->global->MAIN_MULTILANGS)) $rowspan++; $var=!$var; -print ''; -print ''; -print ''; print ''; print ''; print ''; print ''; -print ''; // multiprix nombre de prix a proposer if (! empty($conf->global->PRODUIT_MULTIPRICES)) { $var=!$var; - print ''; - print ''; - print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; - print ''; } // sousproduits activation/desactivation $var=!$var; -print ''; -print ''; -print ''; print ''; print ''; print ''; print ''; -print ''; -// utilisation formulaire Ajax sur choix produit +// Utilisation formulaire Ajax sur choix produit $var=!$var; -print ''; -print ''; -print ''; print ''; print ''; if (empty($conf->use_javascript_ajax)) @@ -397,95 +392,67 @@ if (empty($conf->use_javascript_ajax)) else { print ''; } print ''; -print ''; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { $var=!$var; - print ''; - print ''; - print ''; print ''; print ''; - print ''; - print ''; + print ''; print ''; - print ''; } // Visualiser description produit dans les formulaires activation/desactivation $var=!$var; -print ''; -print ''; -print ''; print ''; print ''; print ''; print ''; -print ''; // Activate propal merge produt card -/* disabled. PRODUIT_PDF_MERGE_PROPAL can be added manually. Still did not understand how this feature works. +/* Kept as hidden feature only. PRODUIT_PDF_MERGE_PROPAL can be added manually. Still did not understand how this feature works. $var=!$var; -print ''; -print ''; -print ''; print ''; print ''; print ''; print ''; -print '';*/ +*/ // Use units +/* Kept as hidden feature only. PRODUCT_USE_UNITS is hidden for the moment. Because it seems to be a duplicated feature with already existing field to store unit of product $var=!$var; -print ''; -print ''; -print ''; print ''; print ''; print ''; print ''; -print ''; +*/ // View product description in thirdparty language if (! empty($conf->global->MAIN_MULTILANGS)) { $var=!$var; - print ''; - print ''; - print ''; print ''; print ''; print ''; print ''; - print ''; } @@ -554,10 +521,12 @@ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) //TODO: Translate print "\n"; } - - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("PricingRule").''; @@ -342,50 +352,35 @@ $current_rule = 'PRODUCT_PRICE_UNIQ'; if (!empty($conf->global->PRODUIT_MULTIPRICES)) $current_rule='PRODUIT_MULTIPRICES'; if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) $current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY'; if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $current_rule='PRODUIT_CUSTOMER_PRICES'; -if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) && (!empty($conf->global->PRODUIT_MULTIPRICES)))$current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'; +if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) && (!empty($conf->global->PRODUIT_MULTIPRICES))) $current_rule='PRODUIT_CUSTOMER_PRICES_BY_QTY&PRODUIT_MULTIPRICES'; print $form->selectarray("princingrule",$select_pricing_rules,$current_rule); -print ''; +print ''; print ''; print '
'.$langs->trans("MultiPricesNumPrices").'
'.$langs->trans("AssociatedProductsAbility").''; print $form->selectyesno("activate_sousproduits",$conf->global->PRODUIT_SOUSPRODUITS,1); -print ''; -print ''; print '
'.$form->textwithpicto($langs->trans("UseSearchToSelectProduct"),$langs->trans('UseSearchToSelectProductTooltip'),1).''; - $arrval=array('0'=>$langs->trans("No"), - '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')', - '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', - '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', + $arrval=array( + '0'=>$langs->trans("No"), + '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')', + '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')', + '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')', ); print $form->selectarray("activate_usesearchtoselectproduct",$arrval,$conf->global->PRODUIT_USE_SEARCH_TO_SELECT); - print ''; - print ''; print '
'.$langs->trans("NumberOfProductShowInSelect").'
'.$langs->trans("ViewProductDescInFormAbility").''; print $form->selectyesno("activate_viewProdDescInForm",$conf->global->PRODUIT_DESC_IN_FORM,1); -print ''; -print ''; print '
'.$langs->trans("MergePropalProductCard").''; print $form->selectyesno("activate_mergePropalProductCard",$conf->global->PRODUIT_PDF_MERGE_PROPAL,1); -print ''; -print ''; print '
'.$langs->trans("UseUnits").''; print $form->selectyesno("activate_units",$conf->global->PRODUCT_USE_UNITS,1); -print ''; -print ''; print '
'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").''; print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)?$conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE:0), 1); - print ''; - print ''; print '
ERROR: $dir is not a directory !
'; } +print ''; + +print ''; + llxFooter(); $db->close();