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

This commit is contained in:
Laurent Destailleur 2023-02-22 14:33:59 +01:00
commit da503e6c58
5 changed files with 11 additions and 5 deletions

View File

@ -175,6 +175,7 @@ class FormTicket
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.(!empty($this->param["returnurl"]) ? $this->param["returnurl"] : "").'">'; print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.(!empty($this->param["returnurl"]) ? $this->param["returnurl"] : "").'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="'.$this->action.'">'; print '<input type="hidden" name="action" value="'.$this->action.'">';
print '<input type="hidden" name="trackid" value="'.$this->trackid.'">';
foreach ($this->param as $key => $value) { foreach ($this->param as $key => $value) {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'; print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
} }

View File

@ -2436,10 +2436,12 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / '; if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] .= ' / ';
$linkedobjects[$objecttype]['ref_value'] .= $outputlangs->transnoentities($elementobject->ref); $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);
} else { } else {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); $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.')' : ''); 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]['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);
} }
} }
} }

View File

@ -187,10 +187,11 @@ if (($line->info_bits & 2) == 2) {
if ($line->date_start || $line->date_end) { if ($line->date_start || $line->date_end) {
print '<div class="clearboth nowraponall opacitymedium daterangeofline">'.get_date_range($line->date_start, $line->date_end, $format).'</div>'; print '<div class="clearboth nowraponall opacitymedium daterangeofline">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
} }
if (!$line->date_start || !$line->date_end) { if (!$line->date_start || !$line->date_end) {
// show warning under line // show warning under line
// we need to fetch product associated to line for some test // 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(); $res = $line->fetch_product();
if ($res > 0 ) { if ($res > 0 ) {
if ($line->product->isService() && $line->product->isMandatoryPeriod()) { if ($line->product->isService() && $line->product->isMandatoryPeriod()) {

View File

@ -260,7 +260,7 @@ if (empty($reshook)) {
if (!$error) { if (!$error) {
// File transfer // 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) { if (!$error) {
@ -713,6 +713,7 @@ if ($action == 'create' || $action == 'presend') {
print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); 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->withfromsocid = $socid ? $socid : $user->socid;
$formticket->withfromcontactid = $contactid ? $contactid : ''; $formticket->withfromcontactid = $contactid ? $contactid : '';
$formticket->withtitletopic = 1; $formticket->withtitletopic = 1;

View File

@ -2349,9 +2349,10 @@ class Ticket extends CommonObject
* Used for files linked into messages. * Used for files linked into messages.
* Files may be renamed during copy to avoid overwriting existing files. * 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; global $conf;
@ -2366,7 +2367,7 @@ class Ticket extends CommonObject
$maxheightmini = 72; $maxheightmini = 72;
$formmail = new FormMail($this->db); $formmail = new FormMail($this->db);
$formmail->trackid = 'tic'.$this->id; $formmail->trackid = (is_null($forcetrackid) ? 'tic'.$this->id : '');
$attachedfiles = $formmail->get_attached_files(); $attachedfiles = $formmail->get_attached_files();
$filepath = $attachedfiles['paths']; $filepath = $attachedfiles['paths'];