dolibarr  13.0.2
orderAttribute.php
1 <?php
2 
3 /* Copyright (C) 2016 Marcos GarcĂ­a <marcosgdf@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
19 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal
20 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
21 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
22 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
23 if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
24 if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
25 
26 require '../../main.inc.php';
27 
28 
29 /*
30  * View
31  */
32 
33 top_httphead();
34 
35 // Registering the location of boxes
36 if (GETPOSTISSET('roworder')) {
37  $roworder = GETPOST('roworder', 'alpha', 2);
38 
39  dol_syslog("AjaxOrderAttribute roworder=".$roworder, LOG_DEBUG);
40 
41  $rowordertab = explode(',', $roworder);
42 
43  $newrowordertab = array();
44  foreach ($rowordertab as $value) {
45  if (!empty($value)) {
46  $newrowordertab[] = $value;
47  }
48  }
49 
50  require DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
51 
52  ProductAttribute::bulkUpdateOrder($db, $newrowordertab);
53 }
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
static bulkUpdateOrder(DoliDB $db, array $order)
Updates the order of all variants.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1214
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.