[Glpi-dev] [PATCH] block the creation of a ipnetwork with no ipaddress (0.84)

2012-05-04 Thread Gonéri Le Bouder
This changes block ipnetwork creation if the "network" field
is empty.
---
 inc/ipnetwork.class.php |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/inc/ipnetwork.class.php b/inc/ipnetwork.class.php
index a194978..5eb063e 100644
--- a/inc/ipnetwork.class.php
+++ b/inc/ipnetwork.class.php
@@ -198,7 +198,10 @@ class IPNetwork extends CommonImplicitTreeDropdown {
   // Or if $this->fields["network"] != $input["network"] we a
updating the network
   $address = new IPAddress();
   $netmask = new IPNetmask();
-  if (!isset($this->fields["id"])
+  if (!$input["network"]) {
+ return array('error' => __('Invalid network address'),
+'input' => false);
+  } else if (!isset($this->fields["id"])
   || ($input["network"] != $this->fields["network"])) {
  $network = explode ("/", $input["network"]);
  if (count($network) != 2) {
-- 
1.7.10

___
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev


Re: [Glpi-dev] Problème avec les critères de règles en 0.83 (dev version)

2012-05-04 Thread Remi Collet
Le 04/05/2012 10:14, David DURIEUX a écrit :
> Bonjour,
> 
> Quant on a une règle de ticket : "attribuer à groupe n'existe pas", la
> règle ne marche pas. En effet il teste si le champs est '' mais ce
> champs numérique va être à 0. j'ai fait un patch pour checker avec
> empty() (qui teste si '' et 0).
> 

Ticket 3557
Appliqué en 0.83 et trunk.

Remi.

> Il faudrait voir si ca ne fait pas d'effet de bord avec d'autres
> règles, mais je ne pense pas.
> 
> Cordialement,

___
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev


[Glpi-dev] Problème avec les critères de règles en 0.83 (dev version)

2012-05-04 Thread David DURIEUX
Bonjour,

Quant on a une règle de ticket : "attribuer à groupe n'existe pas", la
règle ne marche pas. En effet il teste si le champs est '' mais ce
champs numérique va être à 0. j'ai fait un patch pour checker avec
empty() (qui teste si '' et 0).

Il faudrait voir si ca ne fait pas d'effet de bord avec d'autres
règles, mais je ne pense pas.

Cordialement,
--
David DURIEUX
Tel : +33 (0)4.82.53.30.53
Mail : d.duri...@siprossii.com
Site Web : http://www.siprossii.com/

SIPROSSII
Les Lafôrets
69430 Beaujeu
FRANCE
Index: inc/rulecriteria.class.php
===
--- inc/rulecriteria.class.php	(revision 18422)
+++ inc/rulecriteria.class.php	(working copy)
@@ -163,10 +163,10 @@
 
   switch ($condition) {
  case Rule::PATTERN_EXISTS :
-return ($field != '');
+return (!empty($field));
 
  case Rule::PATTERN_DOES_NOT_EXISTS :
-return ($field == '');
+return (empty($field));
 
  case Rule::PATTERN_IS :
 if (is_array($field)) {
___
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev