diff --git a/html/js/ajax_fiche.js b/html/js/ajax_fiche.js index 60106c556..5f164be73 100644 --- a/html/js/ajax_fiche.js +++ b/html/js/ajax_fiche.js @@ -19,7 +19,7 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/*! \file +/*! \file * \brief This file permit to use the AJAX function to fill up * info from fiche * @@ -30,19 +30,32 @@ */ function clean_Fid(p_ctl) { - nSell=p_ctl+"_price"; - nTvaAmount=p_ctl+"_tva_amount"; - nBuy=p_ctl+"_price"; - nTva_id=p_ctl+"_tva_id"; - if ( $(nSell) ) { $(nSell).value=""; } - if ( $(nBuy) ) { $(nBuy).value="";} - if ( $(nTva_id) ) { $(nTva_id).value="-1"; } - if ( $(nTvaAmount)) {$(nTvaAmount).value=0;} + nSell=p_ctl+"_price"; + nTvaAmount=p_ctl+"_tva_amount"; + nBuy=p_ctl+"_price"; + nTva_id=p_ctl+"_tva_id"; + if ( $(nSell) ) + { + $(nSell).value=""; + } + if ( $(nBuy) ) + { + $(nBuy).value=""; + } + if ( $(nTva_id) ) + { + $(nTva_id).value="-1"; + } + if ( $(nTvaAmount)) + { + $(nTvaAmount).value=0; + } } -function errorFid(request,json) { - alert('erreur : ajax fiche'); +function errorFid(request,json) +{ + alert('erreur : ajax fiche'); } -/*!\brief this function fills the data from fid.php, +/*!\brief this function fills the data from fid.php, * \param p_ctl object : field of the input, * possible object member * - label field to update with the card's name @@ -51,41 +64,68 @@ function errorFid(request,json) { * - jrn field to force the ledger *\see successFid errorFid fid.php */ -function ajaxFid(p_ctl) +function ajaxFid(p_ctl) { - var gDossier=$('gDossier').value; - var jrn=$(p_ctl).jrn; - $(p_ctl).value=$(p_ctl).value.toUpperCase(); - if ( jrn == undefined ) { if ($('p_jrn')!=undefined) {jrn=$('p_jrn').value; } } - if ( jrn == undefined ) { jrn=-1;} - if ( trim($(p_ctl).value)=="" ) { - nLabel=$(p_ctl).label; - if ($(nLabel) ){$(nLabel).value=""; - $(nLabel).innerHTML=" "; - clean_Fid(p_ctl); - return; + var gDossier=$('gDossier').value; + var jrn=$(p_ctl).jrn; + $(p_ctl).value=$(p_ctl).value.toUpperCase(); + if ( jrn == undefined ) + { + if ($('p_jrn')!=undefined) + { + jrn=$('p_jrn').value; + } } - } - var queryString="?FID="+trim($(p_ctl).value); - if ( $(p_ctl).label) { queryString+='&l='+$(p_ctl).label;} - if ( $(p_ctl).tvaid) { queryString+='&t='+$(p_ctl).tvaid;} - if ( $(p_ctl).price) { queryString+='&p='+$(p_ctl).price;} - if ( $(p_ctl).purchase) { queryString+='&b='+$(p_ctl).purchase;} - if ( $(p_ctl).typecard) { queryString+='&d='+$(p_ctl).typecard;} - queryString=queryString+"&j="+jrn+'&gDossier='+gDossier; - queryString=queryString+'&ctl='+p_ctl.id; - - var action=new Ajax.Request ( - "fid.php", - { - method:'get', - parameters:queryString, - onFailure:errorFid, - onSuccess:successFid - } - - ); - + if ( jrn == undefined ) + { + jrn=-1; + } + if ( trim($(p_ctl).value)=="" ) + { + nLabel=$(p_ctl).label; + if ($(nLabel) ) + { + $(nLabel).value=""; + $(nLabel).innerHTML=" "; + clean_Fid(p_ctl); + return; + } + } + var queryString="?FID="+trim($(p_ctl).value); + if ( $(p_ctl).label) + { + queryString+='&l='+$(p_ctl).label; + } + if ( $(p_ctl).tvaid) + { + queryString+='&t='+$(p_ctl).tvaid; + } + if ( $(p_ctl).price) + { + queryString+='&p='+$(p_ctl).price; + } + if ( $(p_ctl).purchase) + { + queryString+='&b='+$(p_ctl).purchase; + } + if ( $(p_ctl).typecard) + { + queryString+='&d='+$(p_ctl).typecard; + } + queryString=queryString+"&j="+jrn+'&gDossier='+gDossier; + queryString=queryString+'&ctl='+p_ctl.id; + + var action=new Ajax.Request ( + "fid.php", + { + method:'get', + parameters:queryString, + onFailure:errorFid, + onSuccess:successFid + } + + ); + } /*!\brief callback function for ajax * \param request : object request @@ -102,59 +142,75 @@ function ajaxFid(p_ctl) "buy":" "} \endverbatim */ -function successFid(request,json) { - var answer=request.responseText.evalJSON(true); - var flabel=answer.flabel; - if ( answer.answer=='nok' ){ - set_value(flabel," Fiche inexistante"); - return; - } +function successFid(request,json) +{ + var answer=request.responseText.evalJSON(true); + var flabel=answer.flabel; + if ( answer.answer=='nok' ) + { + set_value(flabel," Fiche inexistante"); + return; + } + + var ftva_id=answer.ftva_id; + var fsale=answer.fPrice_sale; + var fpurchase=answer.fPrice_purchase; + + if ( ftva_id != 'none') + { + set_value(ftva_id,answer.tva_id); + } + if ( flabel != 'none') + { + set_value(flabel,answer.name); + } + if ( fsale != 'none') + { + set_value(fsale,answer.sell); + } + if ( fpurchase != 'none') + { + set_value(fpurchase,answer.buy); + } - var ftva_id=answer.ftva_id; - var fsale=answer.fPrice_sale; - var fpurchase=answer.fPrice_purchase; - - if ( ftva_id != 'none') { set_value(ftva_id,answer.tva_id);} - if ( flabel != 'none') { set_value(flabel,answer.name);} - if ( fsale != 'none') { set_value(fsale,answer.sell);} - if ( fpurchase != 'none') { set_value(fpurchase,answer.buy);} - } -function ajax_error_saldo(request,json) { - alert('erreur : ajax fiche'); +function ajax_error_saldo(request,json) +{ + alert('erreur : ajax fiche'); } /*!\brief this function get the saldo * \param p_ctl the ctrl where we take the quick_code */ -function ajax_saldo(p_ctl) +function ajax_saldo(p_ctl) { - var gDossier=$('gDossier').value; - var ctl_value=trim($(p_ctl).value); - var jrn=$('p_jrn').value; - queryString="?FID="+ctl_value; - queryString=queryString+'&gDossier='+gDossier+'&j='+jrn; - queryString=queryString+'&ctl='+ctl_value; - /* alert(queryString); */ - var action=new Ajax.Request ( - "get_saldo.php", - { - method:'get', - parameters:queryString, - onFailure:ajax_error_saldo, - onSuccess:ajax_success_saldo - } - - ); - + var gDossier=$('gDossier').value; + var ctl_value=trim($(p_ctl).value); + var jrn=$('p_jrn').value; + queryString="?FID="+ctl_value; + queryString=queryString+'&gDossier='+gDossier+'&j='+jrn; + queryString=queryString+'&ctl='+ctl_value; + /* alert(queryString); */ + var action=new Ajax.Request ( + "get_saldo.php", + { + method:'get', + parameters:queryString, + onFailure:ajax_error_saldo, + onSuccess:ajax_success_saldo + } + + ); + } /*!\brief callback function for ajax * \param request : object request * \param json : json answer */ -function ajax_success_saldo(request,json) { - var answer=request.responseText.evalJSON(true); - $('first_sold').value=answer.saldo; - +function ajax_success_saldo(request,json) +{ + var answer=request.responseText.evalJSON(true); + $('first_sold').value=answer.saldo; + } /*!\brief this function get data from ajax_card.php and fill the hidden div with the return html string * \param p_dossier @@ -163,26 +219,27 @@ function ajax_success_saldo(request,json) { * \param ctl : id of the div to show * \param page */ -function ajax_card(p_dossier,f_id,p_operation,ctl,page) { -$(ctl).show(); -var queryString="gDossier="+p_dossier+"&f_id="+f_id+"&op="+p_operation+"&p="+page+'&ctl='+ctl; -var action = new Ajax.Request( - "ajax_card.php" , { method:'get', parameters:queryString,onFailure:ajax_get_failure,onSuccess:ajax_get_success} - ); +function ajax_card(p_dossier,f_id,p_operation,ctl,page) +{ + $(ctl).show(); + var queryString="gDossier="+p_dossier+"&f_id="+f_id+"&op="+p_operation+"&p="+page+'&ctl='+ctl; + var action = new Ajax.Request( + "ajax_card.php" , { method:'get', parameters:queryString,onFailure:ajax_get_failure,onSuccess:ajax_get_success} + ); } /*!\brief callback function for ajax_get when successuf */ function ajax_get_success(request,json) { -var answer=request.responseText.evalJSON(false); -$(answer.ctl).show(); -$(answer.ctl).innerHTML=answer.html; + var answer=request.responseText.evalJSON(false); + $(answer.ctl).show(); + $(answer.ctl).innerHTML=answer.html; } /*!\brief callback function for ajax_get when fails */ function ajax_get_failure(request,json) { -alert("Ajax do not work for ajax_get"); + alert("Ajax do not work for ajax_get"); } diff --git a/html/js/compute_direct.js b/html/js/compute_direct.js index 152e490e1..efa32eff2 100644 --- a/html/js/compute_direct.js +++ b/html/js/compute_direct.js @@ -18,61 +18,79 @@ /*!\file *\brief common function for "Ecriture directe" */ -function checkTotalDirect() { - var ie4=false; - if ( document.all ) { - ie4=true; - }// Ajouter getElementById par document.all[str] - var total_deb=0.0; - var total_cred=0.0; +function checkTotalDirect() +{ + var ie4=false; + if ( document.all ) + { + ie4=true; + }// Ajouter getElementById par document.all[str] + var total_deb=0.0; + var total_cred=0.0; - var nb_item_id=document.getElementById('nb_item'); - if ( ! nb_item_id ) - {return; } - - var nb_item=nb_item_id.value; - - for (var i=0;i 0) {code_html.evalScripts();} + catch (e) + { + alert(e.message); + } + try + { + if (code_html.length > 0) + { + code_html.evalScripts(); + } + } + catch(e) + { + alert("Impossible executer script de la reponse\n"+e.message); } - catch(e){ - alert("Impossible executer script de la reponse\n"+e.message);} window.location.reload(); - + } -function extension_remove(ex_id) { - var dossier=$("gDossier").value; - var queryString='?gDossier='+dossier; - queryString+='&ex_id='+ex_id; - queryString+='&action=re'; // re for remove extension - var action=new Ajax.Request ( 'ajax_extension.php', - { - method:'POST', - parameters:queryString, - onFailure:errorExtension, - onSuccess:successSave - } - ); - +function extension_remove(ex_id) +{ + var dossier=$("gDossier").value; + var queryString='?gDossier='+dossier; + queryString+='&ex_id='+ex_id; + queryString+='&action=re'; // re for remove extension + var action=new Ajax.Request ( 'ajax_extension.php', + { + method:'POST', + parameters:queryString, + onFailure:errorExtension, + onSuccess:successSave + } + ); + } diff --git a/html/js/infobulle.js b/html/js/infobulle.js index 8f02dcd09..f77e422d4 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -15,7 +15,7 @@ * along with PhpCompta; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*!\file +/*!\file * \brief create the infobulle, the internalization is not yet implemented * \code // Example @@ -42,24 +42,29 @@ content[11]="ATTENTION si le poste comptable est vide, il sera créé automatiq content[12]="Document généré uniquement si le mode de paiement est utilisé"; content[13]="Vous pouvez utiliser le % pour indiquer le poste parent"; -function showBulle(p_ctl) { - d=document.getElementById('bulle'); - d.innerHTML=content[p_ctl]; - d.style.top=posY+offsetY; - d.style.left=posX+offsetX; - d.style.visibility="visible"; +function showBulle(p_ctl) +{ + d=document.getElementById('bulle'); + d.innerHTML=content[p_ctl]; + d.style.top=posY+offsetY; + d.style.left=posX+offsetX; + d.style.visibility="visible"; } -function getPosition(e) { - if (document.all) { - posX=event.x+document.body.scrollLeft; - posY=event.y+document.body.scrollTop; - } - else { - posX=e.pageX; - posY=e.pageY; - } +function getPosition(e) +{ + if (document.all) + { + posX=event.x+document.body.scrollLeft; + posY=event.y+document.body.scrollTop; + } + else + { + posX=e.pageX; + posY=e.pageY; + } +} +function hideBulle(p_ctl) +{ + d=document.getElementById('bulle'); + d.style.visibility="hidden"; } -function hideBulle(p_ctl) { - d=document.getElementById('bulle'); - d.style.visibility="hidden"; -} diff --git a/include/fiche.inc.php b/include/fiche.inc.php index 4e3f698d0..089505422 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -1,4 +1,4 @@ -input(); $cn=new Database($gDossier); // Security check $write=$User->check_action(FICADD); -if ($write == 0 ){ - /* Cannot Access */ - NoAccess(); +if ($write == 0 ) +{ + /* Cannot Access */ + NoAccess(); } -function ShowRecherche() { - echo '
'; - echo dossier::hidden(); - $w=new IText(); - $search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:""; - $h=new IHidden(); - echo $h->input('p_action','fiche'); - echo $h->input('action','search'); - echo _("Recherche :").$w->input('search_text',$search_text); - echo HtmlInput::submit('submit',_('Rechercher')); - echo '
'; +function ShowRecherche() +{ + echo '
'; + echo dossier::hidden(); + $w=new IText(); + $search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:""; + $h=new IHidden(); + echo $h->input('p_action','fiche'); + echo $h->input('action','search'); + echo _("Recherche :").$w->input('search_text',$search_text); + echo HtmlInput::submit('submit',_('Rechercher')); + echo '
'; } function ShowFicheDefInput($p_fiche_def) { - $r=""; - // Save the label - - $p_fiche_def->Get(); - $p_fiche_def->GetAttribut(); + $r=""; + // Save the label - /* we change the main attribute */ - if (isset ($_REQUEST['label']) ){ - $p_fiche_def->SaveLabel($_REQUEST['label']); - if ( isset($_REQUEST['create'])) { - $p_fiche_def->set_autocreate(true); - } else { - $p_fiche_def->set_autocreate(false); + $p_fiche_def->Get(); + $p_fiche_def->GetAttribut(); + + /* we change the main attribute */ + if (isset ($_REQUEST['label']) ) + { + $p_fiche_def->SaveLabel($_REQUEST['label']); + if ( isset($_REQUEST['create'])) + { + $p_fiche_def->set_autocreate(true); + } + else + { + $p_fiche_def->set_autocreate(false); + } + $p_fiche_def->save_class_base($_REQUEST['class_base']); } - $p_fiche_def->save_class_base($_REQUEST['class_base']); - } - $p_fiche_def->Get(); - $r.= '

'.h($p_fiche_def->label).'

'; - $r.='
Données générales'; - - /* show the values label class_base and create account */ - $r.='
'; - $r.=dossier::hidden(); - $r.=HtmlInput::hidden("fd_id",$p_fiche_def->id); - $r.=HtmlInput::hidden("p_action","fiche"); - $r.= $p_fiche_def->input_base(); - $r.='
'; - $r.=HtmlInput::submit('change_name',_('Sauver')); - $r.='
'; - $r.='
'; - /* attributes */ - $r.='
Détails'; + $p_fiche_def->Get(); + $r.= '

'.h($p_fiche_def->label).'

'; + $r.='
Données générales'; - $r.= '
'; - $r.=dossier::hidden(); - $r.=HtmlInput::hidden("fd_id",$p_fiche_def->id); - $r.= $p_fiche_def->DisplayAttribut("remove"); - $r.= HtmlInput::submit('add_line',_('Ajoutez cet élément')); - $r.= HtmlInput::submit("save_line",_("Sauvez")); - $r.=HtmlInput::submit('remove_cat',_('Effacer cette catégorie'),'onclick="return confirm(\''._('Vous confirmez ?').'\')"'); - // if there is nothing to remove then hide the button - if ( strpos ($r,"chk_remove") != 0 ) { - $r.=HtmlInput::submit('remove_line',_("Enleve les éléments cochés"),"onclick=\"return confirm('Vous confirmez?')\"" ); - } - $r.= "
"; - $r.="

"._("Attention : il n'y aura pas de demande de confirmation pour enlever les -attributs sélectionnés. Il ne sera pas possible de revenir en arrière")."

"; - $r.='
'; + /* show the values label class_base and create account */ + $r.='
'; + $r.=dossier::hidden(); + $r.=HtmlInput::hidden("fd_id",$p_fiche_def->id); + $r.=HtmlInput::hidden("p_action","fiche"); + $r.= $p_fiche_def->input_base(); + $r.='
'; + $r.=HtmlInput::submit('change_name',_('Sauver')); + $r.='
'; + $r.='
'; + /* attributes */ + $r.='
Détails'; - return $r; + $r.= '
'; + $r.=dossier::hidden(); + $r.=HtmlInput::hidden("fd_id",$p_fiche_def->id); + $r.= $p_fiche_def->DisplayAttribut("remove"); + $r.= HtmlInput::submit('add_line',_('Ajoutez cet élément')); + $r.= HtmlInput::submit("save_line",_("Sauvez")); + $r.=HtmlInput::submit('remove_cat',_('Effacer cette catégorie'),'onclick="return confirm(\''._('Vous confirmez ?').'\')"'); + // if there is nothing to remove then hide the button + if ( strpos ($r,"chk_remove") != 0 ) + { + $r.=HtmlInput::submit('remove_line',_("Enleve les éléments cochés"),"onclick=\"return confirm('Vous confirmez?')\"" ); + } + $r.= "
"; + $r.="

"._("Attention : il n'y aura pas de demande de confirmation pour enlever les + attributs sélectionnés. Il ne sera pas possible de revenir en arrière")."

"; + $r.='
'; + + return $r; } $recherche=true; // Creation of a new model of card // in the database if ( isset($_POST['add_modele']) ) - { +{ $User->can_request(FICCAT); // insert the model of card in database $fiche_def=new Fiche_Def($cn); $fiche_def->Add($_POST); - } +} $r=""; -if ( isset ($_POST['remove_cat'] ) ) { +if ( isset ($_POST['remove_cat'] ) ) +{ $User->can_request(FICCAT); - $fd_id=new Fiche_Def($cn,$_POST['fd_id']); - $remains=$fd_id->remove(); - if ( $remains != 0 ) - /* some card are not removed because it is used */ - alert('Impossible d\'enlever cette catégorie, certaines fiches sont encore utilisées'."\n". - 'Les fiches non utilisées ont cependant été effacées'); + $fd_id=new Fiche_Def($cn,$_POST['fd_id']); + $remains=$fd_id->remove(); + if ( $remains != 0 ) + /* some card are not removed because it is used */ + alert('Impossible d\'enlever cette catégorie, certaines fiches sont encore utilisées'."\n". + 'Les fiches non utilisées ont cependant été effacées'); } // Add a line in the card model -if ( isset ($_POST["add_line"]) ) { +if ( isset ($_POST["add_line"]) ) +{ $User->can_request(FIC); - $r= '
'; - if ( $write ==0) - $r.= "

Pas d'accès

"; - else + $r= '
'; + if ( $write ==0) + $r.= "

Pas d'accès

"; + else { - $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); - // Insert Line - $fiche_def->InsertAttribut($_REQUEST['ad_id']); - - $r.=ShowFicheDefInput($fiche_def); + $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); + // Insert Line + $fiche_def->InsertAttribut($_REQUEST['ad_id']); + + $r.=ShowFicheDefInput($fiche_def); } - $r.= '
'; - $recherche=false; + $r.= '
'; + $recherche=false; } /* ------------------------------------------------- */ /* SAVE ORDER */ /* ------------------------------------------------- */ -if ( isset($_POST['save_line'])) { - $User->can_request(FICCAT); - $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); - $fiche_def->save_order($_POST); - $r= '
'; - if ( $write ==0) - $r.= "

Pas d'accès

"; - else +if ( isset($_POST['save_line'])) +{ + $User->can_request(FICCAT); + $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); + $fiche_def->save_order($_POST); + $r= '
'; + if ( $write ==0) + $r.= "

Pas d'accès

"; + else { - $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); - // Insert Line - $r.=ShowFicheDefInput($fiche_def); + $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); + // Insert Line + $r.=ShowFicheDefInput($fiche_def); } - $r.= '
'; - $recherche=false; + $r.= '
'; + $recherche=false; } // Remove lines from a card model -if ( isset ($_POST['remove_line']) ) - { +if ( isset ($_POST['remove_line']) ) +{ $User->can_request(FICCAT); $r= '
'; - if ( $write ==0) - $r.= "

Pas d'accès

"; + if ( $write ==0) + $r.= "

Pas d'accès

"; else - { - if ( isset($_REQUEST['chk_remove'])) { - $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); - // Insert Line - // demander confirmation - - $fiche_def->RemoveAttribut($_REQUEST['chk_remove']); - $r.=ShowFicheDefInput($fiche_def); - } + { + if ( isset($_REQUEST['chk_remove'])) + { + $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); + // Insert Line + // demander confirmation - } + $fiche_def->RemoveAttribut($_REQUEST['chk_remove']); + $r.=ShowFicheDefInput($fiche_def); + } + + } $r.= '
'; $recherche=false; - } +} // Change the name of the card model -if ( isset ($_POST["change_name"] ) ) { - $User->can_request(FICCAT); - $r= '
'; - if ( $write ==0) - $r.= "

"._("Pas d'accès")."

"; - else +if ( isset ($_POST["change_name"] ) ) +{ + $User->can_request(FICCAT); + $r= '
'; + if ( $write ==0) + $r.= "

"._("Pas d'accès")."

"; + else { - $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); - $r.=ShowFicheDefInput($fiche_def); + $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); + $r.=ShowFicheDefInput($fiche_def); } - $r.= '
'; - $recherche=false; - ShowMenuFiche($gDossier); - echo $r; - exit(); + $r.= '
'; + $recherche=false; + ShowMenuFiche($gDossier); + echo $r; + exit(); } ShowMenuFiche($gDossier); @@ -222,244 +234,260 @@ echo $r; //------------------------------------------------------------------------------ // Get action -if ( isset ( $_GET["action"]) ) { - $action=$_GET["action"]; - // View the details of the selected cat. of cards - if ( isset ($_GET["fiche"]) && $action=="vue" - && ! isset ($_POST['add_fiche']) - && ! isset ($_POST['update_fiche']) - && ! isset ($_POST['move']) - && ! isset ($_POST['delete'])) { - $User->can_request(FICADD); - - echo '
'; - $fiche_def=new Fiche_Def($cn,$_GET['fiche']); - $fiche_def->myList(); - - echo '
'; - - $recherche=false; - } - //_________________________________________________________________________ - // Display the detail of a card - if ($action== "detail" ) { - echo '
'; - $t=false; - if ( $User->check_action(FICADD)==0) - { - echo '

Vos changements ne seront pas sauvés

'; - $t=true; - } - $str="&".dossier::get(); - $fiche=new Fiche($cn,$_GET["fiche_id"]); - $fiche->get_categorie(); - $fiche_def=new Fiche_Def($cn,$fiche->fd_id); - $fiche_def->Get(); - echo '

'.$fiche_def->label.'

'; - - if ( $_SESSION['g_pagesize'] != -1 ){ - // retrieve value - // with offet &offset=15&step=15&page=2&size=15 - if ( isset($_GET['offset']) && $_SESSION['g_pagesize'] != -1) { - $str=sprintf("&offset=%s&step=%s&page=%s&size=%s", - $_GET['offset'], - $_GET['step'], - $_GET['page'], - $_GET['size']); - } - - - } - if ( $write != 0 ) - echo '
'; - echo dossier::hidden(); - echo $fiche->Display($t); - echo HtmlInput::hidden("f_id",$_GET['fiche_id']); - if ( $write != 0 ) { - $iselect=new ISelect('move_to'); - $iselect->value=$cn->make_array('select fd_id,fd_label from fiche_def '); //where frd_id='.$fiche->get_fiche_def_ref_id()); - - echo HtmlInput::submit("update_fiche","Mise à jour"); - echo HtmlInput::submit("delete" ,"Effacer cette fiche","onclick=\"return confirm('"._('Vous confirmez ?')."');\""); - echo HtmlInput::submit('move',_('Déplacer vers'),"onclick=\"return confirm('"._('Attention, certains attributs pourraient être ajoutés à la catégorie de destination, vous confirmez ?')."');\""); - echo $iselect->input(); - } - $str=""; - echo HtmlInput::button_anchor(_('Retour'),'?p_action=fiche&action=vue&'.$str_dossier.'&fiche='.$fiche->fiche_def.$str); - - if ( $write != 0 ) echo '
'; - echo '
'; - $recherche=false; - } - //_________________________________________________________________________ - // Display the form where you can enter - // the property of the card model - if ($action == "add_modele" ) { - $User->can_request(FICCAT); - echo '
'; - echo '
'; - $oFiche_Def=new Fiche_Def($cn); - echo HtmlInput::hidden("p_action","fiche"); - echo dossier::hidden(); - echo $oFiche_Def->input(); // CreateCategory($cn,$search); - echo HtmlInput::submit("add_modele" ,"Sauve"); - - echo '
'; - echo '
'; - $recherche=false; - } - //_________________________________________________________________________ - // Modify a card Model - if ($action == "modifier" ) { - $User->can_request(FICCAT); - echo '
'; - $fiche_def=new Fiche_Def($cn,$_GET['fiche']); - - echo ShowFicheDefInput($fiche_def); - echo '
'; - $recherche=false; - } - //_________________________________________________________________________ - // Search a card - if ( $action == "search" ) +if ( isset ( $_GET["action"]) ) +{ + $action=$_GET["action"]; + // View the details of the selected cat. of cards + if ( isset ($_GET["fiche"]) && $action=="vue" + && ! isset ($_POST['add_fiche']) + && ! isset ($_POST['update_fiche']) + && ! isset ($_POST['move']) + && ! isset ($_POST['delete'])) { - echo '
'; - ShowRecherche(); - $sql="select distinct f_id,fd_id from fiche join jnt_fic_att_value using (f_id) - join attr_value using (jft_id) where - upper(av_text) like upper('%".FormatString($_GET["search_text"])."%') order by f_id"; + $User->can_request(FICADD); - $all=$cn->get_array($sql); - // test on the size - // - if ( sizeof($all) != 0 ) - { + echo '
'; + $fiche_def=new Fiche_Def($cn,$_GET['fiche']); + $fiche_def->myList(); + + echo '
'; + + $recherche=false; + } + //_________________________________________________________________________ + // Display the detail of a card + if ($action== "detail" ) + { + echo '
'; + $t=false; + if ( $User->check_action(FICADD)==0) + { + echo '

Vos changements ne seront pas sauvés

'; + $t=true; + } + $str="&".dossier::get(); + $fiche=new Fiche($cn,$_GET["fiche_id"]); + $fiche->get_categorie(); + $fiche_def=new Fiche_Def($cn,$fiche->fd_id); + $fiche_def->Get(); + echo '

'.$fiche_def->label.'

'; + + if ( $_SESSION['g_pagesize'] != -1 ) + { + // retrieve value + // with offet &offset=15&step=15&page=2&size=15 + if ( isset($_GET['offset']) && $_SESSION['g_pagesize'] != -1) + { + $str=sprintf("&offset=%s&step=%s&page=%s&size=%s", + $_GET['offset'], + $_GET['step'], + $_GET['page'], + $_GET['size']); + } + + + } + if ( $write != 0 ) + echo '
'; + echo dossier::hidden(); + echo $fiche->Display($t); + echo HtmlInput::hidden("f_id",$_GET['fiche_id']); + if ( $write != 0 ) + { + $iselect=new ISelect('move_to'); + $iselect->value=$cn->make_array('select fd_id,fd_label from fiche_def '); //where frd_id='.$fiche->get_fiche_def_ref_id()); + + echo HtmlInput::submit("update_fiche","Mise à jour"); + echo HtmlInput::submit("delete" ,"Effacer cette fiche","onclick=\"return confirm('"._('Vous confirmez ?')."');\""); + echo HtmlInput::submit('move',_('Déplacer vers'),"onclick=\"return confirm('"._('Attention, certains attributs pourraient être ajoutés à la catégorie de destination, vous confirmez ?')."');\""); + echo $iselect->input(); + } + $str=""; + echo HtmlInput::button_anchor(_('Retour'),'?p_action=fiche&action=vue&'.$str_dossier.'&fiche='.$fiche->fiche_def.$str); + + if ( $write != 0 ) echo '
'; + echo '
'; + $recherche=false; + } + //_________________________________________________________________________ + // Display the form where you can enter + // the property of the card model + if ($action == "add_modele" ) + { + $User->can_request(FICCAT); + echo '
'; + echo '
'; + $oFiche_Def=new Fiche_Def($cn); + echo HtmlInput::hidden("p_action","fiche"); + echo dossier::hidden(); + echo $oFiche_Def->input(); // CreateCategory($cn,$search); + echo HtmlInput::submit("add_modele" ,"Sauve"); + + echo '
'; + echo '
'; + $recherche=false; + } + //_________________________________________________________________________ + // Modify a card Model + if ($action == "modifier" ) + { + $User->can_request(FICCAT); + echo '
'; + $fiche_def=new Fiche_Def($cn,$_GET['fiche']); + + echo ShowFicheDefInput($fiche_def); + echo '
'; + $recherche=false; + } + //_________________________________________________________________________ + // Search a card + if ( $action == "search" ) + { + echo '
'; + ShowRecherche(); + $sql="select distinct f_id,fd_id from fiche join jnt_fic_att_value using (f_id) + join attr_value using (jft_id) where + upper(av_text) like upper('%".FormatString($_GET["search_text"])."%') order by f_id"; + + $all=$cn->get_array($sql); + // test on the size + // + if ( sizeof($all) != 0 ) + { + + echo "Résultat : ".sizeof($all).'éléments trouvés
'; + foreach ($all as $f_id) + { + $fiche=new Fiche($cn,$f_id['f_id']); + echo ''. + $fiche->getName().''; + } + } + else + { + echo '
'; + echo "Aucun résultat trouvé"; + + } + echo '
'; - echo "Résultat : ".sizeof($all).'éléments trouvés
'; - foreach ($all as $f_id){ - $fiche=new Fiche($cn,$f_id['f_id']); - echo ''. - $fiche->getName().''; - } - } - else - { - echo '
'; - echo "Aucun résultat trouvé"; - - } - echo '
'; - } - $recherche=false; + $recherche=false; } // Display a blank card from the selected category -if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) { - $User->can_request(FICADD); +if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) +{ + $User->can_request(FICADD); - echo '
'; - if ( $write ==0) - echo "

Pas d'accès

"; - else + echo '
'; + if ( $write ==0) + echo "

Pas d'accès

"; + else { - $fiche_def=new Fiche_Def($cn,$_POST['fiche']); - $fiche_def->Get(); - echo '

'.$fiche_def->label.'

'; - $url=$_SERVER['REQUEST_URI']; - $fiche=new Fiche($cn,0); - - echo '
'; - echo dossier::hidden(); - echo $fiche->blank($_POST['fiche']); - echo HtmlInput::submit("add_fiche","Ajout"); - echo HtmlInput::button_anchor(_('Annuler'),$url.'&fiche='.$_POST['fiche'].'&'.$str_dossier); - + $fiche_def=new Fiche_Def($cn,$_POST['fiche']); + $fiche_def->Get(); + echo '

'.$fiche_def->label.'

'; + $url=$_SERVER['REQUEST_URI']; + $fiche=new Fiche($cn,0); - echo '
'; + echo '
'; + echo dossier::hidden(); + echo $fiche->blank($_POST['fiche']); + echo HtmlInput::submit("add_fiche","Ajout"); + echo HtmlInput::button_anchor(_('Annuler'),$url.'&fiche='.$_POST['fiche'].'&'.$str_dossier); + + + echo '
'; } - echo '
'; - $recherche=false; - exit(); + echo '
'; + $recherche=false; + exit(); } //------------------------------------------------------------------------------ // delete a card -if (isset($_POST['delete']) ) { - $User->can_request(FIC); - ShowRecherche(); - echo '
'; - if ( $write ==0) - echo "

Pas d'accès

"; - else +if (isset($_POST['delete']) ) +{ + $User->can_request(FIC); + ShowRecherche(); + echo '
'; + if ( $write ==0) + echo "

Pas d'accès

"; + else { - $fiche=new Fiche($cn,$_POST["f_id"]); - $fiche->remove(); + $fiche=new Fiche($cn,$_POST["f_id"]); + $fiche->remove(); } - $fiche_def=new Fiche_Def($cn,$_GET['fiche']); - $fiche_def->myList(); + $fiche_def=new Fiche_Def($cn,$_GET['fiche']); + $fiche_def->myList(); - echo "
"; - exit(); -} + echo "
"; + exit(); +} //------------------------------------------------------------------------------ // Add the data (attribute) of the card -if ( isset ($_POST["add_fiche"]) ) { - $User->can_request(FICADD); - if ( $write ==0) { - echo '
'; - echo "

Pas d'accès

"; - } - else +if ( isset ($_POST["add_fiche"]) ) +{ + $User->can_request(FICADD); + if ( $write ==0) { - ShowRecherche(); - echo '
'; - $fiche=new Fiche($cn); - $fiche->Save($_REQUEST['fiche']); - $fiche_def=new Fiche_Def($cn,$_GET['fiche']); - $fiche_def->myList(); - - + echo '
'; + echo "

Pas d'accès

"; } - echo '
'; - $recherche=false; + else + { + ShowRecherche(); + echo '
'; + $fiche=new Fiche($cn); + $fiche->Save($_REQUEST['fiche']); + $fiche_def=new Fiche_Def($cn,$_GET['fiche']); + $fiche_def->myList(); + + + } + echo '
'; + $recherche=false; } //------------------------------------------------------------------------------ // Update a card -if ( isset ($_POST["update_fiche"]) ) { - $User->can_request(FIC); - echo '
'; - if ( $write ==0) - echo "

Pas d'accès

"; - else +if ( isset ($_POST["update_fiche"]) ) +{ + $User->can_request(FIC); + echo '
'; + if ( $write ==0) + echo "

Pas d'accès

"; + else { - $fiche=new Fiche($cn,$_POST['f_id']); - $fiche->Save(); + $fiche=new Fiche($cn,$_POST['f_id']); + $fiche->Save(); } - $fiche_def=new Fiche_Def($cn,$_GET['fiche']); - $fiche_def->myList(); + $fiche_def=new Fiche_Def($cn,$_GET['fiche']); + $fiche_def->myList(); - echo '
'; - $recherche=false; + echo '
'; + $recherche=false; } //-------------------------------------------------------------------------------- // Move a card to a new category -if ( isset($_POST['move'])){ - echo '
'; - $fiche=new Fiche($cn,$_POST['f_id']); - $fiche->move_to($_POST['move_to']); - $fiche_def=new Fiche_Def($cn,$_GET['fiche']); - $fiche_def->myList(); - echo '
'; +if ( isset($_POST['move'])) +{ + echo '
'; + $fiche=new Fiche($cn,$_POST['f_id']); + $fiche->move_to($_POST['move_to']); + $fiche_def=new Fiche_Def($cn,$_GET['fiche']); + $fiche_def->myList(); + echo '
'; } //--Search menu -if ( $recherche==true) { - ShowRecherche(); +if ( $recherche==true) +{ + ShowRecherche(); } html_page_stop(); ?>