PEEL Shopping
Open source ecommerce : PEEL Shopping
export_livraisons.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: export_livraisons.php 46935 2015-09-18 08:49:48Z gboussin $
14 define('IN_PEEL_ADMIN', true);
15 include("../../../configuration.inc.php");
17 necessite_priv("admin_sales,admin_webmastering");
18 
19 if (!empty($_GET['encoding'])) {
20  $page_encoding = $_GET['encoding'];
21 } elseif (!empty($GLOBALS['site_parameters']['export_encoding'])) {
22  $page_encoding = $GLOBALS['site_parameters']['export_encoding'];
23 } else {
24  $page_encoding = 'utf-8';
25 }
26 $output = '';
27 $filename = "export_livraisons_" . str_replace('/', '-', date($GLOBALS['date_basic_format_short'])) . ".csv";
28 // On ne veut pas polluer le fichier exporté par un quelconque message d'erreur
29 @ini_set('display_errors', 0);
31 
32 if (empty($_GET["dateadded1"]) || empty($_GET["dateadded2"])) {
33  die();
34 }
35 if (!empty($_GET["id_statut_livraison"])) {
36  $extra_sql = "AND id_statut_livraison = '" . intval($_GET["id_statut_livraison"]) . "'";
37 } else {
38  $extra_sql = "";
39 }
40 $sqlC = "SELECT *
41  FROM peel_commandes
42  WHERE o_timestamp>='" . nohtml_real_escape_string($_GET["dateadded1"]) . "' AND o_timestamp<='" . nohtml_real_escape_string($_GET["dateadded2"]) . "' AND " . get_filter_site_cond('commandes', null, true) . " " . $extra_sql . "
43  ORDER BY o_timestamp";
44 
45 $output .= "Nom\tPrénom\tSociété\tAdresse\tCode postal\tVille\tEtages\tPays\tPoids\tArticle\tQuantité\tTransport\tCommande\tDate\r\n";
46 
48 $i = 0;
49 
50 while ($C = fetch_assoc($resC)) {
51  $i = 0;
52  $numero = $C['id'];
53  $date_vente = get_formatted_date($C['o_timestamp'], 'short', 'long');
54 
55  $resCA = query("SELECT *
56  FROM peel_commandes_articles
57  WHERE commande_id = '" . intval($C['id']) . "' AND " . get_filter_site_cond('commandes_articles', null, true) . "");
58  while ($CA = fetch_assoc($resCA)) {
59  if ($CA['quantite'] != 0) {
60  $output .= filtre_csv($C['nom_ship']) . "\t";
61  $output .= filtre_csv($C['prenom_ship']) . "\t";
62  $output .= filtre_csv($C['societe_ship']) . "\t";
63  $output .= filtre_csv($C['adresse_ship']) . "\t";
64  $output .= filtre_csv($C['zip_ship']) . "\t";
65  $output .= filtre_csv($C['ville_ship']) . "\t";
66  $output .= filtre_csv($C['commentaires']) . "\t";
67  $output .= filtre_csv($C['pays_ship']) . "\t";
68  $output .= filtre_csv($CA['quantite'] * $CA['poids']) . "\t";
69  $output .= filtre_csv($CA['reference'] . " - " . $CA['nom_produit']) . "\t";
70  $output .= filtre_csv($CA['quantite']) . "\t";
71  $output .= filtre_csv($C['transport']) . "\t" . filtre_csv($C['id']) . "\t";
72  $output .= filtre_csv($date_vente);
73  $output .= "\r\n";
74  $i++;
75  }
76  }
77 }
78 
79 echo String::convert_encoding($output, $page_encoding, GENERAL_ENCODING);
80 
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
nohtml_real_escape_string($value, $allowed_tags=null)
Protège les données pour insertion dans MySQL ET supprime les tags HTML pour protéger de toute sorte ...
Definition: database.php:400
necessite_priv($priv, $demo_allowed=true, $configuration_modification=false)
Cette fonction vérifie si l'utilisateur a les privilèges de $priv.
Definition: fonctions.php:1575
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
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(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
Definition: chart-data.php:160
necessite_identification()
Si l'utilisateur n'est pas connecté à un compte, on affiche une page d'identification et arrête le sc...
Definition: fonctions.php:1596
filtre_csv($string, $separator="\t")
Formatte une chaine de caractère pour insertion dans du CSV.
Definition: format.php:277
fetch_assoc($query_result)
fetch_assoc()
Definition: database.php:283
get_formatted_date($datetime_or_timestamp=null, $mode= 'short', $hour_minute=false)
Afficher une date formatée, en évitant les problèmes liés aux noms de mois sur les serveurs qui ne so...
Definition: format.php:440
$GLOBALS['page_columns_count']
if(!check_if_module_active('search')) $page_encoding
Definition: produit.php:23
output_csv_http_export_header($filename, $type= 'excel', $page_encoding)
Génère les entêtes HTTP pour un fichier CSV.
Definition: format.php:802

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