Merge pull request #24500 from bloxera/fix_24356_final

Fix for #24256 with final cleanup.
This commit is contained in:
Laurent Destailleur 2023-04-18 18:31:39 +02:00 committed by GitHub
commit 2c29399fa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -20,6 +20,7 @@
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr> * Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com> * Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -633,7 +634,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
} }
} }
if (!empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { if (!empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) {
if (!empty($_GET['action']) && (preg_match('/^create|^add_price|^make/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { if (!empty($_GET['action']) && (preg_match('/^create/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) {
// Now search in setup to overwrite default values // Now search in setup to overwrite default values
if (!empty($user->default_values)) { // $user->default_values defined from menu 'Setup - Default values' if (!empty($user->default_values)) { // $user->default_values defined from menu 'Setup - Default values'
if (isset($user->default_values[$relativepathstring]['createform'])) { if (isset($user->default_values[$relativepathstring]['createform'])) {

View File

@ -11,6 +11,7 @@
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com> * Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -1047,7 +1048,7 @@ if (empty($reshook)) {
$action = ''; $action = '';
} elseif ($methodecommande <= 0) { } elseif ($methodecommande <= 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors');
$action = 'makeorder'; $action = 'createorder';
} }
} }
@ -2438,7 +2439,7 @@ if ($action == 'create') {
*/ */
if ($user->socid == 0 && $action != 'delete') { if ($user->socid == 0 && $action != 'delete') {
if ($action != 'makeorder' && $action != 'presend' && $action != 'editline') { if ($action != 'createorder' && $action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
$parameters = array(); $parameters = array();
@ -2569,7 +2570,7 @@ if ($action == 'create') {
if ($object->statut == CommandeFournisseur::STATUS_ACCEPTED) { if ($object->statut == CommandeFournisseur::STATUS_ACCEPTED) {
if ($usercanorder) { if ($usercanorder) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=makeorder#makeorder">'.$langs->trans("MakeOrder").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=createorder#makeorder">'.$langs->trans("MakeOrder").'</a></div>';
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("MakeOrder").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("MakeOrder").'</a></div>';
} }
@ -2637,7 +2638,7 @@ if ($action == 'create') {
print "</div>"; print "</div>";
} }
if ($usercanorder && $object->statut == CommandeFournisseur::STATUS_ACCEPTED && $action == 'makeorder') { if ($usercanorder && $object->statut == CommandeFournisseur::STATUS_ACCEPTED && $action == 'createorder') {
// Set status to ordered (action=commande) // Set status to ordered (action=commande)
print '<!-- form to record supplier order -->'."\n"; print '<!-- form to record supplier order -->'."\n";
print '<form name="commande" id="makeorder" action="card.php?id='.$object->id.'&amp;action=commande" method="POST">'; print '<form name="commande" id="makeorder" action="card.php?id='.$object->id.'&amp;action=commande" method="POST">';
@ -2678,7 +2679,7 @@ if ($action == 'create') {
$action = 'presend'; $action = 'presend';
} }
if ($action != 'makeorder' && $action != 'presend' ) { if ($action != 'createorder' && $action != 'presend' ) {
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
// Generated documents // Generated documents