Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into 22.0

This commit is contained in:
Laurent Destailleur
2025-11-05 23:32:07 +01:00
6 changed files with 19 additions and 7 deletions

View File

@@ -380,6 +380,9 @@ class Categorie extends CommonObject
$this->db = $db;
$this->ismultientitymanaged = 1;
$this->isextrafieldmanaged = 1;
if (is_object($hookmanager)) {
$hookmanager->initHooks(array('category'));
$parameters = array();

View File

@@ -89,7 +89,10 @@ foreach ($categstatic->MAP_ID as $key => $idtype) {
$arrayofcateg = dol_sort_array($arrayofcateg, 'labelwithoutaccent', 'asc', 1, 0, 1);
// Get number of tags per category type
$sql = "SELECT type as idtype, COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."categorie GROUP BY type";
$sql = "SELECT type as idtype, COUNT(rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie";
$sql .= " WHERE entity IN (".getEntity('category').")";
$sql .= " GROUP BY type";
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {

View File

@@ -276,13 +276,14 @@ class FactureStats extends Stats
global $user;
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
$sql .= " FROM ".$this->from;
$sql .= " INNER JOIN ".$this->from_line." ON f.rowid = tl.fk_facture";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
$sql .= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid";
$sql .= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
$sql .= " GROUP BY product.ref";
$sql .= $this->db->order('nb', 'DESC');

View File

@@ -3070,7 +3070,7 @@ class CommandeFournisseur extends CommonOrder
* @param int|float $pu Unit price
* @param int|float $qty Quantity
* @param int|float $remise_percent Percent discount on line
* @param int|float $txtva VAT rate
* @param int|float|string $txtva VAT Rate (Can be '1.23' or '1.23 (ABC)')
* @param int|float $txlocaltax1 Localtax1 tax
* @param int|float $txlocaltax2 Localtax2 tax
* @param string $price_base_type Type of price base

View File

@@ -811,7 +811,7 @@ if (empty($reshook)) {
$ht,
(float) price2num(GETPOST('qty'), 'MS'),
(float) price2num(GETPOST('remise_percent'), '', 2),
(float) $vat_rate,
$vat_rate,
$localtax1_rate,
$localtax2_rate,
$price_base_type,

View File

@@ -2740,10 +2740,11 @@ if ($action == 'create') {
// Label
print '<tr><td>'.$langs->trans('Label').'</td><td><input class="minwidth200" name="label" value="'.dol_escape_htmltag(GETPOST('label')).'" type="text"></td></tr>';
// Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td>';
print img_picto('', 'action', 'class="pictofixedwidth"');
print $form->selectDate((int) $dateinvoice, '', 0, 0, 0, "add", 1, 1);
print $form->selectDate($dateinvoice ? (int) $dateinvoice : '', '', 0, 0, 0, "add", 1, 1);
print '</td></tr>';
// Payment term
@@ -2909,7 +2910,11 @@ if ($action == 'create') {
// We check if Origin document (id and type is known) has already at least one invoice attached to it
$objectsrc->fetchObjectLinked($originid, $origin, null, 'invoice_supplier');
$invoice_supplier = $objectsrc->linkedObjects['invoice_supplier'];
if (isset($objectsrc->linkedObjects['invoice_supplier'])) {
$invoice_supplier = $objectsrc->linkedObjects['invoice_supplier'];
} else {
$invoice_supplier = [];
}
'@phan-var-force null|FactureFournisseur[] $invoice_supplier';
// count function need a array as argument (Note: the array must implement Countable too)