Skip to content

Commit d67aa04

Browse files
committed
Merge remote-tracking branch 'dolibarr/20.0' into 20.0-mc
2 parents 2b2cb69 + 0ef79d4 commit d67aa04

File tree

6 files changed

+30
-19
lines changed

6 files changed

+30
-19
lines changed

htdocs/comm/action/list.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@
461461
if ($usergroup > 0) {
462462
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
463463
}
464+
465+
// Add table from hooks
466+
$parameters = array();
467+
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
468+
$sql .= $hookmanager->resPrint;
469+
464470
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
465471
// Condition on actioncode
466472
if (!empty($actioncode)) {

htdocs/compta/facture/class/facture.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,6 +2500,9 @@ public function update(User $user, $notrigger = 0)
25002500
if (isset($this->retained_warranty)) {
25012501
$this->retained_warranty = (float) $this->retained_warranty;
25022502
}
2503+
if (!isset($this->fk_user_author) && isset($this->user_author) ) {
2504+
$this->fk_user_author = $this->user_author;
2505+
}
25032506

25042507

25052508
// Check parameters
@@ -2528,6 +2531,7 @@ public function update(User $user, $notrigger = 0)
25282531
$sql .= " total_ttc=".(isset($this->total_ttc) ? (float) $this->total_ttc : "null").",";
25292532
$sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? (float) $this->revenuestamp : "null").",";
25302533
$sql .= " fk_statut=".(isset($this->status) ? (int) $this->status : "null").",";
2534+
$sql .= " fk_user_author=".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null").",";
25312535
$sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? (int) $this->fk_user_valid : "null").",";
25322536
$sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? (int) $this->fk_facture_source : "null").",";
25332537
$sql .= " fk_projet=".(isset($this->fk_project) ? (int) $this->fk_project : "null").",";

htdocs/core/class/commonobject.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ abstract class CommonObject
701701
public $user_creation;
702702

703703
/**
704-
* @var int User id author/creation
704+
* @var int|null User id author/creation
705705
*/
706706
public $user_creation_id;
707707

htdocs/expedition/dispatch.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -773,13 +773,16 @@
773773
print '</td>'; // Dispatch column
774774
print '<td></td>'; // Warehouse column
775775

776-
$sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot,";
777-
$sql .= " eb.batch, eb.eatby, eb.sellby, cd.fk_product";
778-
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
779-
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet";
780-
$sql .= " JOIN ".MAIN_DB_PREFIX."commandedet as cd on ed.fk_elementdet = cd.rowid";
781-
$sql .= " WHERE ed.fk_elementdet =".(int) $objp->rowid;
782-
$sql .= " AND ed.fk_expedition =".(int) $object->id;
776+
$sql = "SELECT ed.rowid";
777+
$sql .= ", cd.fk_product";
778+
$sql .= ", ".$db->ifsql('eb.rowid IS NULL', 'ed.qty', 'eb.qty')." as qty";
779+
$sql .= ", ed.fk_entrepot";
780+
$sql .= ", eb.batch, eb.eatby, eb.sellby";
781+
$sql .= " FROM ".$db->prefix()."expeditiondet as ed";
782+
$sql .= " LEFT JOIN ".$db->prefix()."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet";
783+
$sql .= " INNER JOIN ".$db->prefix()."commandedet as cd on ed.fk_origin_line = cd.rowid";
784+
$sql .= " WHERE ed.fk_origin_line = ".(int) $objp->rowid;
785+
$sql .= " AND ed.fk_expedition = ".(int) $object->id;
783786
$sql .= " ORDER BY ed.rowid, ed.fk_elementdet";
784787

785788
$resultsql = $db->query($sql);

htdocs/fourn/facture/card-rec.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@
722722
unset($_POST['date_end_fill']);
723723
unset($_POST['situations']);
724724
unset($_POST['progress']);
725+
unset($_POST['fourn_ref']);
725726
} else {
726727
setEventMessages($object->error, $object->errors, 'errors');
727728
}
@@ -864,6 +865,7 @@
864865
unset($_POST['date_endyear']);
865866
unset($_POST['situations']);
866867
unset($_POST['progress']);
868+
unset($_POST['fourn_ref']);
867869
} else {
868870
setEventMessages($object->error, $object->errors, 'errors');
869871
}

htdocs/product/class/product.class.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5198,8 +5198,6 @@ public function getFather()
51985198
*/
51995199
public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array())
52005200
{
5201-
global $alreadyfound;
5202-
52035201
if (empty($id)) {
52045202
return array();
52055203
}
@@ -5216,9 +5214,6 @@ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = a
52165214

52175215
dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
52185216

5219-
if ($level == 1) {
5220-
$alreadyfound = array($id => 1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediately
5221-
}
52225217
// Protection against infinite loop
52235218
if ($level > 30) {
52245219
return array();
@@ -5227,14 +5222,16 @@ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = a
52275222
$res = $this->db->query($sql);
52285223
if ($res) {
52295224
$prods = array();
5225+
if ($this->db->num_rows($res) > 0) {
5226+
$parents[] = $id;
5227+
}
5228+
52305229
while ($rec = $this->db->fetch_array($res)) {
5231-
if (!empty($alreadyfound[$rec['rowid']])) {
5230+
if (in_array($rec['id'], $parents)) {
52325231
dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING);
5233-
if (in_array($rec['id'], $parents)) {
5234-
continue; // We discard this child if it is already found at a higher level in tree in the same branch.
5235-
}
5232+
continue; // We discard this child if it is already found at a higher level in tree in the same branch.
52365233
}
5237-
$alreadyfound[$rec['rowid']] = 1;
5234+
52385235
$prods[$rec['rowid']] = array(
52395236
0 => $rec['rowid'],
52405237
1 => $rec['qty'],
@@ -5248,7 +5245,6 @@ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = a
52485245
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']);
52495246
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
52505247
if (empty($firstlevelonly)) {
5251-
$parents[] = $rec['rowid'];
52525248
$listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, $parents);
52535249
foreach ($listofchilds as $keyChild => $valueChild) {
52545250
$prods[$rec['rowid']]['childs'][$keyChild] = $valueChild;

0 commit comments

Comments
 (0)