Sender & receiver in the Document module

This commit is contained in:
sparkyx 2006-06-29 20:53:58 +00:00
parent 04aab79137
commit e15146919f
3 changed files with 195 additions and 86 deletions

View file

@ -49,16 +49,15 @@ function ShowActionList($cn,$retour,$h_url)
$qcode=(isset($_GET['qcode']))?$_GET['qcode']:"";
echo JS_SEARCH_CARD;
$w=new widget('js_search_only');
$w->name='qcode';
$w->name='qcode_query';
$w->value=$qcode;
$w->label='Quick Code';
$w->extra='4,9,14,16,8';
$w->table=0;
$sp= new widget("span");
echo $sp->IOValue("qcode_label","",$qcode);
echo $sp->IOValue("qcode_query_label","",$qcode);
echo $w->IOValue();
?>
<input type="submit" name="submit_query" value="recherche">
<input type="hidden" name="sa" value="list">
@ -72,7 +71,7 @@ function ShowActionList($cn,$retour,$h_url)
<input type="submit" name="submit_query" value="Ajout Action">
<input type="hidden" name="p_action" value="suivi_courrier">
<input type="hidden" name="sa" value="add_action">
<input type="hidden" name="tiers" value=<? echo '"'.$qcode.'"';?>>
<!-- <input type="hidden" name="qcode_dest" value=<? echo '"'.$qcode_dest.'"';?> -->
<? // if called from another menu, url is set
echo $h_url;
echo $retour; ?>
@ -97,16 +96,18 @@ function ShowActionList($cn,$retour,$h_url)
}
$str="";
if ( isset($_GET['qcode'] ))
if ( isset($_GET['qcode_query'] ))
{
// verify that qcode is not empty
if ( strlen(trim($_REQUEST['qcode'] )) != 0 )
if ( strlen(trim($_REQUEST['qcode_query'] )) != 0 )
{
$fiche=new Fiche($cn);
$fiche->GetByQCode($_REQUEST['qcode']);
$str=" and f_id= ".$fiche->id;
$fiche->GetByQCode($_REQUEST['qcode_query']);
$str=" and (f_id_exp= ".$fiche->id." or ".
"f_id_dest=".$fiche->id.")";
}
}
@ -157,7 +158,8 @@ if ( $sub_action=="update" )
$act->ag_timestamp=$_POST['ag_timestamp'];
$act->d_state=$_POST['d_state'];
$act->dt_id=(isset($_POST['dt_id']))?$_POST['dt_id']:0;
$act->qcode=$_POST['qcode'];
$act->qcode_exp=$_POST['qcode_exp'];
$act->qcode_dest=$_POST['qcode_dest'];
$act->ag_title=$_POST['ag_title'];
$act->d_id=(isset($_POST['d_id']))?$_POST['d_id']:0;
if ( $act->Update() == false ) {
@ -180,9 +182,15 @@ if ( isset ($_POST['add_action_here']) )
// puis comme ajout normal (copier / coller )
echo $retour;
$act->ag_id=0;
$act->qcode_dest=(isset($_POST['qcode_dest']))?$_REQUEST['qcode_dest']:"";
$act->qcode_exp=(isset($_POST['qcode_exp']))?$_REQUEST['qcode_exp']:"";
$act->f_id_dest=(isset($_POST['f_id_dest']))?$_POST['f_id_dest']:0;
$act->f_id_exp=(isset($_POST['f_id_exp']))?$_POST['f_id_exp']:0;
$act->ag_ref_ag_id=$_POST['ag_id'];
$act->ag_timestamp=(isset($_POST['ag_timestamp']))?$_POST['ag_timestamp']:"";
$act->qcode=isset($_POST['tiers'])?$_REQUEST['tiers']:"";
$act->qcode_dest=isset($_POST['qcode_dest'])?$_REQUEST['qcode_dest']:"";
$act->qcode_exp=isset($_POST['qcode_exp'])?$_REQUEST['qcode_exp']:"";
$act->d_id=0;
$act->dt_id=isset($_POST['dt_id'])?$_REQUEST['dt_id']:"";
$act->d_state=(isset($_POST['d_state']))?$_POST['d_state']:"";
@ -194,6 +202,7 @@ if ( isset ($_POST['add_action_here']) )
echo '<form name="RTEDemo" action="commercial.php?p_action=suivi_courrier" method="post" onsubmit="return submitForm();">';
$act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):"";
echo_debug("action.inc",__LINE__,"call display");
echo $act->Display('NEW',false);
echo '<input type="hidden" name="p_action" value="suivi_courrier">';
@ -243,12 +252,16 @@ if ( $sub_action == "list" )
// Add an action
if ( $sub_action == "add_action" )
{
echo_debug('action',__LINE__,var_export($_POST,true));
echo $retour;
$act=new action($cn);
$act->ag_id=0;
$act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:"0";
$act->ag_timestamp=(isset($_POST['ag_timestamp']))?$_POST['ag_timestamp']:"";
$act->qcode=isset($_POST['tiers'])?$_REQUEST['tiers']:"";
$act->qcode_dest=(isset($_POST['qcode_dest']))?$_REQUEST['qcode_dest']:"";
$act->qcode_exp=(isset($_POST['qcode_exp']))?$_REQUEST['qcode_exp']:"";
$act->f_id_dest=(isset($_POST['f_id_dest']))?$_POST['f_id_dest']:0;
$act->f_id_exp=(isset($_POST['f_id_exp']))?$_POST['f_id_exp']:0;
$act->d_id=0;
$act->dt_id=isset($_POST['dt_id'])?$_REQUEST['dt_id']:"";
$act->d_state=(isset($_POST['d_state']))?$_POST['d_state']:"";
@ -260,6 +273,7 @@ if ( $sub_action == "add_action" )
echo '<form name="RTEDemo" action="commercial.php?p_action=suivi_courrier" method="post" onsubmit="return submitForm();">';
$act->ag_comment=(isset($_POST['ag_comment']))?Decode($_POST['ag_comment']):"";
echo_debug("action.inc",__LINE__,"call display");
echo $act->Display('NEW',false);
echo '<input type="hidden" name="p_action" value="suivi_courrier">';
@ -283,7 +297,11 @@ if ( $sub_action == "save_action_st1" )
$act->ag_timestamp=$_POST['ag_timestamp'];
$act->d_state=$_POST['d_state'];
$act->dt_id=$_POST['dt_id'];
$act->qcode=$_POST['qcode'];
$act->qcode_exp=$_POST['qcode_exp'];
$act->qcode_dest=$_POST['qcode_dest'];
$act->f_id_dest=$_POST['f_id_dest'];
$act->f_id_exp=$_POST['f_id_exp'];
$act->ag_title=$_POST['ag_title'];
$act->d_id=0;
$act->ag_id=$_POST['ag_id'];
@ -303,7 +321,11 @@ if ( $sub_action == "save_action_st2" )
$act->ag_timestamp=$_POST['ag_timestamp'];
$act->d_state=$_POST['d_state'];
$act->dt_id=$_POST['dt_id'];
$act->qcode=$_POST['tiers'];
$act->qcode_dest=$_POST['qcode_dest'];
$act->qcode_exp=$_POST['qcode_exp'];
$act->f_id_dest=$_POST['f_id_dest'];
$act->f_id_exp=$_POST['f_id_exp'];
$act->ag_title=$_POST['ag_title'];
$act->d_id=0;
$act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;
@ -329,7 +351,9 @@ if ( $sub_action == "save_action_st3" )
$act->ag_timestamp=$_POST['ag_timestamp'];
$act->d_state=$_POST['d_state'];
$act->dt_id=$_POST['dt_id'];
$act->qcode=$_POST['qcode'];
$act->qcode_dest=$_POST['qcode_dest'];
$act->qcode_exp=$_POST['qcode_exp'];
$act->ag_title=$_POST['ag_title'];
$d_id=(isset($_POST['d_id']))?$_POST['d_id']:0;
$act->ag_ref_ag_id=(isset($_POST['ag_ref_ag_id']))?$_POST['ag_ref_ag_id']:0;

View file

@ -54,8 +54,10 @@ class action
* \enum $d_filename filename's document
* \enum $d_mimetype document's filename
* \enum $ag_title title document
* \enum $f_id fiche id
* \enum $f_id_dest fiche id (From field )
* \enum $f_id_exp fiche id (to field)
* \enum $ag_ref_ag_id concern previous action
* \todo replace attribut from class document document by an object document
*/
var $db;
@ -119,7 +121,7 @@ class action
}
else
{
exit('class_action'.__LINE__.'action::Display error unknown parameter'.$p_view);
exit('class_action'.__LINE__.'Action::Display error unknown parameter'.$p_view);
}
// Compute the widget
@ -207,35 +209,58 @@ class action
$ag_ref->value=FormatString($this->ag_ref);
$client_label=new widget("span");
// f_id
if ( $this->qcode != '- ERROR -' && trim($this->qcode) != "")
// f_id_dest destination
if ( $this->qcode_dest != '- ERROR -' && strlen(trim($this->qcode_dest)) != 0)
{
$tiers=new fiche($this->db);
$tiers->GetByQCode($this->qcode);
$qcode_label=$tiers->strAttribut(1);
$tiers->GetByQCode($this->qcode_dest);
$qcode_dest_label=$tiers->strAttribut(1);
} else {
echo "f_id $this->f_id";
$qcode_label=($this->f_id==0 || trim($this->qcode)=="")?'Interne ':'Error';
// echo "f_id $this->f_id";
$qcode_dest_label=($this->f_id_dest==0 || trim($this->qcode_dest)=="")?'Interne ':'Error';
}
// f_id_exp sender
if ( $this->qcode_exp != '- ERROR -' && strlen(trim($this->qcode_exp)) != 0)
{
$tiers=new fiche($this->db);
$tiers->GetByQCode($this->qcode_exp);
$qcode_exp_label=$tiers->strAttribut(1);
} else {
$qcode_exp_label=($this->f_id_exp==0 || trim($this->qcode_exp)=="")?'Interne ':'Error';
}
$h_ag_id=new widget("hidden");
// if concerns another action : show the link otherwise nothing
$lag_ref_ag_id="";
if ( $this->ag_ref_ag_id != 0 )
{
// $this->GetAgRef("ag_ref_ag_id")."</A>";
$lag_ref_ag_id='<a class="mtitle" href="commercial.php?p_action=suivi_courrier&sa=detail&ag_id='.
$this->ag_ref_ag_id.'">'.
$this->GetAgRef("ag_ref_ag_id")."</A>";
getDbValue($this->db,"select ag_ref from action_gestion where ag_id=".$this->ag_ref_ag_id).
"</A>";
}
// sender
$w=new widget('js_search_only');
$w->readonly=$readonly;
$w->name='qcode';
$w->value=($this->f_id != 0)?$this->qcode:"";
$w->name='qcode_exp';
$w->value=($this->f_id_exp != 0)?$this->qcode_exp:"";
$w->label="";
$w->extra='4,8,9,14,16';
$sp= new widget("span");
$h_agrefid=new widget('hidden');
// destination
$wdest=new widget('js_search_only');
$wdest->readonly=$readonly;
$wdest->name='qcode_dest';
$wdest->value=($this->f_id_dest != 0)?$this->qcode_dest:"";
$wdest->label="";
$wdest->extra='4,8,9,14,16';
$spdest= new widget("span");
$h_agrefid=new widget('hidden');
// Preparing the return string
$r="";
@ -252,7 +277,11 @@ class action
$r.= "</p><p> ";
$r.=$w->IOValue();
$r.=$sp->IOValue('qcode_label',$qcode_label)."</TD></TR>";
$r.=$sp->IOValue('qcode_exp_label',$qcode_exp_label)."</TD></TR>";
$r.=$wdest->IOValue();
$r.=$spdest->IOValue('qcode_dest_label',$qcode_dest_label)."</TD></TR>";
$r.="</p>";
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.="</p>";
// 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."<form method=\"post\">";
$r.="<p>Date : ".$date->IOValue()."</p>";
$r.="<p>Etat $str_state".$state->IOValue()."</p>";
$r.="<p>Type du document $str_type".$doc_type->IOValue()."</p>";
$r.="<p> Tiers : ".$this->qcode." ".$name.'</p>';
$r.="<p> Expediteur : ".$this->qcode_exp." ".$nameexp.'</p>';
$r.="<p> Destinataire : ".$this->qcode_dest." ".$namedest.'</p>';
$r.="<p> Titre : ".$title->IOValue();
$r.="<p>Description :".$desc->IOValue()."</p>";
@ -421,13 +475,18 @@ class action
// Add the hidden tag
$r.='<input type="hidden" name="sa" value="save_action_st2">';
$r.='<input type="hidden" name="p_action" value="suivi_courrier">';
$r.='<input type="hidden" name="tiers" value="'.$this->qcode.'">';
$r.='<input type="hidden" name="f_id_dest" value="'.$this->f_id_dest.'">';
$r.='<input type="hidden" name="f_id_exp" value="'.$this->f_id_exp.'">';
$r.='<input type="hidden" name="qcode_dest" value="'.$this->qcode_dest.'">';
$r.='<input type="hidden" name="qcode_exp" value="'.$this->qcode_exp.'">';
$r.= $h_agrefid->IOValue("ag_ref_ag_id",$this->ag_ref_ag_id);
// retrieve customer
if ( $f_id != -1 )
if ( $this->f_id_dest != -1 && $this->f_id_exp !=-1 )
$r.=$desc->Submit("Save","Sauve");
$r.=$desc->Submit("corr","Corrige");
@ -450,9 +509,14 @@ class action
$seq_name="seq_doc_type_".$this->dt_id;
$str_file="";
$add_file='';
// f_id
// f_id dest
$tiers=new fiche($this->db);
$tiers->GetByQCode($this->qcode);
$tiers->GetByQCode($this->qcode_dest);
// f_id exp
$exp=new fiche($this->db);
$exp->GetByQCode($this->qcode_exp);
if ( trim($this->ag_title) == "")
{
$doc_mod=new document_type($this->db);
@ -468,18 +532,18 @@ class action
/*!\brief the ag_comment is already urlencoded
*/
//we remove newline
$this->ag_comment=str_replace("+%OA+","",$this->ag_comment);
$this->ag_comment=str_replace("+%OD+","",$this->ag_comment);
$this->ag_comment=str_replace("%OD","",$this->ag_comment);
$this->ag_comment=str_replace("%OA","",$this->ag_comment);
// save into the database
$sql=sprintf("insert into action_gestion(ag_id,ag_timestamp,ag_type,ag_title,f_id,ag_comment,ag_ref,ag_ref_ag_id) ".
" values (%d,to_date('%s','DD-MM-YYYY'),'%d','%s',%d,'%s','%s',%d)",
$sql=sprintf("insert into action_gestion".
"(ag_id,ag_timestamp,ag_type,ag_title,f_id_dest,f_id_exp,ag_comment,ag_ref,ag_ref_ag_id) ".
" values (%d,to_date('%s','DD-MM-YYYY'),'%d','%s',%d,%d,'%s','%s',%d)",
$this->ag_id,
$this->ag_timestamp,
$this->dt_id,
FormatString($this->ag_title),
$tiers->id,
$exp->id,
$this->ag_comment,
$ref,
$this->ag_ref_ag_id
@ -503,6 +567,7 @@ class action
// readonly and upload of a file
$r.="<hr>";
$r.='<form enctype="multipart/form-data" method="post">';
echo_debug("class_action",__LINE__,"call display");
$r.=$this->Display('READ',false);
// Add the hidden tag
$r.='<input type="hidden" name="sa" value="save_action_st3">';
@ -572,7 +637,8 @@ class action
function myList($p_filter="",$p_search="")
{
$sql="
select ag_id,to_char(ag_timestamp,'DD-MM-YYYY') as my_date,ag_ref_ag_id,f_id,ag_title,d_id,md_type,dt_value,ag_ref
select ag_id,to_char(ag_timestamp,'DD-MM-YYYY') as my_date,ag_ref_ag_id,f_id_dest,f_id_exp".
",ag_title,d_id,md_type,dt_value,ag_ref
from action_gestion
left outer join document using (ag_id)
left outer join document_modele on (ag_type=md_type)
@ -593,7 +659,8 @@ class action
$r.="<table>";
$r.="<tr>";
$r.="<th>Date</th>";
$r.="<th>Société</th>";
$r.="<th>Destinataire</th>";
$r.="<th>Expéditeur</th>";
$r.="<th>Titre</th>";
$r.="<th>type</th>";
$r.="<th>Référence</th>";
@ -613,18 +680,34 @@ class action
echo JS_SEARCH_CARD;
foreach ($a_row as $row )
{
$f=new fiche($this->db);
$f->id=$row['f_id'];
$qcode=$f->strAttribut(ATTR_DEF_QUICKCODE);
$r.="<tr>";
$r.="<td>".$row['my_date']."</td>";
$q=($qcode=="- ERROR -")?"Interne":$qcode;
$js=sprintf("javascript:showfiche('%s','%s')",
$_REQUEST['PHPSESSID'],$q);
if ( $q != 'Interne' )
// Expediteur
$fexp=new fiche($this->db);
$fexp->id=$row['f_id_exp'];
$qcode_exp=$fexp->strAttribut(ATTR_DEF_QUICKCODE);
$qexp=($qcode_exp=="- ERROR -")?"Interne":$qcode_exp;
$jsexp=sprintf("javascript:showfiche('%s','%s')",
$_REQUEST['PHPSESSID'],$qexp);
if ( $qexp != 'Interne' )
{
$r.="<td>".'<A HREF="'.$js.'">'.$q." : ".$f->getName().'</A></td>';
$r.="<td>".'<A HREF="'.$jsexp.'">'.$qexp." : ".$fexp->getName().'</A></td>';
}
else
$r.="<td>Interne </td>";
// Destinataire
$fdest=new fiche($this->db);
$fdest->id=$row['f_id_dest'];
$qcode_dest=$fdest->strAttribut(ATTR_DEF_QUICKCODE);
$qdest=($qcode_dest=="- ERROR -")?"Interne":$qcode_dest;
$jsdest=sprintf("javascript:showfiche('%s','%s')",
$_REQUEST['PHPSESSID'],$qdest);
if ( $qdest != 'Interne' )
{
$r.="<td>".'<A HREF="'.$jsdest.'">'.$qdest." : ".$fdest->getName().'</A></td>';
}
else
$r.="<td>Interne </td>";
@ -711,14 +794,16 @@ class action
" ag_timestamp=to_date('%s','DD.MM.YYYY'),".
" ag_title='%s',".
" ag_type=%d, ".
" f_id=%d, ".
" f_id_exp=%d, ".
" f_id_dest=%d, ".
" ag_ref_ag_id=%d".
" where ag_id = %d",
$this->ag_comment,
$this->ag_timestamp,
FormatString($this->ag_title),
$this->dt_id,
$this->f_id,
$this->f_id_exp,
$this->f_id_dest,
$this->ag_ref_ag_id,
$this->ag_id);
ExecSql($this->db,$sql);
@ -747,14 +832,14 @@ class action
* \param $p_method : can be ag_ref_ag_id or ag_id
* \return string with the ag_ref
*/
function GetAgRef($p_method)
{
if ($p_method=="ag_ref_ag_id")
$sql="select ag_ref from action_gestion where ag_id=".$this->ag_ref_ag_id;
elseif ($p_method=="ag_id")
$sql="select ag_ref from action_gestion where ag_id=".$this->ag_id;
return Getdbvalue($this->db,$sql);
// function GetAgRef($p_method)
// {
// if ($p_method=="ag_ref_ag_id")
// $sql="select ag_ref from action_gestion where ag_id=".$this->ag_ref_ag_id;
// elseif ($p_method=="ag_id")
// $sql="select ag_ref from action_gestion where ag_id=".$this->ag_id;
// return Getdbvalue($this->db,$sql);
}
// }
}

View file

@ -482,7 +482,7 @@ class Document
*/
case 'SOLDE':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->Getbyqcode($qcode,false);
$p=$tiers->strAttribut(ATTR_DEF_ACCOUNT);
$poste=new Poste($this->db,$p);
@ -490,34 +490,34 @@ class Document
break;
case 'CUST_NAME':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->getByQcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_NAME);
break;
case 'CUST_ADDR_1':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->getByQcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_ADRESS);
break ;
case 'CUST_CP':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->getByQcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_CP);
break;
case 'CUST_CO':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->getByQcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_PAYS);
break;
case 'CUST_VAT':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['tiers'])?$_REQUEST['tiers']:$_REQUEST['e_client'];
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->getByQcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_NUMTVA);
break;