dolibarr 23.0.3
actions_lineupdown.inc.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
27// $action must be defined
28// $permissiontoedit must be defined to permission to edit object
29// $object must be defined
30// $langs must be defined
31// $hidedetails, $hidedesc, $hideref must defined
32'
33@phan-var-force bool $permissiontoedit
34@phan-var-force CommonObject $object
35';
47if ($action == 'up' && $permissiontoedit) {
48 $object->line_up(GETPOSTINT('rowid'));
49
50 // Define output language
51 $outputlangs = $langs;
52 $newlang = '';
53 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
54 $newlang = GETPOST('lang_id', 'aZ09');
55 }
56 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
57 $newlang = $object->thirdparty->default_lang;
58 }
59 if (!empty($newlang)) {
60 $outputlangs = new Translate("", $conf);
61 $outputlangs->setDefaultLang($newlang);
62 }
63
64 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
65 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
66 }
67
68 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid'));
69 exit();
70}
71
72if ($action == 'down' && $permissiontoedit) {
73 $object->line_down(GETPOSTINT('rowid'));
74
75 // Define output language
76 $outputlangs = $langs;
77 $newlang = '';
78 if (getDolGlobalInt('MAIN_MULTILANGS') /* && empty($newlang) */ && GETPOST('lang_id', 'aZ09')) {
79 $newlang = GETPOST('lang_id', 'aZ09');
80 }
81 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
82 $newlang = $object->thirdparty->default_lang;
83 }
84 if (!empty($newlang)) {
85 $outputlangs = new Translate("", $conf);
86 $outputlangs->setDefaultLang($newlang);
87 }
88 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
89 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
90 }
91
92 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid'));
93 exit();
94}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage translations.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.