Skip to content

Commit

Permalink
Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 12, 2025
2 parents 39293b7 + ea60024 commit 7bc29c6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 22 deletions.
5 changes: 5 additions & 0 deletions htdocs/admin/dict.php
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,11 @@
$canbemodified = 1;
}

if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) {
$canbedisabled = 0;
$canbemodified = 0;
$iserasable = 0;
}
// Build Url. The table is id=, the id of line is rowid=
$rowidcol = empty($tabrowid[$id]) ? 'rowid' : $tabrowid[$id];
// If rowidcol not defined
Expand Down
6 changes: 6 additions & 0 deletions htdocs/comm/action/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,12 @@
if ($usergroup > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
}

// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;

$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
// Condition on actioncode
if (!empty($actioncode)) {
Expand Down
7 changes: 5 additions & 2 deletions htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,9 @@ public function update(User $user, $notrigger = 0)
if (isset($this->retained_warranty)) {
$this->retained_warranty = (float) $this->retained_warranty;
}
if (!isset($this->fk_user_author) && isset($this->user_author) ) {
$this->fk_user_author = $this->user_author;
}


// Check parameters
Expand Down Expand Up @@ -2519,8 +2522,8 @@ public function update(User $user, $notrigger = 0)
$sql .= " total_ht=".(isset($this->total_ht) ? $this->total_ht : "null").",";
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
$sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? $this->db->escape($this->revenuestamp) : "null").",";
$sql .= " fk_statut=".(isset($this->status) ? $this->db->escape($this->status) : "null").",";
$sql .= " fk_user_author=".(isset($this->user_author) ? $this->db->escape($this->user_author) : "null").",";
$sql .= " fk_statut=".(isset($this->status) ? ((int) $this->status) : "null").",";
$sql .= " fk_user_author=".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null").",";
$sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->db->escape($this->fk_user_valid) : "null").",";
$sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->db->escape($this->fk_facture_source) : "null").",";
$sql .= " fk_projet=".(isset($this->fk_project) ? $this->db->escape($this->fk_project) : "null").",";
Expand Down
17 changes: 8 additions & 9 deletions htdocs/expedition/dispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -773,15 +773,14 @@
print '</td>'; // Dispatch column
print '<td></td>'; // Warehouse column

/*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
$sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/

$sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " eb.batch, eb.eatby, eb.sellby, cd.fk_product";
$sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet";
$sql .= " JOIN ".MAIN_DB_PREFIX."commandedet as cd on ed.fk_origin_line = cd.rowid";
$sql = "SELECT ed.rowid";
$sql .= ", cd.fk_product";
$sql .= ", ".$db->ifsql('eb.rowid IS NULL', 'ed.qty', 'eb.qty')." as qty";
$sql .= ", ed.fk_entrepot";
$sql .= ", eb.batch, eb.eatby, eb.sellby";
$sql .= " FROM ".$db->prefix()."expeditiondet as ed";
$sql .= " LEFT JOIN ".$db->prefix()."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet";
$sql .= " INNER JOIN ".$db->prefix()."commandedet as cd on ed.fk_origin_line = cd.rowid";
$sql .= " WHERE ed.fk_origin_line =".(int) $objp->rowid;
$sql .= " AND ed.fk_expedition =".(int) $object->id;
$sql .= " ORDER BY ed.rowid, ed.fk_origin_line";
Expand Down
2 changes: 2 additions & 0 deletions htdocs/fourn/facture/card-rec.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@
unset($_POST['date_end_fill']);
unset($_POST['situations']);
unset($_POST['progress']);
unset($_POST['fourn_ref']);
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
Expand Down Expand Up @@ -862,6 +863,7 @@
unset($_POST['date_endyear']);
unset($_POST['situations']);
unset($_POST['progress']);
unset($_POST['fourn_ref']);
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
Expand Down
18 changes: 7 additions & 11 deletions htdocs/product/class/product.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5081,8 +5081,6 @@ public function getFather()
*/
public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array())
{
global $alreadyfound;

if (empty($id)) {
return array();
}
Expand All @@ -5099,9 +5097,6 @@ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = a

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

if ($level == 1) {
$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 immediatly
}
// Protection against infinite loop
if ($level > 30) {
return array();
Expand All @@ -5110,14 +5105,16 @@ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = a
$res = $this->db->query($sql);
if ($res) {
$prods = array();
if ($this->db->num_rows($res) > 0) {
$parents[] = $id;
}

while ($rec = $this->db->fetch_array($res)) {
if (!empty($alreadyfound[$rec['rowid']])) {
if (in_array($rec['id'], $parents)) {
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);
if (in_array($rec['id'], $parents)) {
continue; // We discard this child if it is already found at a higher level in tree in the same branch.
}
continue; // We discard this child if it is already found at a higher level in tree in the same branch.
}
$alreadyfound[$rec['rowid']] = 1;

$prods[$rec['rowid']] = array(
0=>$rec['rowid'],
1=>$rec['qty'],
Expand All @@ -5131,7 +5128,6 @@ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = a
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']);
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
if (empty($firstlevelonly)) {
$parents[] = $rec['rowid'];
$listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, $parents);
foreach ($listofchilds as $keyChild => $valueChild) {
$prods[$rec['rowid']]['childs'][$keyChild] = $valueChild;
Expand Down

0 comments on commit 7bc29c6

Please sign in to comment.