diff --git a/html/admin/sql/patch/upgrade102.sql b/html/admin/sql/patch/upgrade102.sql
index 32b357076..a140775ec 100644
--- a/html/admin/sql/patch/upgrade102.sql
+++ b/html/admin/sql/patch/upgrade102.sql
@@ -359,7 +359,7 @@ begin
if NEW.ad_id=23 and NEW.ad_value != OLD.ad_value then
RAISE NOTICE 'new qcode [%] old qcode [%]',NEW.ad_value,OLD.ad_value;
- for i in select ad_id from attr_def where ad_type = 'card' loop
+ for i in select ad_id from attr_def where ad_type = 'card' or ad_id=25 loop
update fiche_detail set ad_value=NEW.ad_value where ad_value=OLD.ad_value and ad_id=i.ad_id;
RAISE NOTICE 'change for ad_id [%] ',i.ad_id;
if i.ad_id=19 then
@@ -489,6 +489,7 @@ update menu_ref set me_menu='Fiche',me_description='Configuration de catégorie
drop table user_sec_extension;
+update attr_def set ad_type='card', ad_extra='[sql] frd_id in (4,8,9,14)' where ad_id=25;
update version set val=103;
diff --git a/include/class_fiche.php b/include/class_fiche.php
index a0bbf64ed..5c2df3b63 100644
--- a/include/class_fiche.php
+++ b/include/class_fiche.php
@@ -467,25 +467,7 @@ class Fiche
$w=new ITva_Popup('popup_tva');
$w->table=1;
}
- elseif ( $attr->ad_id == ATTR_DEF_COMPANY )
- {
- $w=new ICard("av_text".$attr->ad_id);
- // filter on frd_id
- $sql=' select fd_id from fiche_def where frd_id in ('.FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX.','.FICHE_TYPE_FIN.')';
- $filter=$this->cn->make_list($sql);
- $w->set_attribute('ipopup','ipopcard');
- $w->set_attribute('typecard',$filter);
- $w->set_attribute('inp',"av_text".$attr->ad_id);
- $w->set_attribute('label',"av_text".$attr->ad_id."_label");
-
- $w->extra=$filter;
- $w->extra2=0;
- $label=new ISpan();
- $label->name="av_text".$attr->ad_id."_label";
- $msg.=td($w->search().$label->input());
-
-
- }
+
else
{
switch ($attr->ad_type)
@@ -609,25 +591,6 @@ class Fiche
$w->table = 1;
$w->value = $r->av_text;
}
- elseif ($r->ad_id == ATTR_DEF_COMPANY)
- {
- $w = new ICard("av_text" . $r->ad_id);
- // filter on frd_id
- $sql = ' select fd_id from fiche_def where frd_id in (' . FICHE_TYPE_CLIENT . ',' . FICHE_TYPE_FOURNISSEUR . ',' . FICHE_TYPE_ADM_TAX . '
- ,'.FICHE_TYPE_FIN.')';
- $filter = $this->cn->make_list($sql);
- $w->extra = $filter;
- $w->extra2 = 0;
- $label = new ISpan();
- $label->name = "av_text" . $r->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->value = $r->av_text;
- $msg = $w->search();
- $msg.=$label->input();
- }
else
{
switch ($r->ad_type)
@@ -840,18 +803,6 @@ class Fiche
}
}
}
- // The contact has a company attribut
- if ( $id == ATTR_DEF_COMPANY )
- {
- $exist=$this->cn->count_sql("select f_id from fiche join fiche_def using (fd_id) ".
- " join fiche_detail using(f_id) ".
- " where frd_id in (4,8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
- " and ad_value='".sql_string($value)."'");
- if ( $exist == 0 && sql_string($value) != null )
- {
- $value="";
- }
- }
// Normal traitement
$value2=sql_string($value);
@@ -985,21 +936,6 @@ class Fiche
}
}
}
- if ( $id == ATTR_DEF_COMPANY )
- {
- $exist=$this->cn->exec_sql("select f_id from fiche join fiche_def using (fd_id) ".
- " join fiche_detail using (f_id) ".
- " where frd_id in (4,8,9,14) and ad_id=$1 ".
- " and ad_value=upper($2)",
- array(ATTR_DEF_QUICKCODE,$value));
-
-
- if ( Database::num_row($exist) == 0 && sql_string($value) != null )
- {
- $value="Attention : pas de société ";
- }
- }
-
// Normal traitement
$sql="update fiche_detail set ad_value=$1 where jft_id=$2";
$this->cn->exec_sql($sql,array(strip_tags($value),$jft_id));