NEW fetch_lines() first param only products or services
This commit is contained in:
parent
26b73201fc
commit
ebc48db9b8
1 changed files with 6 additions and 2 deletions
|
|
@ -23,6 +23,7 @@
|
|||
* Copyright (C) 2023 Nick Fragoulis
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 Lenin Rivas <lenin.rivas777@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -2447,12 +2448,12 @@ class Facture extends CommonInvoice
|
|||
/**
|
||||
* Load all detailed lines into this->lines
|
||||
*
|
||||
* @param int $only_product Return only physical products
|
||||
* @param int $only_type_product Return only for type products
|
||||
* @param int $loadalsotranslation Return translation for products
|
||||
*
|
||||
* @return int 1 if OK, < 0 if KO
|
||||
*/
|
||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||
public function fetch_lines($only_type_product = '', $loadalsotranslation = 0)
|
||||
{
|
||||
global $conf, $extrafields;
|
||||
|
||||
|
|
@ -2517,6 +2518,9 @@ class Facture extends CommonInvoice
|
|||
|
||||
$sql .= ' LEFT JOIN '.$this->db->prefix().'product as p ON l.fk_product = p.rowid';
|
||||
$sql .= ' WHERE l.fk_facture = '.((int) $this->id);
|
||||
if (is_int($only_type_product)) {
|
||||
$sql .= ' AND p.fk_product_type='.$only_type_product;
|
||||
}
|
||||
$sql .= ' ORDER BY l.rang, l.rowid';
|
||||
|
||||
dol_syslog(get_class($this).'::fetch_lines', LOG_DEBUG);
|
||||
|
|
|
|||
Loading…
Reference in a new issue