34 lines
1 KiB
PHP
Executable file
34 lines
1 KiB
PHP
Executable file
<?php
|
|
define('NOTOKENRENEWAL', 1);
|
|
|
|
$res = 0;
|
|
if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
|
|
if (!$res && file_exists("../../../../main.inc.php")) $res = @include "../../../../main.inc.php";
|
|
if (!$res) die("Include of main fails");
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
$facture_id = GETPOST('facture_id', 'int');
|
|
|
|
if (!$facture_id) {
|
|
echo json_encode(array('success' => false, 'error' => 'Missing facture_id'));
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT rowid, title, line_order, parent_section FROM ".MAIN_DB_PREFIX."facture_lines_manager";
|
|
$sql .= " WHERE fk_facture = ".(int)$facture_id;
|
|
$sql .= " AND line_type = 'text'";
|
|
$sql .= " ORDER BY line_order";
|
|
$resql = $db->query($sql);
|
|
|
|
$textlines = array();
|
|
while ($obj = $db->fetch_object($resql)) {
|
|
$textlines[] = array(
|
|
'id' => $obj->rowid,
|
|
'title' => $obj->title,
|
|
'line_order' => $obj->line_order,
|
|
'parent_section' => $obj->parent_section
|
|
);
|
|
}
|
|
|
|
echo json_encode(array('success' => true, 'textlines' => $textlines));
|