* * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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 the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Source$ * */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); require_once("../includes/configure.php"); require_once("../clients/osc_customer.class.php"); llxHeader(); if ($action == '' && !$cancel) { if ($_GET["orderid"]) { $osc_order = new Osc_order($db, $_GET["orderid"]); $result = $osc_order->fetch($_GET["orderid"]); if ( !$result) { print '
Fiche commande OSC : '.$osc_order->osc_orderid.'

'; print ''; print ''; print ''; print ''; print ''; print ''; print "
client OSC'.$osc_order->osc_custid.'
Nom client'.$osc_order->osc_custname.'
Montant'.$osc_order->osc_ordertotal.'
Date commande'.$osc_order->osc_orderdate.'
Méthode de paiement'.$osc_order->osc_orderpaymet.'
"; /* ************************************************************************** */ /* */ /* Barre d'action */ /* */ /* ************************************************************************** */ print "\n
\n"; if ( $user->rights->commande->creer) { print ''.$langs->trans("Import").''; } print ''.$langs->trans("Retour").''; print "\n

\n"; // seule action importer } else { print "\n
\n"; print "

ERROR 1c

\n"; dolibarr_print_error('',"erreur webservice ".$osc_order->error); print ''.$langs->trans("Retour").''; print "\n

\n"; } } else { print "\n
\n"; print "

ERROR 1b

\n"; print ''.$langs->trans("Retour").''; print "\n

\n"; } } /* action Import création de l'objet commande de dolibarr * */ if (($_GET["action"] == 'import' ) && ( $_GET["orderid"] != '' ) && $user->rights->commande->creer) { $osc_order = new osc_order($db); $result = $osc_order->fetch($_GET["orderid"]); if ( !$result ) { $commande = $osc_order->osc2dolibarr($_GET["orderid"]); // print_r($commande); } /* utilisation de la table de transco*/ if ($osc_order->get_orderid($osc_order->osc_orderid)>0) { print '

Cette commande existe déjà

'; } else { $id = $commande->create($user); if ($id > 0) { print "\n
\n"; print '
création réussie nouvelle commande '.$id; $res = $osc_order->transcode($osc_order->osc_orderid,$id); print '

transcode '.$res.' | '.$id.' osc : '.$osc_order->osc_orderid.'

'; print ''.$langs->trans("Retour").''; print "\n

\n"; if ($id > 0) exit; } else { if ($id == -3) { $_error = 1; $_GET["action"] = "create"; $_GET["type"] = $_POST["type"]; } if ($id == -2) { /* la référence existe on fait un update */ $societe_control = new Societe($db); if ($_error == 1) { print '
erreur 1
'; exit; } $id = $societe_control->fetch($ref = $osc_order->osc_ref); if ($id > 0) { $id = $societe->update($id, $user); if ($id < 0) print '
Erreur update '.$id.'
'; } else print '
update impossible $id : '.$id.'
'; } } } } llxFooter('$Date$ - $Revision$'); ?>