WampServer

Apache, PHP, MySQL on Windows 

 
  • Accueil forum
  • Retour à WampServer
  • presentation
  • Download
  • Addons
  • Formations
  • Alter Way

 
Voir le sujet: Précédent•Suivant
Aller à : Liste des Forums•Liste des messages•Nouvelle discussion•Recherche•Connexion•Imprimer la vue
problème de compilation de script
Envoyé par: fouberge (195.24.215.---)
Date: 26 August 2008 à 14:01

bjr à tous ,
je dispose d'un script php5 qui permet de convertir un fichier csv en xml.
j'utilise Windoxs XP . mais j'arrive pas à exécuter le script.
j'obtient le message suivant: "use input file.csv outputfile .xml"

merci de m'aider

Options: Répondre•Citer ce Message
Re: problème de compilation de script
Envoyé par: Otomatic (---.fbx.proxad.net)
Date: 26 August 2008 à 17:19

Bonjour,

Quel est ce script ?

Quel est EXACTEMENT le message d'erreur ?

Options: Répondre•Citer ce Message
Re: problème de compilation de script
Envoyé par: fouberge (195.24.215.---)
Date: 27 August 2008 à 11:03

En fait j'essaie de convertir un plan comptable déjà en csv en xml . voici le script:
<?php
/*
Tool name: ons_csv2xml.php
Tool release: v1.0
Copyright notice: Copyright (C) 2008 Open Net SaRL
Software license: GNU General Public License v2.0

Notice:
This program is free software; you can redistribute it and/or
modify it under the terms of version 2.0 of the GNU General
Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of version 2.0 of the GNU General
Public License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.

END COPYRIGHT, LICENSE AND WARRANTY NOTICE

Purpose:
Reads a CSV file and outputs an XML file so that the generated file
can be used in a Tiny ERP plugin

Details: each input line:
- is splitted into an XML record
- may reference a parent record

*/

// ----------------------- Parameters from the command line
//
$argc = $_SERVER[ 'argc' ];
$argv = $_SERVER[ 'argv' ];
if ( $argc < 2 ) {
exit("Use: ".$argv[0]. " input_file.csv output_file.xml\n"winking smiley;
}
$input = $argv[1];
$output = $argv[2];

// ----------------------- Settings
//

// XML header and footer
$header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><terp>
\t<data noupdate=\"True\">
";
$footer = "\t</data>
</terp>";

/*
All fields but parent/code are listed here:
- each field but the one which references an optional parent represents an array
- each field holds:
- its name as first item
- two arrays as characters replacement, passed as is to str_replace( ... )
or false, false is no replacement is needed
*/
$fields = array(
array( "name", array( "&" ), array( "&amp;" ) ),
array( "code", array( "à", "é", "è", "ê", "ë", "ç", "-" ), array( "a", "e", "e", "e", "e", "c", "_" ) ),
array( "type", false, false ),
array( "note", false, false ),
array( "close_method", false, false ),
array( "sign", false, false )
);
$parent_node_field_name = "parent_id";

// The code field is also used to build the record ID
$code_field = 1;
$v = $fields[ $code_field ];
$a_code_search = $v[ 1 ];
$a_code_replace = $v[ 2 ];

$dest_terp_model = "account.account";

// CSV-format parameters
$field_separator = ';';
$text_delimiter = '"';

// ----------------------- Transfert loop
//
if ( !( $f_in = @fopen( $input, "r" ) ) ) die( "Can't open '$input' for read access\n" );
if ( !( $f_out = @fopen( $output, "w" ) ) ) {
fclose( $f_in );
die( "Can't open '$output' for write access\n" );
}

fwrite( $f_out, $header );

while( ( $l = fgetcsv( $f_in, 0, $field_separator, $text_delimiter ) ) ) {
$a_new_code = str_replace( $a_code_search, $a_code_replace, $l[ $code_field ] );
$a_parent_code = str_replace( $a_code_search, $a_code_replace, $l[ count( $fields ) ] );
fwrite( $f_out, "\t\t<record id=\"ch_".$a_new_code."\" model=\"" . $dest_terp_model . "\">\n" );
$min = count( $fields );
if ( count( $l ) < $min ) { $min = count( $l ); }
$i = 0;
while( $i < $min ) {
if ( trim( $l[ $i ] ) != "" ) {
$v = $fields[ $i ];
$field = $v[ 0 ];
$a_search = $v[ 1 ];
$a_replace = $v[ 2 ];
$value = ( $a_search && $a_replace ) ? str_replace( $a_search, $a_replace, $l[ $i ] ) : $l[ $i ];
fwrite( $f_out, "\t\t\t<field name=\"".$field."\">".$value."</field>\n" );
}
$i++;
}
if ( trim( $a_parent_code ) != "" && $parent_node_field_name && $parent_node_field_name != "" ) {
fwrite( $f_out, "\t\t\t<field eval=\"[(6,0,[ch_".$a_parent_code."])]\" name=\"" . $parent_node_field_name . "\" />\n" );
}
fwrite( $f_out, "\t\t</record>\n" );
}

fwrite( $f_out, $footer );
?>

Options: Répondre•Citer ce Message
Re: problème de compilation de script
Envoyé par: Otomatic (---.fbx.proxad.net)
Date: 27 August 2008 à 12:18

Bonjour,

C'est un script Open ERP à intégrer dans Tiny ERP.
Explications ici : [www.swiss-tinyerp.ch]

Votre problème n'a STRICTEMENT rien à voir avec Wampserver

Options: Répondre•Citer ce Message
Re: problème de compilation de script
Envoyé par: fouberge (195.24.215.---)
Date: 27 August 2008 à 15:48

j'eesaie de convertir mon fichier csv à l'aide de wampserver.
j'obtient le message suivant :
The cgi handler has not been set!
do you want to configure it now?

merci de votre sollicitude

Options: Répondre•Citer ce Message


Aller à : Liste des Forums•Liste des messages•Recherche•Connexion
Désolé, seuls les utilisateurs connectés peuvent envoyer des messages dans ce forum.
Cliquer ici pour se connecter

design by jidePowered by Alter Way get firefoxget PHP