Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

fiche Class Reference

define Class fiche and fiche def, those class are using class attribut More...

Inheritance diagram for fiche:

Admin contact Customer Supplier

Public Member Functions

 fiche ($p_cn, $p_id=0)
 GetByQCode ($p_qcode, $p_all=true)
 Retrieve a card thx his quick_code complete the object.
 getAttribut ()
 get all the attribute of a card, add missing ones and sort the array ($this->attribut) by ad_id
 size ()
 give the size of a card object
 GetByType ($p_fd_id)
 Get all the card where the fiche_def.fd_id is given in parameter.
 CountByDef ($p_frd_id, $p_search="", $p_sql="")
 Return array of card from the frd family.
 GetByDef ($p_frd_id, $p_offset=-1, $p_search="")
 Return array of card from the frd family.
 ShowTable ()
 strAttribut ($p_ad_id)
 return the string of the given attribute (attr_def.ad_id)
 blank ($p_fiche_def)
 insert a new record show a blank card to be filled
 Display ($p_readonly)
 Display object instance, getAttribute sort the attribute and add missing ones.
 Save ($p_fiche_def=0)
 Save a card, call insert or update.
 insert ($p_fiche_def)
 insert a new record
 update ()
 update a card
 remove ()
 remove a card
 getName ()
 return the name of a card
 Get ()
 Synonum of fiche::getAttribut.
 GetAll ($p_offset=-1, $p_search="")
 get all the card thanks the fiche_def_ref

Data Fields

 $cn
 $id
 $fiche_def
 $attribut
 $fiche_def_ref

Detailed Description

define Class fiche and fiche def, those class are using class attribut

Definition at line 148 of file class_fiche.php.


Constructor & Destructor Documentation

fiche::fiche p_cn,
p_id = 0
 

Definition at line 155 of file class_fiche.php.

References $p_id.

Referenced by Admin::Admin(), contact::contact(), Customer::Customer(), GetByDef(), GetByType(), contact::Summary(), and Supplier::Supplier().

00155                                 {
00156     $this->cn=$p_cn;
00157     $this->id=$p_id;
00158   }


Member Function Documentation

fiche::blank p_fiche_def  ) 
 

insert a new record show a blank card to be filled

Parameters:
$p_fiche_def is the fiche_def.fd_id
Returns:
HTML Code

Definition at line 399 of file class_fiche.php.

References $a, $array, $label, $msg, $r, $ret_sql, $sql, $w, echo_debug(), ExecSql(), and table.

00400     {
00401       // array = array of attribute object sorted on ad_id
00402       $f=new fiche_def($this->cn,$p_fiche_def);
00403       $array=$f->getAttribut();
00404       $r='<table>';
00405       foreach ($array as $attr)
00406         {
00407           $msg="";
00408           if ( $attr->ad_id == ATTR_DEF_ACCOUNT) 
00409             {
00410               $r.=JS_SEARCH_POSTE;
00411               $w=new widget("js_search_poste");
00412               //  account created automatically
00413               $sql="select account_auto($p_fiche_def)";
00414               echo_debug("class_fiche",__LINE__,$sql);
00415               $ret_sql=ExecSql($this->cn,$sql);
00416               $a=pg_fetch_array($ret_sql,0);
00417               if ( $a['account_auto'] == 't' )
00418                 $msg="<TD> <font color=\"red\">Rappel: Poste créé automatiquement !</font></TD> ";
00419 
00420              }
00421           elseif ( $attr->ad_id == ATTR_DEF_TVA) 
00422             {
00423               $r.=JS_TVA;
00424               $w=new widget("js_tva");
00425             }
00426           elseif ( $attr->ad_id == ATTR_DEF_COMPANY )
00427             {
00428               $r.=JS_SEARCH_CARD;
00429               $w=new widget("js_search");
00430               // filter on frd_id
00431               $w->extra=FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX; 
00432               $w->extra2=0;      // jrn = 0
00433               $label=new widget("span");
00434               $label->name="av_text".$attr->ad_id."_label";
00435               $msg=$label->IOValue();
00436             }
00437           else
00438             {
00439               $w=new widget("text");
00440             }
00441           $w->table=1;
00442           $w->label=$attr->ad_text;
00443           $w->name="av_text".$attr->ad_id;
00444 
00445           $r.="<TR>".$w->IOValue()."$msg </TR>";
00446         }
00447       $r.= '</table>';
00448       return $r;
00449     }

fiche::CountByDef p_frd_id,
p_search = "",
p_sql = ""
 

Return array of card from the frd family.

Parameters:
the fiche_def_ref.frd_id
p_search is a filter on the name
p_sql extra sql condition
Returns:
array of fiche object

Definition at line 291 of file class_fiche.php.

References $a, $Ret, $sql, ExecSql(), and FormatString().

Referenced by Supplier::Summary(), Customer::Summary(), contact::Summary(), and Admin::Summary().

00291                                                         {
00292      $sql="select * 
00293            from
00294                fiche join fiche_Def using (fd_id)
00295             where frd_id=".$p_frd_id;
00296      if ( $p_search != "" ) 
00297        {
00298          $a=FormatString($p_search);
00299          $sql="select * from vw_fiche_attr where frd_id=".$p_frd_id.
00300            " and vw_name ~* '$p_search'";
00301        }
00302 
00303     $Ret=ExecSql($this->cn,$sql.$p_sql);
00304     
00305     return pg_NumRows($Ret) ;
00306   }

fiche::Display p_readonly  ) 
 

Display object instance, getAttribute sort the attribute and add missing ones.

Parameters:
$p_readonly true= if can not modify, otherwise false
Returns:
string to display

Definition at line 461 of file class_fiche.php.

References $a, $label, $msg, $r, $ret, $ret_sql, $sql, $w, echo_debug(), and ExecSql().

00462     {
00463       $this->GetAttribut();
00464       $attr=$this->attribut;
00465 
00466       $ret="<table>";
00467 
00468       foreach ( $attr as $r) 
00469         {
00470           $msg="";
00471           if ( $p_readonly) 
00472             {
00473               $w=new widget("text");
00474             }
00475           if ($p_readonly==false)
00476             {
00477               if ( $r->ad_id == ATTR_DEF_ACCOUNT) 
00478                 {
00479                   $ret.=JS_SEARCH_POSTE;
00480                   $w=new widget("js_search_poste");
00481                   //  account created automatically
00482                   $sql="select account_auto($this->fiche_def)";
00483                   echo_debug("class_fiche",__LINE__,$sql);
00484                   $ret_sql=ExecSql($this->cn,$sql);
00485                   $a=pg_fetch_array($ret_sql,0);
00486                   if ( $a['account_auto'] == 't' )
00487                     $msg="<TD> <font color=\"red\">si vide le Poste sera créer automatiquement</font></TD> ";
00488                 }
00489               elseif ( $r->ad_id == ATTR_DEF_TVA) 
00490                 {
00491                   $ret.=JS_TVA;
00492                   $w=new widget("js_tva");
00493             }
00494               elseif ( $r->ad_id == ATTR_DEF_COMPANY )
00495                 {
00496                   $ret.=JS_SEARCH_CARD;
00497                   $w=new widget("js_search");
00498                   // filter on frd_id
00499                   $w->extra=FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX; 
00500                   $w->extra2=0;      // jrn = 0
00501                   $label=new widget("span");
00502                   $label->name="av_text".$r->ad_id."_label";
00503                   $msg=$label->IOValue();
00504                 }
00505             
00506               else 
00507                 {
00508                   $w=new widget("text");
00509                 }
00510             }
00511           $w->label=$r->ad_text;
00512           $w->value=$r->av_text;
00513           $w->name="av_text".$r->ad_id;
00514           $w->readonly=$p_readonly;
00515           $w->table=1;
00516 
00517           $ret.="<TR>".$w->IOValue()."$msg </TR>";
00518         }
00519       $ret.="</table>";
00520       return $ret;
00521     }

fiche::Get  ) 
 

Synonum of fiche::getAttribut.

Definition at line 770 of file class_fiche.php.

References echo_debug(), and getAttribut().

00771      {
00772        echo_debug('class_client',__LINE__,'Get');
00773        fiche::getAttribut();
00774      }

fiche::GetAll p_offset = -1,
p_search = ""
 

get all the card thanks the fiche_def_ref

Parameters:
$p_offset (default =-1)
$p_search sql condition
Returns:
fiche::GetByDef

Definition at line 780 of file class_fiche.php.

References GetByDef().

Referenced by Supplier::Summary(), Customer::Summary(), contact::Summary(), and Admin::Summary().

00781      {
00782        return fiche::GetByDef($this->fiche_def_ref,$p_offset,$p_search);
00783     }

fiche::getAttribut  ) 
 

get all the attribute of a card, add missing ones and sort the array ($this->attribut) by ad_id

Definition at line 190 of file class_fiche.php.

References $e, $flag, $i, $Max, $Ret, $row, $sql, $t, ExecSql(), return, and SortAttributeById().

Referenced by Get(), and GetByQCode().

00190                          {
00191     if ( $this->id == 0){
00192       return;
00193     }
00194      $sql="select * 
00195            from jnt_fic_att_value 
00196                natural join fiche 
00197                natural join attr_value
00198                left join attr_def using (ad_id) where f_id=".$this->id.
00199        " order by ad_id";
00200 
00201     $Ret=ExecSql($this->cn,$sql);
00202     if ( ($Max=pg_NumRows($Ret)) == 0 )
00203       return ;
00204     for ($i=0;$i<$Max;$i++) {
00205       $row=pg_fetch_array($Ret,$i);
00206       $this->fiche_def=$row['fd_id'];
00207       $t=new Attribut ($row['ad_id']);
00208       $t->ad_text=$row['ad_text'];
00209       $t->av_text=$row['av_text'];
00210       $this->attribut[$i]=$t;
00211     }
00212     $e=new Fiche_def($this->cn,$this->fiche_def);
00213     $e->GetAttribut();
00214 
00215     if ( sizeof($this->attribut) != sizeof($e->attribut ) ) {
00216 
00217       // !!! Missing attribute
00218       foreach ($e->attribut as $f ) {
00219         $flag=0;
00220         foreach ($this->attribut as $g ) {
00221           if ( $g->ad_id == $f->ad_id ) 
00222             $flag=1;
00223         }
00224         if ( $flag == 0 ) { 
00225           // there's a missing one, we insert it
00226           $t=new Attribut ($f->ad_id);
00227           $t->av_text="";
00228           $t->ad_text=$f->ad_text;
00229           $this->attribut[$Max]=$t;
00230           $Max++;
00231         } // if flag == 0
00232 
00233       }// foreach 
00234       $this->attribut=SortAttributeById($this->attribut);
00235 
00236 
00237     }//missing attribut
00238   }

fiche::GetByDef p_frd_id,
p_offset = -1,
p_search = ""
 

Return array of card from the frd family.

Parameters:
the fiche_def_ref.frd_id
p_search is an optional filter
Returns:
array of fiche object

Definition at line 317 of file class_fiche.php.

References $_SESSION, $all, $i, $limit, $Ret, $row, $sql, $t, ExecSql(), f_id, fiche(), and return.

Referenced by GetAll().

00317                                                          {
00318     if ( $p_offset == -1 ) 
00319       {
00320         $sql="select * 
00321            from
00322                fiche join fiche_Def using (fd_id)
00323             where frd_id=".$p_frd_id." $p_search order by f_id";
00324       } 
00325     else 
00326       {
00327         $limit=$_SESSION['g_pagesize'];
00328         $sql="select * 
00329            from
00330                fiche join fiche_Def using (fd_id)
00331             where frd_id=".$p_frd_id." $p_search order by f_id
00332            limit ".$limit." offset ".$p_offset;
00333 
00334       }
00335 
00336     $Ret=ExecSql($this->cn,$sql);
00337     if ( ($Max=pg_NumRows($Ret)) == 0 )
00338       return ;
00339     $all[0]=new fiche($this->cn);
00340 
00341     for ($i=0;$i<$Max;$i++) {
00342       $row=pg_fetch_array($Ret,$i);
00343       $t=new fiche($this->cn,$row['f_id']);
00344       $t->getAttribut();
00345       $all[$i]=$t;
00346 
00347     }
00348     return $all;
00349   }

fiche::GetByQCode p_qcode,
p_all = true
 

Retrieve a card thx his quick_code complete the object.

GetByQCode($p_qcode)

Parameters:
$p_qcode quick_code (ad_id=23)
$p_all retrieve all the attribut of the card, possible value are true false
Returns:
0 success 1 error not found

Definition at line 167 of file class_fiche.php.

References $r, $Res, $sql, echo_debug(), ExecSql(), f_id, FormatString(), getAttribut(), and size().

00168     {
00169 
00170       $p_qcode=FormatString($p_qcode);
00171       $sql="select f_id from jnt_fic_att_value join attr_value 
00172            using (jft_id)  where ad_id=23 and av_text='".$p_qcode."'";
00173       $Res=ExecSql($this->cn,$sql);
00174       $r=pg_fetch_all($Res);
00175       echo_debug('fiche',__LINE__,'result:'.var_export($r,true).'size '.sizeof($r));
00176       if ( $r == null  ) 
00177         return 1;
00178       $this->id=$r[0]['f_id'];
00179       echo_debug('class_fiche',__LINE__,'f_id = '.$this->id);
00180 
00181       if ( $p_all )
00182         $this->getAttribut();
00183       return 0;
00184     }

fiche::GetByType p_fd_id  ) 
 

Get all the card where the fiche_def.fd_id is given in parameter.

Parameters:
$p_fd_id = fiche_def.fd_id
Returns:
double array (f_id,fd_id)

Definition at line 260 of file class_fiche.php.

References $all, $i, $Ret, $row, $sql, $t, ExecSql(), f_id, fiche(), and return.

00260                                {
00261      $sql="select * 
00262            from
00263                fiche 
00264             where fd_id=".$p_fd_id;
00265 
00266 
00267     $Ret=ExecSql($this->cn,$sql);
00268     if ( ($Max=pg_NumRows($Ret)) == 0 )
00269       return ;
00270     $all[0]=new fiche($this->cn);
00271 
00272     for ($i=0;$i<$Max;$i++) {
00273       $row=pg_fetch_array($Ret,$i);
00274       $t=new fiche($this->cn,$row['f_id']);
00275       $t->getAttribut();
00276       $all[$i]=$t;
00277 
00278     }
00279     return $all;
00280   }

fiche::getName  ) 
 

return the name of a card

Definition at line 758 of file class_fiche.php.

References $r, $Res, $sql, and ExecSql().

00759      {
00760        $sql="select av_text from jnt_fic_att_value join attr_value 
00761             using (jft_id)  where ad_id=1 and f_id=".$this->id;
00762        $Res=ExecSql($this->cn,$sql);
00763        $r=pg_fetch_all($Res);
00764        if ( sizeof($r) == 0 ) 
00765          return 1;
00766        return $r[0]['av_text'];
00767      }

fiche::insert p_fiche_def  ) 
 

insert a new record

Parameters:
p_fiche_def fiche_def.fd_id

Definition at line 542 of file class_fiche.php.

References $fiche_id, $Ret, $sql, Commit(), CountSql(), echo_debug(), ExecSql(), FormatString(), isNumber(), name, NextSequence(), StartSql(), and value.

Referenced by Save().

00543     {
00544       $fiche_id=NextSequence($this->cn,'s_fiche');
00545       $this->id=$fiche_id;
00546       // first we create the card
00547       StartSql($this->cn);
00548       $sql=sprintf("insert into fiche(f_id,fd_id)". 
00549                    " values (%d,%d)",
00550                    $fiche_id,$p_fiche_def);
00551       $Ret=ExecSql($this->cn,$sql);
00552       // parse the $_POST array
00553       foreach ($_POST as $name=>$value ) 
00554         {
00555           echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ;
00556           list ($id) = sscanf ($name,"av_text%d");
00557           if ( $id == null ) continue;
00558           echo_debug("class_fiche",__LINE__,"add $id");
00559           
00560           // Special traitement
00561           // quickcode
00562           if ( $id == ATTR_DEF_QUICKCODE) 
00563             {
00564               echo_debug("Modify ATTR_DEF_QUICKCODE");
00565               $sql=sprintf("select insert_quick_code(%d,'%s')",
00566                            $fiche_id,FormatString($value));
00567               ExecSql($this->cn,$sql);
00568               continue;
00569             }
00570           // name
00571           if ( $id == ATTR_DEF_NAME ) 
00572             {
00573               echo_debug("Modify ATTR_DEF_NAME");
00574               if ( strlen(trim($value)) == 0 )
00575                 $value="pas de nom";
00576               
00577             }
00578           // account
00579           if ( $id == ATTR_DEF_ACCOUNT ) 
00580             {
00581               echo_debug("Modify ATTR_DEF_ACCOUNT");
00582               $v=FormatString($value);
00583               if ( isNumber($v) == 1 )
00584                 {
00585                   $sql=sprintf("select account_insert(%d,%d)",
00586                                $this->id,$v);
00587                   $Ret=ExecSql($this->cn,$sql);
00588                 }
00589               if ( strlen(trim($v))==0  )
00590                 {
00591                   $sql=sprintf("select account_insert(%d,null)",
00592                                $this->id);
00593                   $Ret=ExecSql($this->cn,$sql);
00594                 }
00595               
00596               continue;
00597             }
00598         // TVA
00599           if ( $id == ATTR_DEF_TVA ) 
00600             {
00601               echo_debug("Modify ATTR_DEF_TVA");
00602               // Verify if the rate exists, if not then do not update
00603               if ( strlen(trim($value)) != 0 ) 
00604                 {
00605                   if ( CountSql($this->cn,"select * from tva_rate where tva_id=".$value) == 0) 
00606                     {
00607                       echo_debug("class_fiche",__LINE__,"Tva invalide $value");
00608                       continue;
00609                     }
00610                 }
00611             }
00612           // The contact has a company attribut
00613           if ( $id == ATTR_DEF_COMPANY ) 
00614             {
00615               $exist=CountSql($this->cn,"select f_id from fiche join fiche_def using (fd_id) ".
00616                               " join jnt_fic_att_value using (f_id) join attr_value using (jft_id) ".
00617                               " where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
00618                               " and av_text='".FormatString($value)."'");
00619               if ( $exist == 0 ) 
00620                 {
00621                   $value="Attention : pas de société  ";
00622                 }
00623             }
00624           // Normal traitement
00625           $value2=FormatString($value);
00626 
00627           $sql=sprintf("select attribut_insert(%d,%d,'%s')",
00628                        $fiche_id,$id,$value2);
00629           ExecSql($this->cn,$sql);
00630         }
00631       Commit($this->cn);
00632       return;
00633       
00634 
00635     }

fiche::remove  ) 
 

remove a card

Definition at line 738 of file class_fiche.php.

References $Res, $sql, and ExecSql().

00739      {
00740        if ( $this->id==0 ) return;
00741        // verify if that card has not been used is a ledger
00742        $sql="select fiche_used(".$this->id.") as result";
00743        $Res=ExecSql($this->cn,$sql);
00744        
00745        // fetch the result
00746        list($result)=pg_fetch_row($Res,0);
00747  
00748        if ( $result == 0 ) 
00749          {
00750            $sql="select fiche_delete (".$this->id.")";
00751            $Res=ExecSql($this->cn,$sql);
00752            return 0;
00753          }
00754        return 1;
00755      }

fiche::Save p_fiche_def = 0  ) 
 

Save a card, call insert or update.

Parameters:
p_fiche_def (default 0)

Definition at line 528 of file class_fiche.php.

References insert(), and update().

00529     {
00530       // new card or only a update ?
00531       if ( $this->id == 0 ) 
00532         $this->insert($p_fiche_def);
00533       else
00534         $this->update();
00535     }

fiche::ShowTable  ) 
 

Definition at line 350 of file class_fiche.php.

00350                        {
00351     echo "<TR><TD> ".
00352       $this->id."</TD>".
00353       "<TR> <TD>".
00354       $this->attribut_value."</TD>".
00355       "<TR> <TD>".
00356       $this->attribut_def."</TD></TR>";
00357   }

fiche::size  ) 
 

give the size of a card object

Returns:
size

Definition at line 246 of file class_fiche.php.

Referenced by GetByQCode().

00246                   {
00247     if ( isset ($this->ad_id))
00248       return sizeof($this->ad_id);
00249     else
00250       return 0;
00251   }

fiche::strAttribut p_ad_id  ) 
 

return the string of the given attribute (attr_def.ad_id)

Parameters:
the AD_ID from attr_def.ad_id
See also:
constant.php
Returns:
string

Definition at line 366 of file class_fiche.php.

References $e, $Res, $row, $sql, and ExecSql().

00367     {
00368       if ( sizeof ($this->attribut) == 0 ) 
00369         {
00370           if ($this->id==0) return '- ERROR -';
00371           // object is not in memory we need to look into the database
00372           $sql="select av_text from attr_value join jnt_fic_att_value using(jft_id)
00373                 where f_id=".FormatString($this->id)." and ad_id=".$p_ad_id;
00374           $Res=ExecSql($this->cn,$sql);
00375           $row=pg_fetch_all($Res);
00376           // if not found return error
00377           if ( $row == false ) 
00378             return ' - ERROR -';
00379           
00380           return $row[0]['av_text'];
00381         }
00382 
00383       foreach ($this->attribut as $e)
00384         {
00385           if ( $e->ad_id == $p_ad_id ) 
00386             return $e->av_text;
00387         }
00388         return '- ERROR -';
00389     }

fiche::update  ) 
 

update a card

Todo:
add a check to return an error and rollback operation

Definition at line 642 of file class_fiche.php.

References $Ret, $sql, $tmp, CountSql(), echo_debug(), echo_error(), ExecSql(), FormatString(), isNumber(), name, and value.

Referenced by Save().

00643      {
00644        // parse the $_POST array
00645        foreach ($_POST as $name=>$value ) 
00646          {
00647            echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ;
00648            list ($id) = sscanf ($name,"av_text%d");
00649            if ( $id == null ) continue;
00650            echo_debug("class_fiche",__LINE__,"modify $id");
00651            
00652            // retrieve jft_id to update table attr_value
00653            $sql=" select jft_id from jnt_fic_att_value where ad_id=$id and f_id=$this->id";
00654            $Ret=ExecSql($this->cn,$sql);
00655            if ( pg_NumRows($Ret) != 1 ) {
00656              echo_error ("class_fiche ".__LINE__." INVALID ID !!! ");
00657              return;
00658            }
00659            $tmp=pg_fetch_array($Ret,0);
00660            $jft_id=$tmp['jft_id'];
00661            
00662            // Special traitement
00663            // quickcode
00664            if ( $id == ATTR_DEF_QUICKCODE) 
00665              {
00666                echo_debug("Modify ATTR_DEF_QUICKCODE");
00667                $sql=sprintf("select update_quick_code(%d,'%s')",
00668                             $jft_id,FormatString($value));
00669                ExecSql($this->cn,$sql);
00670                continue;
00671              }
00672            // name
00673            if ( $id == ATTR_DEF_NAME ) 
00674              {
00675                echo_debug("Modify ATTR_DEF_NAME");
00676                if ( strlen(trim($value)) == 0 )
00677                  continue;
00678                
00679              }
00680            // account
00681            if ( $id == ATTR_DEF_ACCOUNT ) 
00682              {
00683                echo_debug("Modify ATTR_DEF_ACCOUNT");
00684                $v=FormatString($value);
00685                if ( isNumber($v) == 1 )
00686                  {
00687                    $sql=sprintf("select account_update(%d,%d)",
00688                                 $this->id,$v);
00689                    $Ret=ExecSql($this->cn,$sql);
00690                  }
00691                if ( strlen (trim($v)) == 0 ) 
00692                  {
00693                    $sql=sprintf("select account_update(%d,null)",
00694                                 $this->id);
00695                    $Ret=ExecSql($this->cn,$sql);
00696                    continue;
00697                  }
00698              }
00699          // TVA
00700            if ( $id == ATTR_DEF_TVA ) 
00701              {
00702                echo_debug("Modify ATTR_DEF_TVA");
00703                // Verify if the rate exists, if not then do not update
00704                if ( strlen(trim($value)) != 0 ) 
00705                  {
00706                    if ( CountSql($this->cn,"select * from tva_rate where tva_id=".$value) == 0) 
00707                      {
00708                        echo_debug("class_fiche",__LINE__,"Tva invalide $value");
00709                        continue;
00710                      }
00711                  }
00712              }
00713            if ( $id == ATTR_DEF_COMPANY ) 
00714              {
00715                $exist=CountSql($this->cn,"select f_id from fiche join fiche_def using (fd_id) ".
00716                                " join jnt_fic_att_value using (f_id) join attr_value using (jft_id) ".
00717                                " where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
00718                                " and av_text='".FormatString($value)."'");
00719  
00720  
00721                if ( $exist == 0 ) 
00722                  {
00723                    $value="Attention : pas de société ";
00724                  }
00725              }
00726            
00727            // Normal traitement
00728            $value2=FormatString($value);
00729            $sql=sprintf("update attr_value set av_text='%s' where jft_id=%d",
00730                         $value2,$jft_id);
00731            ExecSql($this->cn,$sql);
00732          }
00733        return;
00734        
00735      }


Field Documentation

fiche::$attribut
 

array of attribut object

Definition at line 152 of file class_fiche.php.

fiche::$cn
 

database connection

Definition at line 149 of file class_fiche.php.

fiche::$fiche_def
 

fd_id

Definition at line 151 of file class_fiche.php.

fiche::$fiche_def_ref
 

Type of the card here always FICHE_TYPE_CONTACT

Definition at line 153 of file class_fiche.php.

fiche::$id
 

fiche.f_id

Definition at line 150 of file class_fiche.php.


The documentation for this class was generated from the following file: