PEEL Shopping
Open source ecommerce : PEEL Shopping
rpc_price.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: rpc_price.php 46935 2015-09-18 08:49:48Z gboussin $
14 define('IN_PEEL_ADMIN', true);
15 define('IN_RPC', true);
16 define('LOAD_NO_OPTIONAL_MODULE', true);
17 define('SKIP_SET_LANG', true);
18 include("../configuration.inc.php");
19 
20 if (!empty($_GET['encoding'])) {
21  $page_encoding = $_GET['encoding'];
22 } else {
23  $page_encoding = 'utf-8';
24 }
25 $output = '';
26 
27 if (!est_identifie() || empty($_POST)) {
28  $output .= 'nok';
29 } else {
31  // On fait les tests de droits une bonne fois pour toutes
32  $new_price = $_POST['price'];
33  if(a_priv("admin_products")) {
34  $sql = "UPDATE peel_produits
35  SET prix='%s'".(!display_prices_with_taxes_in_admin()?'*(1+tva/100)':'')."
36  WHERE id='%s' AND " . get_filter_site_cond('produits', null, true) . "";
37  } else {
38  die('nok');
39  }
40  // On met à jour les positions en fonction de la liste reçue en POST
41  query(sprintf($sql, floatval(get_float_from_user_input($new_price)), intval($_POST['id'])));
42  $output .= 'ok';
43 }
44 echo String::convert_encoding($output, $page_encoding, GENERAL_ENCODING);
45 
static convert_encoding($string, $new_encoding, $original_encoding=null)
Converts the character encoding of string $string to $new_encoding from optionally $original_encoding...
Definition: String.php:375
output_general_http_header($page_encoding=null, $cache_duration_in_seconds=null)
Envoie les headers avant l'envoi du HTML.
Definition: fonctions.php:1528
if(!defined('IN_PEEL')) display_prices_with_taxes_in_admin()
display_prices_with_taxes_in_admin()
get_float_from_user_input($string, $from_currency_rate=1)
Transforme tout nombre formaté en un float au format PHP Exemples : 12 004,34 ou 12,324.50.
Definition: format.php:196
$new_price
Definition: rpc_price.php:32
get_filter_site_cond($table_technical_code, $table_alias=null, $use_strict_rights_if_in_admin=false, $specific_site_id=null, $exclude_public_items=false, $admin_force_multisite_if_allowed=false)
Retourne la condition SQL permettant de filtrer les données pour une table.
Definition: fonctions.php:4643
$output
Definition: rpc_price.php:25
query($query, $die_if_error=false, $database_object=null, $silent_if_error=false, $security_sql_filter=true)
The query() function is meant to be called anywhere you want to make a query.
Definition: database.php:158
if(!defined('IN_PEEL')) est_identifie()
Retourne true si l'utilisateur est identifié
Definition: user.php:23
if(!check_if_module_active('search')) $page_encoding
Definition: produit.php:23
a_priv($requested_priv, $demo_allowed=false, $site_configuration_modification=false, $user_id=null)
Renvoie true si l'utilisateur de la session a le privilège $requested_priv ou un droit supérieur Des ...
Definition: user.php:63

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:29:24 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.