function createInvoiceLines($order_lines)
{
    $count = 0;
    foreach ($order_lines as $order_line) {
        $line = new DolibarrInvoiceLine();
        $line->desc = $order_line->desc;
        $line->vat_rate = $order_line->vat_rate;
        $line->qty = $order_line->qty;
        $line->unitprice = $order_line->unitprice;
        $line->total_net = $order_line->total_net;
        $line->total_vat = $order_line->total_vat;
        $line->total = $order_line->total;
        $line->date_start = "";
        // dateTime
        $line->date_end = "";
        // dateTime
        $line->payment_mode_id = "";
        // unused
        $line->product_id = "";
        $line->product_ref = "";
        $line->product_label = "";
        $line->product_desc = "";
        $lines[$count] = $line;
        $count++;
    }
    return $lines;
}
if (Tools::isSubmit('id_order')) {
    $id_order = Tools::getValue('id_order');
    synchroOrder($id_order);
}
    echo "PrestashopToDolibarr module is not properly configured (probably server url, login or password). Glease go to module configuration page to fix it.";
    return;
}
if (version_compare(Configuration::get('dolibarr_version'), '3.7') == -1) {
    echo "<br />Your version of Dolibarr can't synchronize orders properly. Please consider updating Dolibarr to 3.7.0 or higher to have a full synchronisation.";
    return;
}
// action if reset synchronization
if (Tools::isSubmit('action')) {
    $action = Tools::getValue('action');
    if ($action == "reset") {
        Configuration::updateValue('orders_last_synchro', "1970-01-01 00:00:00");
    }
}
$last_synchro = Configuration::get('orders_last_synchro');
echo "Synchronisation of orders begins for modification since " . $last_synchro . "<br>";
$failed_number = 0;
$sql = "select * from " . _DB_PREFIX_ . "orders where date_upd > '" . $last_synchro . "'";
if ($results = Db::getInstance()->ExecuteS($sql)) {
    foreach ($results as $row) {
        $id_order = $row['id_order'];
        echo "Synchronize order : {$id_order}";
        $hasSucceded = synchroOrder($id_order);
        if (!$hasSucceded) {
            $failed_number++;
        }
    }
}
echo "Synchronisation of orders done : " . $failed_number . "error(s)<br>";
$time = new DateTime('NOW');
Configuration::updateValue('orders_last_synchro', $time->format("Y-m-d H:i:s"));