48 lines
912 B
PHP
48 lines
912 B
PHP
<?php
|
|
if (empty($_GET['token']) || $_GET['token'] !== ERP_SCRIPT_TOKEN) {
|
|
die;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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';
|
|
|
|
|
|
$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";
|