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

Conflicts:
	htdocs/product/stock/movement_list.php
This commit is contained in:
Laurent Destailleur 2022-01-06 11:01:27 +01:00
commit 518b163066
2 changed files with 41 additions and 4 deletions

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -716,6 +717,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
while ($i < ($limit ? min($num, $limit) : $num)) {
$objp = $db->fetch_object($resql);
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) { // If multilang is enabled
// TODO Use a cache here
$sql = "SELECT label";
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
$sql .= " WHERE fk_product=".$objp->rowid;
$sql .= " AND lang='".$db->escape($langs->getDefaultLang())."'";
$sql .= " LIMIT 1";
$result = $db->query($sql);
if ($result)
{
$objtp = $db->fetch_object($result);
if (!empty($objtp->label)) $objp->produit = $objtp->label;
}
}
$userstatic->id = $objp->fk_user_author;
$userstatic->login = $objp->login;
$userstatic->lastname = $objp->lastname;
@ -749,7 +767,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Id movement
if (!empty($arrayfields['m.rowid']['checked'])) {
// This is primary not movement id
print '<td>'.$objp->mid.'</td>';
print '<td>'.dol_escape_htmltag($objp->mid).'</td>';
}
if (!empty($arrayfields['m.datem']['checked'])) {
// Date
@ -775,9 +793,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
if (!empty($arrayfields['m.batch']['checked'])) {
print '<td class="center nowraponall">';
if ($productlot->id > 0)
if ($productlot->id > 0) {
print $productlot->getNomUrl(1);
else print $productlot->batch; // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
} else {
print dol_escape_htmltag($productlot->batch); // the id may not be defined if movement was entered when lot was not saved or if lot was removed after movement.
}
print '</td>';
}
if (!empty($arrayfields['pl.eatby']['checked'])) {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -1014,6 +1014,23 @@ if ($resql)
$userstatic->firstname = $objp->firstname;
$userstatic->photo = $objp->photo;
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) { // If multilang is enabled
// TODO Use a cache
$sql = "SELECT label";
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
$sql .= " WHERE fk_product=".$objp->rowid;
$sql .= " AND lang='".$db->escape($langs->getDefaultLang())."'";
$sql .= " LIMIT 1";
$result = $db->query($sql);
if ($result)
{
$objtp = $db->fetch_object($result);
if (!empty($objtp->label)) $objp->produit = $objtp->label;
}
}
$productstatic->id = $objp->rowid;
$productstatic->ref = $objp->product_ref;
$productstatic->label = $objp->produit;