dolibarr 21.0.0-beta
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 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 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';
43if ($action == 'up' && $permissiontoedit) {
44 $object->line_up(GETPOST('rowid'));
45
46 // Define output language
47 $outputlangs = $langs;
48 $newlang = '';
49 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
50 $newlang = GETPOST('lang_id', 'aZ09');
51 }
52 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
53 $newlang = $object->thirdparty->default_lang;
54 }
55 if (!empty($newlang)) {
56 $outputlangs = new Translate("", $conf);
57 $outputlangs->setDefaultLang($newlang);
58 }
59
60 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
61 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
62 }
63
64 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid'));
65 exit();
66}
67
68if ($action == 'down' && $permissiontoedit) {
69 $object->line_down(GETPOST('rowid'));
70
71 // Define output language
72 $outputlangs = $langs;
73 $newlang = '';
74 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
75 $newlang = GETPOST('lang_id', 'aZ09');
76 }
77 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
78 $newlang = $object->thirdparty->default_lang;
79 }
80 if (!empty($newlang)) {
81 $outputlangs = new Translate("", $conf);
82 $outputlangs->setDefaultLang($newlang);
83 }
84 if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
85 $object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
86 }
87
88 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'#'.GETPOST('rowid'));
89 exit();
90}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
Class to manage translations.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79