|
@@ -882,10 +882,11 @@ class BookingApi extends DolibarrApi
|
|
|
ApiBbusLog::appLog("{$this->db->error()}");
|
|
ApiBbusLog::appLog("{$this->db->error()}");
|
|
|
throw new RestException(401, "{$this->db->error()}");
|
|
throw new RestException(401, "{$this->db->error()}");
|
|
|
}
|
|
}
|
|
|
|
|
+ $addedsql = $fk_booking_history == null ? "" : " booking_history_id = {$fk_booking_history},";
|
|
|
if ($this->db->num_rows($data) > 0) {
|
|
if ($this->db->num_rows($data) > 0) {
|
|
|
while ($row = $this->db->fetch_object($data)) {
|
|
while ($row = $this->db->fetch_object($data)) {
|
|
|
$sql = "UPDATE llx_bbus_bbticket
|
|
$sql = "UPDATE llx_bbus_bbticket
|
|
|
- SET booking_history_id = {$fk_booking_history}, invoice_number = '{$invoice['ref']}'
|
|
|
|
|
|
|
+ SET {$addedsql} invoice_number = '{$invoice['ref']}'
|
|
|
WHERE rowid = {$row->rowid}";
|
|
WHERE rowid = {$row->rowid}";
|
|
|
ApiBbusLog::appLog("{$sql}");
|
|
ApiBbusLog::appLog("{$sql}");
|
|
|
$this->db->query($sql);
|
|
$this->db->query($sql);
|
|
@@ -1513,7 +1514,6 @@ class BookingApi extends DolibarrApi
|
|
|
*
|
|
*
|
|
|
* @param string $from
|
|
* @param string $from
|
|
|
* @param string $to
|
|
* @param string $to
|
|
|
- * @param string $factures
|
|
|
|
|
*
|
|
*
|
|
|
* @url POST getPrintedFacturesRefsArray
|
|
* @url POST getPrintedFacturesRefsArray
|
|
|
|
|
|
|
@@ -1523,19 +1523,21 @@ class BookingApi extends DolibarrApi
|
|
|
* @throws RestException 506 No available spaces
|
|
* @throws RestException 506 No available spaces
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
- public function getPrintedFacturesRefsArray(string $from, string $to, string $factures)
|
|
|
|
|
|
|
+ public function getPrintedFacturesRefsArray(string $from, string $to, string $factures = '')
|
|
|
{
|
|
{
|
|
|
$refs = [];
|
|
$refs = [];
|
|
|
- global $db, $conf;
|
|
|
|
|
- $curluser_id = $conf->global->CURL_USER_ID;
|
|
|
|
|
- $sql = "SELECT bbt.invoice_number
|
|
|
|
|
|
|
+ if ($factures !== '') {
|
|
|
|
|
+ global $db, $conf;
|
|
|
|
|
+ $curluser_id = $conf->global->CURL_USER_ID;
|
|
|
|
|
+ $sql = "SELECT bbt.invoice_number
|
|
|
FROM llx_bbus_bbticket as bbt
|
|
FROM llx_bbus_bbticket as bbt
|
|
|
INNER JOIN llx_bbus_bbticketinvoiceprinting as bbtip ON bbtip.ticket_id = bbt.rowid
|
|
INNER JOIN llx_bbus_bbticketinvoiceprinting as bbtip ON bbtip.ticket_id = bbt.rowid
|
|
|
WHERE bbt.fk_user_creat = {$curluser_id} AND bbt.invoice_number IN ({$factures}) AND bbt.date_creation BETWEEN '{$from}' AND '{$to}' ORDER BY bbt.rowid DESC";
|
|
WHERE bbt.fk_user_creat = {$curluser_id} AND bbt.invoice_number IN ({$factures}) AND bbt.date_creation BETWEEN '{$from}' AND '{$to}' ORDER BY bbt.rowid DESC";
|
|
|
- $result = $db->query($sql);
|
|
|
|
|
- if ($db->num_rows($result) > 0) {
|
|
|
|
|
- while ($row = $db->fetch_object($result)) {
|
|
|
|
|
- $refs[] = $row->invoice_number;
|
|
|
|
|
|
|
+ $result = $db->query($sql);
|
|
|
|
|
+ if ($db->num_rows($result) > 0) {
|
|
|
|
|
+ while ($row = $db->fetch_object($result)) {
|
|
|
|
|
+ $refs[] = $row->invoice_number;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return $refs;
|
|
return $refs;
|