Fix: bad entity with ajax constant on/off

This commit is contained in:
Regis Houssin 2012-02-13 09:44:24 +01:00
parent 91fae20485
commit bcddfd878a
2 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,7 @@ print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY
// Registering the location of boxes // Registering the location of boxes
if ((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) ) if ((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) )
{ {
$entity = (GETPOST('entity','int') >= 0 ? GETPOST('entity','int') : $conf->entity); $entity = GETPOST('entity','int');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$name = GETPOST('name', 'alpha'); $name = GETPOST('name', 'alpha');

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2007-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -229,7 +229,7 @@ function ajax_constantonoff($code,$input=array(),$entity=false)
{ {
global $conf, $langs; global $conf, $langs;
$entity = ((! empty($entity) && is_numeric($entity) && $entity > 0) || $entity == 0 ? $entity : $conf->entity); $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
$out= '<script type="text/javascript"> $out= '<script type="text/javascript">
$(function() { $(function() {