Author: danydb
Date: 2014-01-12 17:06:37 +0100 (Sun, 12 Jan 2014)
New Revision: 661
Modified:
tag/rel671/rapport_avance/include/class_rapav_formulaire.php
Log:
Bug : better check of duplicate code
Modified: tag/rel671/rapport_avance/include/class_rapav_formulaire.php
===================================================================
--- tag/rel671/rapport_avance/include/class_rapav_formulaire.php
2014-01-12 12:59:05 UTC (rev 660)
+++ tag/rel671/rapport_avance/include/class_rapav_formulaire.php
2014-01-12 16:06:37 UTC (rev 661)
@@ -122,16 +122,27 @@
static function verify_definition(&$p_array)
{
global $cn;
- for ($i=0;$i<count($p_array['p_code']);$i++)
+ $count_code=count($p_array['p_code']);
+ for ($i=0;$i<$count_code;$i++)
{
$c=$cn->get_value('select count(*) from
rapport_advanced.formulaire_param
where p_code=$1 and p_id <> $2 and f_id=$3',
array($p_array['p_code'][$i],$p_array['p_id'][$i],$p_array['f_id']));
if ( $c > 0 ) {
- $p_array['p_code'][$i]='C'.$i.microtime();
+ $p_array['p_code'][$i]='C'.$i.microtime(false);
}
}
+
+ for ($i=0;$i<$count_code;$i++)
+ {
+ for ($e=0;$e<$count_code;$e++) {
+ if ($p_array['p_code'][$i] == $p_array['p_code'][$e]
&& $i != $e)
+ {
+ $p_array['p_code'][$e]='C'.$i.microtime(false);
+ }
+ }
+ }
}
/**
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
_______________________________________________
Phpcompta est un logiciel libre de comptabilité en ligne
(http://www.phpcompta.eu)
Phpcompta-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/phpcompta-dev