diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index d16b081e6ae..55006a8b171 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -37,6 +37,7 @@ $action=GETPOST('action','aZ09'); /* * Actions */ + if (preg_match('/set_(.*)/',$action,$reg)) { $code=$reg[1]; @@ -82,7 +83,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup') $head=categoriesadmin_prepare_head(); -dol_fiche_head($head, 'setup', $langs->trans("Categories"), 0, 'category'); +dol_fiche_head($head, 'setup', $langs->trans("Categories"), -1, 'category'); print ''; diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 2bc9f205334..6291d2065c2 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -68,7 +68,7 @@ print load_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'title_setup') $head = categoriesadmin_prepare_head(); -dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category'); +dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), -1, 'category'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index ae9cd743c8f..3c47b188972 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -247,12 +247,18 @@ ComposedProduct=Sub-product MinSupplierPrice=Minimum supplier price MinCustomerPrice=Minimum customer price DynamicPriceConfiguration=Dynamic price configuration -DynamicPriceDesc=On product card, with this module enabled, you should be able to set mathematic functions to calculate Customer or Supplier prices. Such function can use all mathematic operators, some constants and variables. You can set here the variables you want to be able and if the variable need an automatic update, the external URL to use to ask Dolibarr to update automaticaly the value. +DynamicPriceDesc=On product card, with this module enabled, you should be able to set mathematic functions to calculate Customer or Supplier prices. Such function can use all mathematic operators, some constants and variables. You can set here the variables you want to be able to use and if the variable need an automatic update, the external URL to use to ask Dolibarr to update automaticaly the value. AddVariable=Add Variable AddUpdater=Add Updater GlobalVariables=Global variables VariableToUpdate=Variable to update GlobalVariableUpdaters=Global variable updaters +GlobalVariableUpdaterType0=JSON data +GlobalVariableUpdaterHelp0=Parses JSON data from specified URL, VALUE specifies the location of relevant value, +GlobalVariableUpdaterHelpFormat0=Format for request {"URL": "http://example.com/urlofjson", "VALUE": "array1,array2,targetvalue"} +GlobalVariableUpdaterType1=WebService data +GlobalVariableUpdaterHelp1=Parses WebService data from specified URL, NS specifies the namespace, VALUE specifies the location of relevant value, DATA should contain the data to send and METHOD is the calling WS method +GlobalVariableUpdaterHelpFormat1=Format for request is {"URL": "http://example.com/urlofws", "VALUE": "array,targetvalue", "NS": "http://example.com/urlofns", "METHOD": "myWSMethod", "DATA": {"your": "data", "to": "send"}} UpdateInterval=Update interval (minutes) LastUpdated=Latest update CorrectlyUpdated=Correctly updated diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index 24f1d64e30c..b044471e3e1 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -54,9 +54,11 @@ if ($action == 'edit_updater') { } } + /* * Actions */ + if (!empty($action) && empty($cancel)) { //Global variable actions if ($action == 'create_variable' || $action == 'edit_variable') { diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 3c176f0530e..0948275ce2b 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -464,24 +464,18 @@ class PriceGlobalVariableUpdater } $result = ""; if ($this->type == 0) { - //CURL client - $handle = curl_init(); - curl_setopt_array($handle, array( - CURLOPT_URL => $url, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_TIMEOUT => 5, - CURLOPT_POST => false, - CURLOPT_HEADER => false, - )); + // Call JSON request + include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + $tmpresult=getURLContent($url); + $code=$tmpresult['http_code']; + $result=$tmpresult['content']; - $result = curl_exec($handle); - $code = curl_getinfo($handle, CURLINFO_HTTP_CODE); if (!isset($result)) { $this->error = $langs->trans("ErrorGlobalVariableUpdater0", "empty response"); return -1; } if ($code !== 200) { - $this->error = $langs->trans("ErrorGlobalVariableUpdater0", $code); + $this->error = $langs->trans("ErrorGlobalVariableUpdater0", $code.' '.$tmpresult['curl_error_msg']); return -1; }