From 1f3aa24c8a27e6e851829057bbf668c4f68bbb4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 16:56:16 +0100 Subject: [PATCH 1/4] Fix missing date delivery on invoice --- htdocs/core/lib/pdf.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index fef33262a0f..86ed5fb107d 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2386,6 +2386,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / '; $linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_delivery, 'day', '', $outputlangs); } else { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); From 70c99b1f7937ec8b73360e31999e03a85997b975 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Feb 2023 18:32:36 +0100 Subject: [PATCH 2/4] Fix pdf --- htdocs/core/lib/pdf.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 86ed5fb107d..7a80193b221 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2386,11 +2386,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / '; $linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_delivery, 'day', '', $outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping, 'day', '', $outputlangs); } else { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); $linkedobjects[$objecttype]['ref_value'] .= ' / '.$outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['date_value'] = dol_print_date(empty($elementobject->date_shipping) ? $elementobject->date_delivery : $elementobject->date_shipping, 'day', '', $outputlangs); } } } From 08bcd4af319548bcd874c4e12339e3aa54f5541d Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 22 Feb 2023 12:19:36 +0100 Subject: [PATCH 3/4] FIX : mandatory date for service didnt work for invoice --- htdocs/core/tpl/objectline_view.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index c4ddc7d0c4c..7489d99a765 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -182,10 +182,11 @@ if (($line->info_bits & 2) == 2) { if ($line->date_start || $line->date_end) { print '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; } + if (!$line->date_start || !$line->date_end) { // show warning under line // we need to fetch product associated to line for some test - if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { + if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'facture' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { $res = $line->fetch_product(); if ($res > 0 ) { if ($line->product->isService() && $line->product->isMandatoryPeriod()) { From e7546e6da1baf5f71f5f31845ff64048c53e0d74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 Feb 2023 14:29:36 +0100 Subject: [PATCH 4/4] FIX #23804 --- htdocs/core/class/html.formticket.class.php | 1 + htdocs/ticket/card.php | 3 ++- htdocs/ticket/class/ticket.class.php | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index cd6b9ecd7fc..6b54ee86c33 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -164,6 +164,7 @@ class FormTicket print '
'; print ''; print ''; + print ''; foreach ($this->param as $key => $value) { print ''; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 1b3dd4c8e37..334dcdf6aa4 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -266,7 +266,7 @@ if (empty($reshook)) { if (!$error) { // File transfer - $object->copyFilesForTicket(); + $object->copyFilesForTicket(''); // trackid is forced to '' because files were uploaded when no id for ticket exists yet and trackid was '' } if (!$error) { @@ -689,6 +689,7 @@ if ($action == 'create' || $action == 'presend') { print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); + $formticket->trackid = ''; // TODO Use a unique key to avoid conflict in upload file feature $formticket->withfromsocid = $socid ? $socid : $user->socid; $formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withtitletopic = 1; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 122c5ae35ab..7e3d17dc32d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2437,9 +2437,10 @@ class Ticket extends CommonObject * Used for files linked into messages. * Files may be renamed during copy to avoid overwriting existing files. * - * @return array Array with final path/name/mime of files. + * @param string $forcetrackid Force trackid + * @return array Array with final path/name/mime of files. */ - public function copyFilesForTicket() + public function copyFilesForTicket($forcetrackid = null) { global $conf; @@ -2454,7 +2455,7 @@ class Ticket extends CommonObject $maxheightmini = 72; $formmail = new FormMail($this->db); - $formmail->trackid = 'tic'.$this->id; + $formmail->trackid = (is_null($forcetrackid) ? 'tic'.$this->id : ''); $attachedfiles = $formmail->get_attached_files(); $filepath = $attachedfiles['paths'];