29 lines
783 B
PHP
Executable file
29 lines
783 B
PHP
Executable file
<?php
|
|
define('NOTOKENRENEWAL', 1);
|
|
require '../../../main.inc.php';
|
|
require_once __DIR__.'/../lib/subtotaltitle.lib.php';
|
|
|
|
$facture_id = GETPOST('facture_id', 'int');
|
|
|
|
subtotaltitle_debug_log('🔄 get_line_order: facture=' . $facture_id);
|
|
|
|
if (!$facture_id) {
|
|
echo json_encode(array('success' => false));
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT fk_facturedet, line_order";
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_lines_manager";
|
|
$sql .= " WHERE fk_facture = ".(int)$facture_id;
|
|
$sql .= " AND line_type = 'product'";
|
|
$resql = $db->query($sql);
|
|
|
|
$lines = array();
|
|
while ($obj = $db->fetch_object($resql)) {
|
|
$lines[] = array(
|
|
'fk_facturedet' => $obj->fk_facturedet,
|
|
'line_order' => $obj->line_order
|
|
);
|
|
}
|
|
|
|
echo json_encode(array('success' => true, 'lines' => $lines));
|