diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index eadbe8efd05..6ec34248a52 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; @@ -6444,13 +6431,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; } 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; 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(); 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 '';