diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php
index fdcadcfe8eb..d8a6f389693 100644
--- a/htdocs/expedition/dispatch.php
+++ b/htdocs/expedition/dispatch.php
@@ -795,7 +795,7 @@ if ($object->id > 0 || !empty($object->ref)) {
print ''; // Dispatch column
print '
| '; // Warehouse column
- $sql = "SELECT ed.rowid";
+ $sql = "SELECT ed.rowid, ed.fk_parent";
$sql .= ", cd.fk_product";
$sql .= ", ".$db->ifsql('eb.rowid IS NULL', 'ed.qty', 'eb.qty')." as qty";
$sql .= ", ".$db->ifsql('eb.rowid IS NULL OR eb.fk_warehouse IS NULL', 'ed.fk_entrepot', 'eb.fk_warehouse')." as fk_warehouse";
diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php
index 76393d921e2..81948f9c8db 100644
--- a/htdocs/variants/combinations.php
+++ b/htdocs/variants/combinations.php
@@ -536,7 +536,7 @@ if (!empty($id) || !empty($ref)) {
if ($action == 'add') {
$prodattr_all = $prodattr->fetchAll();
- if (!$selected) {
+ if (!$selected && !empty($prodattr_all)) {
$selected = $prodattr_all[key($prodattr_all)]->id;
}