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

This commit is contained in:
Laurent Destailleur (aka Eldy) 2025-01-30 13:02:03 +01:00
commit ea8de773b6
12 changed files with 90 additions and 38 deletions

View file

@ -449,20 +449,19 @@ $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
$sql .= " ,".MAIN_DB_PREFIX."c_actioncomm as c";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
// We must filter on resource table
if ($resourceid > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as r ON r.element_type = 'action' AND r.element_id = a.id";
}
// We must filter on assignment table
if ($filtert > 0 || $usergroup > 0) {
$sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type='user'";
}
if ($usergroup > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
}
$sql .= " WHERE c.id = a.fk_action";
$sql .= ' AND a.entity IN ('.getEntity('agenda').')';
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
// Condition on actioncode
if (!empty($actioncode)) {
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
@ -493,7 +492,7 @@ if (!empty($actioncode)) {
}
}
if ($resourceid > 0) {
$sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid);
$sql .= " AND r.resource_id = ".((int) $resourceid);
}
if ($pid) {
$sql .= " AND a.fk_project=".((int) $pid);
@ -512,13 +511,9 @@ if ($search_sale && $search_sale != '-1') {
}
}
// Search on socid
if ($socid) {
if ($socid > 0) {
$sql .= " AND a.fk_soc = ".((int) $socid);
}
// We must filter on assignment table
if ($filtert > 0 || $usergroup > 0) {
$sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
}
if ($type) {
$sql .= " AND c.id = ".((int) $type);
}

View file

@ -145,6 +145,13 @@ class FactureRec extends CommonInvoice
public $cond_reglement_code; // Code in llx_c_paiement
public $mode_reglement_code; // Code in llx_c_paiement
public $fk_multicurrency;
public $multicurrency_code;
public $multicurrency_tx;
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
public $suspended; // status
public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice

View file

@ -3317,7 +3317,7 @@ class ContratLigne extends CommonObjectLine
$sql .= " t.label,"; // This field is not used. Only label of product
$sql .= " p.ref as product_ref,";
$sql .= " p.label as product_label,";
$sql .= " p.description as product_desc,";
$sql .= " p.description as product_description,";
$sql .= " p.fk_product_type as product_type,";
$sql .= " t.description,";
$sql .= " t.date_commande,";

View file

@ -390,6 +390,13 @@ if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
//print $sql;
// Count total nb of records
@ -502,6 +509,10 @@ if ($filter_datecloture_start != '') {
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(

View file

@ -1562,6 +1562,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
}
}
} else {
$ok = false; // to avoid false positive
dol_syslog("No files to delete found", LOG_DEBUG);
}
} else {

View file

@ -280,7 +280,7 @@ class pdf_soleil extends ModelePDFFicheinter
$desc = dol_htmlentitiesbr($text, 1);
//print $outputlangs->convToOutputCharset($desc); exit;
$pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1);
$pdf->writeHTMLCell(180, 3, $this->posxdesc - 1, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1);
$nexY = $pdf->GetY();
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);

View file

@ -467,6 +467,14 @@ class doc_generic_task_odt extends ModelePDFTask
return -1;
}
// Add odtgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}

View file

@ -222,6 +222,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (!is_object($outputlangs)) {
$outputlangs = $langs;

View file

@ -2381,35 +2381,52 @@ class CommandeFournisseur extends CommonOrder
}
$main = $this->db->prefix().'commande_fournisseurdet';
$ef = $main."_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = ".((int) $this->id).")";
dol_syslog(get_class($this)."::delete extrafields lines", LOG_DEBUG);
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
if (!$error) {
$sql1 = "UPDATE ".$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")";
dol_syslog(__METHOD__." linked order lines", LOG_DEBUG);
if (!$this->db->query($sql1)) {
$error++;
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
}
}
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseurdet WHERE fk_commande =".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
}
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseur WHERE rowid =".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($resql = $this->db->query($sql)) {
if ($this->db->affected_rows($resql) < 1) {
if (!$error) {
$ef = $main."_extrafields";
$sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = ".((int) $this->id).")";
dol_syslog(get_class($this)."::delete extrafields lines", LOG_DEBUG);
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
}
}
if (!$error) {
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseurdet WHERE fk_commande =".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
}
}
if (!$error) {
$sql = "DELETE FROM ".$this->db->prefix()."commande_fournisseur WHERE rowid =".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if ($resql = $this->db->query($sql)) {
if ($this->db->affected_rows($resql) < 1) {
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
}
} else {
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
}
} else {
$this->error = $this->db->lasterror();
$this->errors[] = $this->db->lasterror();
$error++;
}
// Remove extrafields
@ -4091,6 +4108,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
return -2;
}
}
/**
* Update the line object into db
*

View file

@ -235,7 +235,12 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
}
// Add odtgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (!is_object($outputlangs)) {
$outputlangs = $langs;

View file

@ -243,9 +243,9 @@ if ($action == 'remove_file' && $user->hasRight('projet', 'creer')) {
$ret = dol_delete_file($file);
if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
}
}
@ -253,6 +253,7 @@ if ($action == 'remove_file' && $user->hasRight('projet', 'creer')) {
/*
* View
*/
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);

View file

@ -233,7 +233,12 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
}
// Add odtgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('odtgeneration'));
global $action;
if (!is_object($outputlangs)) {
$outputlangs = $langs;