Merge pull request #20383 from fappels/develop_remember_origin_for_butactionnew

New: Remember origin for newbutton inside create form.
This commit is contained in:
Laurent Destailleur 2022-03-16 22:33:00 +01:00 committed by GitHub
commit 3f7a807eba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7067,6 +7067,8 @@ abstract class CommonObject
$paramforthenewlink = '';
$paramforthenewlink .= (GETPOSTISSET('action') ? '&action='.GETPOST('action', 'aZ09') : '');
$paramforthenewlink .= (GETPOSTISSET('id') ? '&id='.GETPOST('id', 'int') : '');
$paramforthenewlink .= (GETPOSTISSET('origin') ? '&origin='.GETPOST('origin', 'aZ09') : '');
$paramforthenewlink .= (GETPOSTISSET('originid') ? '&originid='.GETPOST('originid', 'int') : '');
$paramforthenewlink .= '&fk_'.strtolower($class).'=--IDFORBACKTOPAGE--';
// TODO Add Javascript code to add input fields already filled into $paramforthenewlink so we won't loose them when going back to main page
$out .= '<a class="butActionNew" title="'.$langs->trans("New").'" href="'.$url_path.'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].($paramforthenewlink ? '?'.$paramforthenewlink : '')).'"><span class="fa fa-plus-circle valignmiddle"></span></a>';