From e15146919f0eb6e765e9d55dcdc17f039a7faa00 Mon Sep 17 00:00:00 2001
From: sparkyx
"; $r.=$w->IOValue(); - $r.=$sp->IOValue('qcode_label',$qcode_label).""; + $r.=$sp->IOValue('qcode_exp_label',$qcode_exp_label).""; + + $r.=$wdest->IOValue(); + $r.=$spdest->IOValue('qcode_dest_label',$qcode_dest_label).""; + $r.="
"; echo_debug('class_action',__LINE__,' ag_id is '.$this->ag_id); @@ -266,10 +295,15 @@ class action $r.=$h2->IOValue(); $r.=$h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id); $r.=$h_ag_id->IOValue('ag_id',$this->ag_id); + $hidden=new widget('hidden'); + $r.=$hidden->IOValue('f_id_dest',$this->f_id_dest); + $hidden2=new widget('hidden'); + $r.=$hidden2->IOValue('f_id_exp',$this->f_id_exp); $r.=""; // show the list of the concern operation - if ( CountSql($this->db,'select * from action_gestion where ag_ref_ag_id!=0 and ag_ref_ag_id='.$this->ag_id.' limit 5') >0 ) + if ( CountSql($this->db,'select * from action_gestion where ag_ref_ag_id!=0 and ag_ref_ag_id='.$this->ag_id. + " limit 2") > 0 ) $r.=$this->myList(ACTION," and ag_ref_ag_id=".$this->ag_id); return $r; @@ -281,7 +315,7 @@ class action { echo_debug('class_action',__LINE__,'Action::Get() '); $sql="select ag_id, ag_comment,to_char (ag_timestamp,'DD-MM-YYYY') as ag_timestamp,". - " f_id,ag_title,ag_comment,ag_ref,d_id,ag_type,d_state, ". + " f_id_dest,f_id_exp,ag_title,ag_comment,ag_ref,d_id,ag_type,d_state, ". " ag_ref_ag_id ". " from action_gestion left join document using (ag_id) where ag_id=".$this->ag_id; $r=ExecSql($this->db,$sql); @@ -289,7 +323,8 @@ class action if ( $row==false) return; $this->ag_comment=$row[0]['ag_comment']; $this->ag_timestamp=$row[0]['ag_timestamp']; - $this->f_id=$row[0]['f_id']; + $this->f_id_dest=$row[0]['f_id_dest']; + $this->f_id_exp=$row[0]['f_id_exp']; $this->ag_title=$row[0]['ag_title']; $this->ag_type=$row[0]['ag_type']; $this->ag_ref=$row[0]['ag_ref']; @@ -308,8 +343,11 @@ class action } echo_debug('class_action',__LINE__,' After test Document id = '.$this->d_id); $this->dt_id=$this->ag_type; - $a=new fiche($this->db,$this->f_id); - $this->qcode=$a->strAttribut(ATTR_DEF_QUICKCODE); + $adest=new fiche($this->db,$this->f_id_dest); + $this->qcode_dest=$adest->strAttribut(ATTR_DEF_QUICKCODE); + $aexp=new fiche($this->db,$this->f_id_exp); + $this->qcode_exp=$aexp->strAttribut(ATTR_DEF_QUICKCODE); + echo_debug('class_action',__LINE__,'Detail end () :'.var_export($_POST,true)); echo_debug('class_action',__LINE__,'Detail $this :'.var_export($this,true)); @@ -385,31 +423,47 @@ class action $h_agrefid=new widget('hidden'); - // f_id - if ( trim($this->qcode) =="" && $this->dt_id==1) - { - // internal document - $f_id=0; // internal document - $name="interne"; - } - elseif ( trim($this->qcode) !="" && $this->dt_id != 1 ) - { - $tiers=new fiche($this->db); - $tiers->GetByQCode($this->qcode); - $f_id=$tiers->id; - $name=$tiers->strAttribut(1); - } - else { - $name="ERROR"; - $f_id=-1; - } + // f_id + if ( trim($this->qcode_dest) =="") + { + // internal document + $this->f_id_dest=0; // internal document + $namedest="interne"; + } + else // ( trim($this->qcode_dest) !="" ) + { + $tiers=new fiche($this->db); + $tiers->GetByQCode($this->qcode_dest); + $this->f_id_dest=$tiers->id; + $namedest=$tiers->strAttribut(1); + if ( $namedest == '- ERROR -') $this->f_id_dest=-1; + } + + // f_id + if ( trim($this->qcode_exp) =="") + { + // internal document + $this->f_id_exp=0; // internal document + $nameexp="interne"; + } + else // ( trim($this->qcode_exp) !="" ) + { + $tiers=new fiche($this->db); + $tiers->GetByQCode($this->qcode_exp); + $this->f_id_exp=$tiers->id; + $nameexp=$tiers->strAttribut(1); + if ( $nameexp == '- ERROR -') $this->f_id_exp=-1; + } + + // Preparing the return string $r=$retour."