diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 55797308fb2..e75a9dda73b 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -503,9 +503,8 @@ if ($action == 'create' && !$error) print "\n"; } - //Mode liste -if (($action != 'create' && $action != 'add') || !$error) +if (($action != 'create' && $action != 'add') && !$error) { llxHeader(); ?> diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index fc7bcfb3d3a..3f8d7f542f7 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -670,15 +670,24 @@ class pdf_azur extends ModelePDFPropales } $already_merged[] = $line->fk_product; + + $product = new Product($this->db); + $product->fetch($line->fk_product); + + if ($product->entity!=$conf->entity) { + $entity_product_file=$product->entity; + } else { + $entity_product_file=$conf->entity; + } // If PDF is selected and file is not empty if (count($filetomerge->lines) > 0) { foreach ( $filetomerge->lines as $linefile ) { if (! empty($linefile->id) && ! empty($linefile->file_name)) { if (! empty($conf->product->enabled)) - $filetomerge_dir = $conf->product->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($line->product_ref); + $filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref); elseif (! empty($conf->service->enabled)) - $filetomerge_dir = $conf->service->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($line->product_ref); + $filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref); dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG); diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index a18031de4d4..24a481be61f 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -259,7 +259,7 @@ $formfile = new FormFile($db); $companystatic = new Societe($db); // Mode creation -if ($action == 'create' && empty($mesgs)) { +if ($action == 'create' && !$error) { llxHeader(); print_fiche_titre($langs->trans('NewBill')); @@ -380,7 +380,7 @@ if ($action == 'create' && empty($mesgs)) { } // Mode liste -if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { +if (($action != 'create' && $action != 'add') && !$error) { llxHeader(); ?>