diff --git a/html/ajax_card.php b/html/ajax_card.php
index 2e102c3f2..cf03203f2 100644
--- a/html/ajax_card.php
+++ b/html/ajax_card.php
@@ -301,6 +301,7 @@ case 'sc':
{
$f=new Fiche($cn);
$f->insert($fd_id,$_POST);
+ $f->Get();
$html.='
Fiche sauvée
';
$html.=$f->Display(true);
$js="";
diff --git a/html/fid_card.php b/html/fid_card.php
index 7fffa232f..981194de4 100644
--- a/html/fid_card.php
+++ b/html/fid_card.php
@@ -55,15 +55,15 @@ $g_user=new User($cn);
$g_user->check();
$g_user->check_dossier(dossier::id());
-switch ($d)
+if ( $d == 'all')
{
-case 'all':
$filter_card='';
- break;
-
-default:
- $filter_card="and fd_id in ($d)";
}
+else if (strpos($d,'sql]')==true)
+{
+ $filter_card= str_replace('[sql]', "", $d);
+} else
+ $filter_card="and fd_id in ($d)";
if ( $jrn != -1 )
{
diff --git a/html/js/ajax_fiche.js b/html/js/ajax_fiche.js
index a2d7d4111..efab04490 100644
--- a/html/js/ajax_fiche.js
+++ b/html/js/ajax_fiche.js
@@ -68,7 +68,8 @@ function ajaxFid(p_ctl)
{
try
{
- var gDossier=$('gDossier').value;
+ alert('ici');
+ var gDossier=$('gDossier').value;
var jrn=$(p_ctl).jrn;
$(p_ctl).value=$(p_ctl).value.toUpperCase();
if ( jrn == undefined )
diff --git a/include/class_fiche.php b/include/class_fiche.php
index 974d7d6c1..cf4d844d8 100644
--- a/include/class_fiche.php
+++ b/include/class_fiche.php
@@ -518,16 +518,14 @@ class Fiche
case 'card':
$w = new ICard("av_text" . $attr->ad_id);
// filter on frd_id
- $sql = ' select fd_id from fiche_def ';
- $filter = $this->cn->make_list($sql);
- $w->extra = $filter;
+ $w->extra = $attr->ad_extra;
$w->extra2 = 0;
$label = new ISpan();
- $label->name = "av_text" . $r->ad_id . "_label";
+ $label->name = "av_text" . $attr->ad_id . "_label";
$w->set_attribute('ipopup', 'ipopcard');
- $w->set_attribute('typecard', $filter);
- $w->set_attribute('inp', "av_text" . $r->ad_id);
- $w->set_attribute('label', "av_text" . $r->ad_id . "_label");
+ $w->set_attribute('typecard', $attr->ad_extra);
+ $w->set_attribute('inp', "av_text" . $attr->ad_id);
+ $w->set_attribute('label', "av_text" . $attr->ad_id . "_label");
$msg = $w->search();
$msg.=$label->input();
break;
@@ -538,7 +536,7 @@ class Fiche
$w->label = $attr->ad_text;
$w->name = "av_text" . $attr->ad_id;
- $r.="" . td($w->label, ' class="input_text" ') . td($w->input()) . "$msg
";
+ $r.="" . td($w->label, ' class="input_text" ') . td($w->input()) . td("$msg")."
";
}
$r.= '';
return $r;
@@ -663,9 +661,9 @@ class Fiche
break;
case 'card':
$w = new ICard("av_text" . $r->ad_id);
- // filter on frd_id
- $sql = ' select fd_id from fiche_def ';
- $filter = $this->cn->make_list($sql);
+ // filter on ad_extra
+
+ $filter = $r->ad_extra;
$w->width = $r->ad_size;
$w->extra = $filter;
$w->extra2 = 0;
@@ -675,6 +673,7 @@ class Fiche
$w->set_attribute('typecard', $filter);
$w->set_attribute('inp', "av_text" . $r->ad_id);
$w->set_attribute('label', "av_text" . $r->ad_id . "_label");
+ $w->dblclick="fill_ipopcard(this);";
$msg = $w->search();
$msg.=$label->input();
$w->value = $r->av_text;
@@ -1815,50 +1814,57 @@ class Fiche
$filter_query='';
if ( isset($typecard))
{
- switch($typecard)
- {
- case 'cred':
- if ( ! isset($jrn)) throw ('Erreur pas de valeur pour jrn');
- $filter_jrn=$this->cn->make_list("select jrn_def_fiche_cred from jrn_Def where jrn_def_id=$1",array($jrn));
- $filter_fd_id=" fd_id in (".$filter_jrn.")";
- $and=" and ";
- break;
- case 'deb':
- if ( ! isset($jrn)) throw ('Erreur pas de valeur pour jrn');
- $filter_jrn=$this->cn->make_list("select jrn_def_fiche_deb from jrn_Def where jrn_def_id=$1",array($jrn));
- $filter_fd_id=" fd_id in (".$filter_jrn.")";
- $and=" and ";
- break;
- case 'filter':
- if ( ! isset($jrn)) throw ('Erreur pas de valeur pour jrn');
- $filter_jrn=$this->cn->make_list("select jrn_def_fiche_deb from jrn_Def where jrn_def_id=$1",array($jrn));
+ if (strpos($typecard, "sql")==false)
+ {
+ switch($typecard)
+ {
+ case 'cred':
+ if ( ! isset($jrn)) throw ('Erreur pas de valeur pour jrn');
+ $filter_jrn=$this->cn->make_list("select jrn_def_fiche_cred from jrn_Def where jrn_def_id=$1",array($jrn));
+ $filter_fd_id=" fd_id in (".$filter_jrn.")";
+ $and=" and ";
+ break;
+ case 'deb':
+ if ( ! isset($jrn)) throw ('Erreur pas de valeur pour jrn');
+ $filter_jrn=$this->cn->make_list("select jrn_def_fiche_deb from jrn_Def where jrn_def_id=$1",array($jrn));
+ $filter_fd_id=" fd_id in (".$filter_jrn.")";
+ $and=" and ";
+ break;
+ case 'filter':
+ if ( ! isset($jrn)) throw ('Erreur pas de valeur pour jrn');
+ $filter_jrn=$this->cn->make_list("select jrn_def_fiche_deb from jrn_Def where jrn_def_id=$1",array($jrn));
- if ( trim($filter_jrn) !='')
- $fp1=" fd_id in (".$filter_jrn.")";
- else
- $fp1="fd_id < 0";
+ if ( trim($filter_jrn) !='')
+ $fp1=" fd_id in (".$filter_jrn.")";
+ else
+ $fp1="fd_id < 0";
- $filter_jrn=$this->cn->make_list("select jrn_def_fiche_cred from jrn_Def where jrn_def_id=$1",array($jrn));
+ $filter_jrn=$this->cn->make_list("select jrn_def_fiche_cred from jrn_Def where jrn_def_id=$1",array($jrn));
- if ( trim($filter_jrn) !='')
- $fp2=" fd_id in (".$filter_jrn.")";
- else
- $fp2="fd_id < 0";
+ if ( trim($filter_jrn) !='')
+ $fp2=" fd_id in (".$filter_jrn.")";
+ else
+ $fp2="fd_id < 0";
- $filter_fd_id='('.$fp1.' or '.$fp2.')';
+ $filter_fd_id='('.$fp1.' or '.$fp2.')';
- $and=" and ";
- break;
- case 'all':
- $filter_fd_id=' true';
- break;
- default:
- if ( trim($typecard) != '')
- $filter_fd_id=' fd_id in ('.$typecard.')';
- else
- $filter_fd_id=' fd_id < 0';
- }
- }
+ $and=" and ";
+ break;
+ case 'all':
+ $filter_fd_id=' true';
+ break;
+ default:
+ if ( trim($typecard) != '')
+ $filter_fd_id=' fd_id in ('.$typecard.')';
+ else
+ $filter_fd_id=' fd_id < 0';
+ }
+ }
+ else
+ {
+ $filter_fd_id = str_replace('[sql]', '', $typecard);
+ }
+ }
$and=" and ";
if (isset($query))
diff --git a/include/class_fiche_def.php b/include/class_fiche_def.php
index 2f08a7f2d..ea8ac2d45 100644
--- a/include/class_fiche_def.php
+++ b/include/class_fiche_def.php
@@ -344,7 +344,7 @@ class Fiche_Def
function myList()
{
$this->Get();
- echo ''.$this->label.'
';
+ echo ''.$this->id." ".$this->label.'
';
$step=$_SESSION['g_pagesize'];
$sql_limit="";
@@ -452,10 +452,9 @@ class Fiche_Def
{
if ( $this->id == 0 )
return ;
- /* $this->cn->exec_sql('select fiche_attribut_synchro($1)',
- array($this->id));
- */
- $MaxLine=sizeof($this->attribut);
+ $this->cn->exec_sql('select fiche_attribut_synchro($1)',array($this->id));
+
+ $MaxLine=sizeof($this->attribut);
$r="";
$r.="".th('Nom attribut').th('').th('Ordre','style="text-align:right"').'
';
// Display each attribute
diff --git a/include/fiche.inc.php b/include/fiche.inc.php
index 895b664c8..6c267ea4a 100644
--- a/include/fiche.inc.php
+++ b/include/fiche.inc.php
@@ -89,7 +89,7 @@ function ShowFicheDefInput($p_fiche_def)
$p_fiche_def->save_class_base($_REQUEST['class_base']);
}
$p_fiche_def->Get();
- $r.= ''.h($p_fiche_def->label).'
';
+ $r.= ''.$p_fiche_def->id." ".h($p_fiche_def->label).'
';
$r.='