post('ad_id'); $ad_text=$http->post('desc'); $ad_type=$http->post('type'); $ad_size=$http->post('size'); $ad_extra=$http->post('extra'); $cn->start(); for ($e=0;$eset_parameter('id',$ad_id[$e]); $fa->set_parameter('desc',$ad_text[$e]); $fa->set_parameter('type',$ad_type[$e]); $fa->set_parameter('size',$ad_size[$e]); $fa->set_parameter('extra',$ad_extra[$e]); if ( trim($ad_text[$e])!='' && trim($ad_type[$e])!='') $fa->save(); } $cn->commit(); } catch (Exception $e) { record_log($e->getTraceAsString()); alert($e->getMessage()); $cn->rollback(); } } /* show list of existing */ $gDossier=dossier::id(); $array=$fa->seek(); $select_type=new ISelect('type[]'); $select_type->table=0; $desc=new IText('desc[]'); $desc->size=50; $size=new INum('size[]'); $size->size=5; $extra=new IText('extra[]'); $select_type->value=array( array('value'=>'text','label'=>_('Texte')), array('value'=>'numeric','label'=>_('Nombre')), array('value'=>'date','label'=>_('Date')), array('value'=>'zone','label'=>_('Zone de texte')), array('value'=>'poste','label'=>_('Poste Comptable')), array('value'=>'card','label'=>_('Fiche')), array('value'=>'select','label'=>_('Selection')) ); echo '
'; echo '
'; echo HtmlInput::hidden('sa','fat'); echo HtmlInput::hidden('p_action','divers'); echo ''; echo ''; echo th(_("id")); echo th(_("Description")); echo th(_("Type")); echo th(_("Taille")); echo th(_("Paramètre")); echo ''; for ($e=0;$eget_parameter('id')).$row->get_parameter('id')); $select_type->selected=$row->get_parameter('type'); $desc->value=$row->get_parameter('desc'); $size->value=$row->get_parameter('size'); $extra->value=$row->get_parameter('extra'); $remove=new IButton('rmfa'.$e); $remove->label=_('Effacer'); if ( $row->get_parameter('id')>= 9000) { $select_type->readOnly=false; $desc->readOnly=false; $size->readOnly=false; $extra->readOnly=false; $desc->style=' class="input_text" '; $r.=td($desc->input()); $r.=td($select_type->input()); $r.=td($size->input()); $r.=td($extra->input()); $remove->javascript=sprintf('confirm_box(\'tb_rmfa\',\'Vous confirmez ?\',function() { removeCardAttribut(%d,%d,\'tb_rmfa\',$(\'rmfa%d\') );})', $row->get_parameter('id'),$gDossier,$e); $msg=''._("Attention : effacera les données qui y sont liées").' '; $r.=td($remove->input().$msg); } else { $select_type->readOnly=true; $desc->readOnly=true; $size->readOnly=true; $extra->readOnly=true; $r.=td($desc->input().HtmlInput::hidden('type[]','')); $r.=td($select_type->input()); $r.=td($size->input()); $r.=td($extra->input()); $r.=td(""); } echo tr($r); } $desc->readOnly=false; $select_type->readOnly=false; $size->readOnly=false; $extra->readOnly=false; $desc->value=''; $select_type->selected=-1; $r=td(_("Nouvel attribut").HtmlInput::hidden('ad_id[]','0'),'class="highlight"'); $r.=td($desc->input()); $r.=td($select_type->input()); $r.=td($size->input()); $r.=td($extra->input()); echo tr($r); echo '
'; echo HtmlInput::submit('save',_('Sauver')); echo '
'; echo '
';