From 919d87a49ef1b3471e3207a59a1385d4deeb3f81 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 3 Mar 2023 10:22:18 +0100 Subject: [PATCH 1/4] fix: remove invoice line id and invoice on time spend when delete line --- htdocs/compta/facture/class/facture.class.php | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b5332b033ef..2a3f8b4a17f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4230,19 +4230,6 @@ class Facture extends CommonInvoice $this->db->begin(); - // Free discount linked to invoice line - $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except'; - $sql .= ' SET fk_facture_line = NULL'; - $sql .= ' WHERE fk_facture_line = '.((int) $rowid); - - dol_syslog(get_class($this)."::deleteline", LOG_DEBUG); - $result = $this->db->query($sql); - if (!$result) { - $this->error = $this->db->error(); - $this->db->rollback(); - return -1; - } - // Memorize previous line for triggers $staticline = clone $line; $line->oldline = $staticline; @@ -6441,13 +6428,38 @@ class FactureLigne extends CommonInvoiceLine return -1; } - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->rowid); + // Free discount linked to invoice line + $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except'; + $sql .= ' SET fk_facture_line = NULL'; + $sql .= ' WHERE fk_facture_line = '.((int) $this->id); + + dol_syslog(get_class($this)."::deleteline", LOG_DEBUG); + $result = $this->db->query($sql); + if (!$result) { + $this->error = $this->db->error(); + $this->errors[] = $this->error; + $this->db->rollback(); + return -1; + } + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time'; + $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL'; + $sql .= ' WHERE invoice_line_id = '.((int) $this->id); + if (!$this->db->query($sql)) { + $this->error = $this->db->error()." sql=".$sql; + $this->errors[] = $this->error; + $this->db->rollback(); + return -1; + } + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".((int) $this->id); if ($this->db->query($sql)) { $this->db->commit(); return 1; } else { $this->error = $this->db->error()." sql=".$sql; + $this->errors[] = $this->error; $this->db->rollback(); return -1; } From e5c9e14c0f1263ca12b638c73c4bc1415c15cab4 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Mon, 6 Mar 2023 14:57:07 +0100 Subject: [PATCH 2/4] NEW - Add origin info when create a product batch when created from a movement stock --- htdocs/product/stock/class/mouvementstock.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 62526483542..f8c075b228c 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -368,6 +368,8 @@ class MouvementStock extends CommonObject } } else { // If not found, we add record $productlot = new Productlot($this->db); + $productlot->origin = !empty($this->origin) ? (empty($this->origin->origin_type) ? $this->origin->element : $this->origin->origin_type) : ''; + $productlot->origin_id = !empty($this->origin) ? $this->origin->id : 0; $productlot->entity = $conf->entity; $productlot->fk_product = $fk_product; $productlot->batch = $batch; From 8fd991d51d9731bdff5ae92a3fe9e6508615564d Mon Sep 17 00:00:00 2001 From: Maximilien Rozniecki Date: Mon, 6 Mar 2023 15:41:58 +0100 Subject: [PATCH 3/4] add extrafields_view.tpl.php inside public_ticket_view --- htdocs/public/ticket/view.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 1bfc235ff65..67b582c0afd 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -218,6 +218,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; $form = new Form($db); $formticket = new FormTicket($db); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('ticketpublicview', 'globalcard')); + if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { print '
'.$langs->trans('TicketPublicInterfaceForbidden').'
'; $db->close(); @@ -332,6 +335,9 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%'; print ''; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + print ''; print ''; From 61fd3d3c25ee00900280af826ee4543e890fb565 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Tue, 7 Mar 2023 10:10:19 +0100 Subject: [PATCH 4/4] Search all on projects Search all using client code and thirdparty name alias --- htdocs/projet/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 1f203113b3a..d0075b57ed7 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -192,6 +192,8 @@ foreach ($object->fields as $key => $val) { // Add name object fields to "search in all" $fieldstosearchall['s.nom'] = "ThirdPartyName"; +$fieldstosearchall['s.name_alias'] = "AliasNameShort"; +$fieldstosearchall['s.code_client'] = "CustomerCode"; // Definition of array of fields for columns $arrayfields = array();