diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 7946e11c3c2..ca2868bcf0b 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -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); } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 872067a75c1..61b44ad7913 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -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 diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8bf66f9fe2e..e7ec6e01aaf 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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,"; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 03a837929f5..4a2fa3fb219 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -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( diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e8e347e7647..fccce0cc1a9 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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 { diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index eb08a138e20..91075365fe2 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -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); diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b86f6756d44..70719412571 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -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; } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 0ea2d553516..cdfbb1bc7ca 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -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; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index cb94ccd7366..4edd2325bb4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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 * diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 1506e58d4e0..98d276b74f4 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -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; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 264462594f2..cb96688f6b3 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -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); diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index def8d1843d0..5785137ee43 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -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;