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

This commit is contained in:
Laurent Destailleur 2021-06-04 11:05:08 +02:00
commit 131d666d1d
2 changed files with 12 additions and 1 deletions

View File

@ -355,7 +355,9 @@ class MouvementStock extends CommonObject
$qtyisnotenough = 0;
foreach ($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch)
{
if ($batch != $batchcursor) continue;
if ((string) $batch != (string) $batchcursor) { // Lot '59' must be different than lot '59c'
continue;
}
$foundforbatch = 1;
if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty;
break;

View File

@ -429,6 +429,10 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id";
// We'll need this table joined to the select in order to filter by sale
if ($search_sale == -2) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
elseif ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($search_sale && $search_sale != -2) $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
@ -490,6 +494,11 @@ if (empty($reshook)) {
}
$sql .= $hookmanager->resPrint;
// Add GroupBy from hooks
$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall);
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records