From 0e8b7ef656eb8259757c38b87ba006cb5bc1379a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jan 2022 16:38:25 +0100 Subject: [PATCH] Clean code --- htdocs/core/lib/sendings.lib.php | 2 +- htdocs/core/tpl/commonfields_view.tpl.php | 48 +++++++++++++---------- htdocs/delivery/card.php | 4 +- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 0814c0f4825..e2ab74b8cfc 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -180,7 +180,7 @@ function delivery_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($tmpobject->ref); + $upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $tmpobject->element, $tmpobject->id); $head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$tmpobject->id; diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 29bf3943cea..42ead1573f4 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -110,11 +110,9 @@ print ''; // We close div and reopen for second column print ''; -print '
'; -print '
'; -print ''; +$rightpart = ''; $alreadyoutput = 1; foreach ($object->fields as $key => $val) { if ($alreadyoutput) { @@ -139,38 +137,46 @@ foreach ($object->fields as $key => $val) { $value = $object->$key; - print ' 0) $rightpart .= ' fieldrequired'; // No fieldrequired inthe view output if ($val['type'] == 'text' || $val['type'] == 'html') { - print ' tdtop'; + $rightpart .= ' tdtop'; } - print '">'; + $rightpart.= '">'; if (!empty($val['help'])) { - print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); + $rightpart .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); } else { - print $langs->trans($val['label']); + $rightpart .= $langs->trans($val['label']); } - print ''; - print ''; - print ''; + $rightpart .= ''; + $rightpart .= ''; } + +print '
'; +print '
'; + +print '
'; + $rightpart .= '">'; if (in_array($val['type'], array('text', 'html'))) { - print '
'; + $rightpart .= '
'; } - print $object->showOutputField($val, $key, $value, '', '', '', 0); - //print dol_escape_htmltag($object->$key, 1, 1); + $rightpart .= $object->showOutputField($val, $key, $value, '', '', '', 0); + //$rightpart .= dol_escape_htmltag($object->$key, 1, 1); if (in_array($val['type'], array('text', 'html'))) { - print '
'; + $rightpart .= '
'; } - print '
'; + +print $rightpart; + ?> diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 62955da7f06..00975946f6b 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -101,7 +101,7 @@ if ($action == 'add') { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); if (!$conf->expedition_bon->enabled && !empty($conf->stock->enabled)) { - $expedition->entrepot_id = GETPOST('entrepot_id'); + $expedition->entrepot_id = GETPOST('entrepot_id', 'int'); } // We loop on each line of order to complete object delivery with qty to delivery @@ -282,7 +282,7 @@ if ($action == 'create') { // Create. Seems to no be used print ''; print ''; - print dol_get_fiche_head($head, 'delivery', $langs->trans("Shipment"), -1, 'sending'); + print dol_get_fiche_head($head, 'delivery', $langs->trans("Shipment"), -1, 'dolly'); /* * Confirmation de la suppression