dolibarr  7.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  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  * or see http://www.gnu.org/
17  */
18 
25 // $action must be defined
26 // $permissiontoedit must be defined to permission to edit object
27 // $object must be defined
28 // $langs must be defined
29 // $hidedetails, $hidedesc, $hideref must de defined
30 
31 if ($action == 'up' && $permissiontoedit)
32 {
33  $object->line_up(GETPOST('rowid'));
34 
35  // Define output language
36  $outputlangs = $langs;
37  $newlang = '';
38  if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
39  if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
40  if (! empty($newlang)) {
41  $outputlangs = new Translate("", $conf);
42  $outputlangs->setDefaultLang($newlang);
43  }
44 
45  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
46  $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
47  }
48 
49  header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
50  exit();
51 }
52 
53 if ($action == 'down' && $permissiontoedit)
54 {
55  $object->line_down(GETPOST('rowid'));
56 
57  // Define output language
58  $outputlangs = $langs;
59  $newlang = '';
60  if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
61  if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
62  if (! empty($newlang)) {
63  $outputlangs = new Translate("", $conf);
64  $outputlangs->setDefaultLang($newlang);
65  }
66  if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
67  $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
68  }
69 
70  header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
71  exit();
72 }
73 
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage translations.