roykin/erp/erp_get_invoice.php
Alexandre Simonet 933cd9ce00 fix token
2016-04-22 11:48:07 +02:00

43 lines
907 B
PHP

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Vendors
require_once 'ripcord/ripcord.php';
require '../config/config.inc.php';
require 'ErpTools.php';
require 'config.php';
if (empty($_GET['token']) || $_GET['token'] !== ERP_SCRIPT_TOKEN) {
die;
}
$id_invoice = Tools::getValue('id_invoice');
// TODO : Check que je regarde mon invoice
$models = ripcord::client("$url/xmlrpc/2/object");
$invoice_ids = $models->execute_kw(
$db, $uid, $password,
'account.invoice', 'search',
array(
array(
array('id', '=', 9),
)
)
);
$report = ripcord::client("$url/xmlrpc/2/report");
$result = $report->render_report($db, $uid, $password,
'account.report_invoice', $invoice_ids);
$report_data = base64_decode($result['result']);
$file = fopen('facture.pdf', 'w+');
fwrite($file, $report_data);
fclose($file);
echo "jai la facture";