format code
This commit is contained in:
parent
e62c95b6a1
commit
ed31ae5768
5 changed files with 727 additions and 584 deletions
|
|
@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <nb_item ;i++) {
|
||||
var doc_amount=document.getElementById("amount"+i);
|
||||
if ( ! doc_amount ) { return;}
|
||||
var side=document.getElementsByName("ck"+i);
|
||||
if ( ! side ) { return;}
|
||||
var amount=parseFloat(doc_amount.value);
|
||||
|
||||
if ( isNaN(amount) == true) {
|
||||
amount=0.0;
|
||||
}
|
||||
for (var e=0;e<side.length;e++) {
|
||||
if ( side[e].checked == true) {
|
||||
// alert('checked !!! '+side[e].value);
|
||||
total_deb+=amount;
|
||||
}
|
||||
else {
|
||||
total_cred+=amount;
|
||||
}
|
||||
var nb_item_id=document.getElementById('nb_item');
|
||||
if ( ! nb_item_id )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// alert("amount ="+i+"="+amount+" cred/deb = "+deb+"total d/b"+total_deb+"/"+total_cred);
|
||||
}
|
||||
var nb_item=nb_item_id.value;
|
||||
|
||||
for (var i=0;i <nb_item ;i++)
|
||||
{
|
||||
var doc_amount=document.getElementById("amount"+i);
|
||||
if ( ! doc_amount )
|
||||
{
|
||||
return;
|
||||
}
|
||||
var side=document.getElementsByName("ck"+i);
|
||||
if ( ! side )
|
||||
{
|
||||
return;
|
||||
}
|
||||
var amount=parseFloat(doc_amount.value);
|
||||
|
||||
if ( isNaN(amount) == true)
|
||||
{
|
||||
amount=0.0;
|
||||
}
|
||||
for (var e=0;e<side.length;e++)
|
||||
{
|
||||
if ( side[e].checked == true)
|
||||
{
|
||||
// alert('checked !!! '+side[e].value);
|
||||
total_deb+=amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
total_cred+=amount;
|
||||
}
|
||||
}
|
||||
|
||||
// alert("amount ="+i+"="+amount+" cred/deb = "+deb+"total d/b"+total_deb+"/"+total_cred);
|
||||
}
|
||||
|
||||
|
||||
|
||||
r_total_cred=Math.round(total_cred*100)/100;
|
||||
r_total_deb=Math.round(total_deb*100)/100;
|
||||
document.getElementById('totalDeb').innerHTML=r_total_deb;
|
||||
document.getElementById('totalCred').innerHTML=r_total_cred;
|
||||
var diff=0;
|
||||
if ( r_total_deb != r_total_cred ) {
|
||||
document.getElementById("totalDiff").style.color="red";
|
||||
document.getElementById("totalDiff").style.fontWeight="bold";
|
||||
document.getElementById("totalDiff").innerHTML="Différence";
|
||||
diff=total_deb-total_cred;
|
||||
diff=Math.round(diff*100)/100;
|
||||
document.getElementById("totalDiff").innerHTML=diff
|
||||
|
||||
} else {
|
||||
document.getElementById("totalDiff").innerHTML="0.0";
|
||||
}
|
||||
r_total_cred=Math.round(total_cred*100)/100;
|
||||
r_total_deb=Math.round(total_deb*100)/100;
|
||||
document.getElementById('totalDeb').innerHTML=r_total_deb;
|
||||
document.getElementById('totalCred').innerHTML=r_total_cred;
|
||||
var diff=0;
|
||||
if ( r_total_deb != r_total_cred )
|
||||
{
|
||||
document.getElementById("totalDiff").style.color="red";
|
||||
document.getElementById("totalDiff").style.fontWeight="bold";
|
||||
document.getElementById("totalDiff").innerHTML="Différence";
|
||||
diff=total_deb-total_cred;
|
||||
diff=Math.round(diff*100)/100;
|
||||
document.getElementById("totalDiff").innerHTML=diff;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("totalDiff").innerHTML="0.0";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,125 +27,160 @@
|
|||
*@brief show the popup for extension and call ajax
|
||||
*@param the id of the extension to show
|
||||
*/
|
||||
function detail_extension(p_code){
|
||||
var dossier=$("gDossier").value;
|
||||
showIPopup("dtext");
|
||||
var queryString='?gDossier='+dossier;
|
||||
queryString+='&ex_id='+p_code;
|
||||
queryString+='&action=de'; // de for detail extension
|
||||
function detail_extension(p_code)
|
||||
{
|
||||
var dossier=$("gDossier").value;
|
||||
showIPopup("dtext");
|
||||
var queryString='?gDossier='+dossier;
|
||||
queryString+='&ex_id='+p_code;
|
||||
queryString+='&action=de'; // de for detail extension
|
||||
|
||||
var action=new Ajax.Request ( 'ajax_extension.php',
|
||||
{
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorExtension,
|
||||
onSuccess:extDetail
|
||||
}
|
||||
);
|
||||
{
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorExtension,
|
||||
onSuccess:extDetail
|
||||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
*@brief show the popup for adding a new extension and call ajax
|
||||
*/
|
||||
function new_extension(){
|
||||
var dossier=$("gDossier").value;
|
||||
showIPopup("dtext");
|
||||
var queryString='?gDossier='+dossier;
|
||||
queryString+='&action=ne'; // ne for new extension
|
||||
function new_extension()
|
||||
{
|
||||
var dossier=$("gDossier").value;
|
||||
showIPopup("dtext");
|
||||
var queryString='?gDossier='+dossier;
|
||||
queryString+='&action=ne'; // ne for new extension
|
||||
|
||||
var action=new Ajax.Request ( 'ajax_extension.php',
|
||||
{
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorExtension,
|
||||
onSuccess:extDetail
|
||||
}
|
||||
);
|
||||
{
|
||||
method:'get',
|
||||
parameters:queryString,
|
||||
onFailure:errorExtension,
|
||||
onSuccess:extDetail
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief show the detail of a form
|
||||
*/
|
||||
function extDetail(req){
|
||||
try{
|
||||
var answer=req.responseXML;
|
||||
var a=answer.getElementsByTagName('ctl');
|
||||
if ( a.length == 0 ) { var rec=req.responseText;alert ('erreur :'+rec);}
|
||||
var html=answer.getElementsByTagName('code');
|
||||
var name_ctl=a[0].firstChild.nodeValue+'_content';
|
||||
var code_html=getNodeText(html[0]);
|
||||
code_html=unescape_xml(code_html);
|
||||
$(name_ctl).innerHTML=code_html;}
|
||||
catch (e) {
|
||||
alert(e.message);}
|
||||
try{
|
||||
code_html.evalScripts();}
|
||||
catch(e){
|
||||
alert("Impossible executer script de la reponse\n"+e.message);}
|
||||
function extDetail(req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var answer=req.responseXML;
|
||||
var a=answer.getElementsByTagName('ctl');
|
||||
if ( a.length == 0 )
|
||||
{
|
||||
var rec=req.responseText;
|
||||
alert ('erreur :'+rec);
|
||||
}
|
||||
var html=answer.getElementsByTagName('code');
|
||||
var name_ctl=a[0].firstChild.nodeValue+'_content';
|
||||
var code_html=getNodeText(html[0]);
|
||||
code_html=unescape_xml(code_html);
|
||||
$(name_ctl).innerHTML=code_html;
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
alert(e.message);
|
||||
}
|
||||
try
|
||||
{
|
||||
code_html.evalScripts();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
alert("Impossible executer script de la reponse\n"+e.message);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
*@brief save the extension (add or update)
|
||||
*/
|
||||
function extension_save(p_obj_form){
|
||||
try{
|
||||
var dossier=$("gDossier").value;
|
||||
var queryString='?gDossier='+dossier;
|
||||
function extension_save(p_obj_form)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dossier=$("gDossier").value;
|
||||
var queryString='?gDossier='+dossier;
|
||||
queryString+='&action=se'; // se save extension
|
||||
// Data must be taken here
|
||||
try{
|
||||
var data=$(p_obj_form).serialize(false);
|
||||
} catch(f){
|
||||
var sType=p_obj_form.tagName;
|
||||
var sName=p_obj_form.id;
|
||||
var nbElement=p_obj_form.elements.length;
|
||||
alert("Message"+sName+" "+sType+" Nb Element"+nbElement+" "+f.message+"\n");
|
||||
throw (f);
|
||||
}
|
||||
queryString+='&'+data;
|
||||
$("dtext_content").innerHTML=loading();
|
||||
var action=new Ajax.Request ( 'ajax_extension.php', { method:'POST', parameters:queryString,onFailure:errorExtension,
|
||||
onSuccess:successSave } );
|
||||
|
||||
hideIPopup('dtext');
|
||||
} catch(e) {
|
||||
alert("Probleme extension_save "+e._message+"\n"+e.description);
|
||||
// Data must be taken here
|
||||
try
|
||||
{
|
||||
var data=$(p_obj_form).serialize(false);
|
||||
}
|
||||
catch(f)
|
||||
{
|
||||
var sType=p_obj_form.tagName;
|
||||
var sName=p_obj_form.id;
|
||||
var nbElement=p_obj_form.elements.length;
|
||||
alert("Message"+sName+" "+sType+" Nb Element"+nbElement+" "+f.message+"\n");
|
||||
throw (f);
|
||||
}
|
||||
queryString+='&'+data;
|
||||
$("dtext_content").innerHTML=loading();
|
||||
var action=new Ajax.Request ( 'ajax_extension.php', { method:'POST', parameters:queryString,onFailure:errorExtension,
|
||||
onSuccess:successSave } );
|
||||
|
||||
hideIPopup('dtext');
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
alert("Probleme extension_save "+e._message+"\n"+e.description);
|
||||
}
|
||||
}
|
||||
function errorExtension(){
|
||||
alert('Ajax extension failed');
|
||||
function errorExtension()
|
||||
{
|
||||
alert('Ajax extension failed');
|
||||
}
|
||||
function successSave(req){
|
||||
try{
|
||||
var answer=req.responseXML;
|
||||
var html=answer.getElementsByTagName('code');
|
||||
var code_html='';
|
||||
if ( html[0].firstChild != null ){
|
||||
code_html=html[0].firstChild.nodeValue;
|
||||
code_html=unescape_xml(code_html);
|
||||
}
|
||||
function successSave(req)
|
||||
{
|
||||
try
|
||||
{
|
||||
var answer=req.responseXML;
|
||||
var html=answer.getElementsByTagName('code');
|
||||
var code_html='';
|
||||
if ( html[0].firstChild != null )
|
||||
{
|
||||
code_html=html[0].firstChild.nodeValue;
|
||||
code_html=unescape_xml(code_html);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
alert(e.message);}
|
||||
try{
|
||||
if (code_html.length > 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
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/*
|
||||
* This file is part of PhpCompta.
|
||||
*
|
||||
|
|
@ -43,178 +43,190 @@ echo $pop_tva->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 '<form method="GET" action="?">';
|
||||
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 '</form>';
|
||||
function ShowRecherche()
|
||||
{
|
||||
echo '<form method="GET" action="?">';
|
||||
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 '</form>';
|
||||
}
|
||||
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.= '<H2 class="info">'.h($p_fiche_def->label).'</H2>';
|
||||
$r.='<fieldset><legend>Données générales</legend>';
|
||||
|
||||
/* show the values label class_base and create account */
|
||||
$r.='<form method="post">';
|
||||
$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.='<hr>';
|
||||
$r.=HtmlInput::submit('change_name',_('Sauver'));
|
||||
$r.='</form>';
|
||||
$r.='</fieldset>';
|
||||
/* attributes */
|
||||
$r.='<fieldset><legend>Détails</legend>';
|
||||
$p_fiche_def->Get();
|
||||
$r.= '<H2 class="info">'.h($p_fiche_def->label).'</H2>';
|
||||
$r.='<fieldset><legend>Données générales</legend>';
|
||||
|
||||
$r.= '<FORM action="?p_action=fiche" method="POST">';
|
||||
$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.= "</form>";
|
||||
$r.=" <p class=\"notice\"> "._("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")."</p>";
|
||||
$r.='</fieldset>';
|
||||
/* show the values label class_base and create account */
|
||||
$r.='<form method="post">';
|
||||
$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.='<hr>';
|
||||
$r.=HtmlInput::submit('change_name',_('Sauver'));
|
||||
$r.='</form>';
|
||||
$r.='</fieldset>';
|
||||
/* attributes */
|
||||
$r.='<fieldset><legend>Détails</legend>';
|
||||
|
||||
return $r;
|
||||
$r.= '<FORM action="?p_action=fiche" method="POST">';
|
||||
$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.= "</form>";
|
||||
$r.=" <p class=\"notice\"> "._("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")."</p>";
|
||||
$r.='</fieldset>';
|
||||
|
||||
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= '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
$r= '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
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.= '</DIV>';
|
||||
$recherche=false;
|
||||
$r.= '</DIV>';
|
||||
$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= '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
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= '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
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.= '</DIV>';
|
||||
$recherche=false;
|
||||
$r.= '</DIV>';
|
||||
$recherche=false;
|
||||
|
||||
}
|
||||
// Remove lines from a card model
|
||||
if ( isset ($_POST['remove_line']) )
|
||||
{
|
||||
if ( isset ($_POST['remove_line']) )
|
||||
{
|
||||
$User->can_request(FICCAT);
|
||||
$r= '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
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.= '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
}
|
||||
// Change the name of the card model
|
||||
if ( isset ($_POST["change_name"] ) ) {
|
||||
$User->can_request(FICCAT);
|
||||
$r= '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> "._("Pas d'accès")." </h2>";
|
||||
else
|
||||
if ( isset ($_POST["change_name"] ) )
|
||||
{
|
||||
$User->can_request(FICCAT);
|
||||
$r= '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
$r.= "<h2 class=\"error\"> "._("Pas d'accès")." </h2>";
|
||||
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.= '</DIV>';
|
||||
$recherche=false;
|
||||
ShowMenuFiche($gDossier);
|
||||
echo $r;
|
||||
exit();
|
||||
$r.= '</DIV>';
|
||||
$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 '<DIV class="u_redcontent" style="width:auto">';
|
||||
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
echo '</DIV>';
|
||||
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the detail of a card
|
||||
if ($action== "detail" ) {
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
$t=false;
|
||||
if ( $User->check_action(FICADD)==0)
|
||||
{
|
||||
echo '<H2 class="info"> Vos changements ne seront pas sauvés</h2>';
|
||||
$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 '<h2 class="info">'.$fiche_def->label.'</h2>';
|
||||
|
||||
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 '<form method="post" action="?p_action=fiche&action=vue&fiche='.$_GET['fiche'].$str.'">';
|
||||
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 '</form>';
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the form where you can enter
|
||||
// the property of the card model
|
||||
if ($action == "add_modele" ) {
|
||||
$User->can_request(FICCAT);
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
echo '<form method="post">';
|
||||
$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 '</form>';
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Modify a card Model
|
||||
if ($action == "modifier" ) {
|
||||
$User->can_request(FICCAT);
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
|
||||
|
||||
echo ShowFicheDefInput($fiche_def);
|
||||
echo '</DIV>';
|
||||
$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 '<DIV class="u_redcontent" style="float:top;width:auto;">';
|
||||
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 '<DIV class="u_redcontent" style="width:auto">';
|
||||
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
echo '</DIV>';
|
||||
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the detail of a card
|
||||
if ($action== "detail" )
|
||||
{
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
$t=false;
|
||||
if ( $User->check_action(FICADD)==0)
|
||||
{
|
||||
echo '<H2 class="info"> Vos changements ne seront pas sauvés</h2>';
|
||||
$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 '<h2 class="info">'.$fiche_def->label.'</h2>';
|
||||
|
||||
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 '<form method="post" action="?p_action=fiche&action=vue&fiche='.$_GET['fiche'].$str.'">';
|
||||
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 '</form>';
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Display the form where you can enter
|
||||
// the property of the card model
|
||||
if ($action == "add_modele" )
|
||||
{
|
||||
$User->can_request(FICCAT);
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
echo '<form method="post">';
|
||||
$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 '</form>';
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Modify a card Model
|
||||
if ($action == "modifier" )
|
||||
{
|
||||
$User->can_request(FICCAT);
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
|
||||
|
||||
echo ShowFicheDefInput($fiche_def);
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
//_________________________________________________________________________
|
||||
// Search a card
|
||||
if ( $action == "search" )
|
||||
{
|
||||
echo '<DIV class="u_redcontent" style="float:top;width:auto;">';
|
||||
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 "<b>Résultat : ".sizeof($all).'éléments trouvés </b><br>';
|
||||
foreach ($all as $f_id)
|
||||
{
|
||||
$fiche=new Fiche($cn,$f_id['f_id']);
|
||||
echo '<A href="?p_action=fiche&'.$str_dossier.'&action=detail&fiche_id='.$f_id['f_id'].
|
||||
'&fiche='.$f_id['fd_id'].'">'.
|
||||
$fiche->getName().'</A>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
echo "Aucun résultat trouvé";
|
||||
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
echo "<b>Résultat : ".sizeof($all).'éléments trouvés </b><br>';
|
||||
foreach ($all as $f_id){
|
||||
$fiche=new Fiche($cn,$f_id['f_id']);
|
||||
echo '<A href="?p_action=fiche&'.$str_dossier.'&action=detail&fiche_id='.$f_id['f_id'].
|
||||
'&fiche='.$f_id['fd_id'].'">'.
|
||||
$fiche->getName().'</A>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
echo "Aucun résultat trouvé";
|
||||
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
|
||||
}
|
||||
$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 '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
echo '<DIV class="u_redcontent" style="width:auto">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
{
|
||||
$fiche_def=new Fiche_Def($cn,$_POST['fiche']);
|
||||
$fiche_def->Get();
|
||||
echo '<h2 class="info">'.$fiche_def->label.'</h2>';
|
||||
$url=$_SERVER['REQUEST_URI'];
|
||||
$fiche=new Fiche($cn,0);
|
||||
|
||||
echo '<form method="post" action="'.$url.'&fiche='.$_POST['fiche'].'">';
|
||||
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 '<h2 class="info">'.$fiche_def->label.'</h2>';
|
||||
$url=$_SERVER['REQUEST_URI'];
|
||||
$fiche=new Fiche($cn,0);
|
||||
|
||||
echo '</form>';
|
||||
echo '<form method="post" action="'.$url.'&fiche='.$_POST['fiche'].'">';
|
||||
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 '</form>';
|
||||
}
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
exit();
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
exit();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// delete a card
|
||||
if (isset($_POST['delete']) ) {
|
||||
$User->can_request(FIC);
|
||||
ShowRecherche();
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
if (isset($_POST['delete']) )
|
||||
{
|
||||
$User->can_request(FIC);
|
||||
ShowRecherche();
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
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 "</DIV>";
|
||||
exit();
|
||||
}
|
||||
echo "</DIV>";
|
||||
exit();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Add the data (attribute) of the card
|
||||
if ( isset ($_POST["add_fiche"]) ) {
|
||||
$User->can_request(FICADD);
|
||||
if ( $write ==0) {
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
}
|
||||
else
|
||||
if ( isset ($_POST["add_fiche"]) )
|
||||
{
|
||||
$User->can_request(FICADD);
|
||||
if ( $write ==0)
|
||||
{
|
||||
ShowRecherche();
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$fiche=new Fiche($cn);
|
||||
$fiche->Save($_REQUEST['fiche']);
|
||||
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
|
||||
echo '<DIV class="u_redcontent">';
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
}
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
else
|
||||
{
|
||||
ShowRecherche();
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$fiche=new Fiche($cn);
|
||||
$fiche->Save($_REQUEST['fiche']);
|
||||
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
|
||||
$fiche_def->myList();
|
||||
|
||||
|
||||
}
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Update a card
|
||||
if ( isset ($_POST["update_fiche"]) ) {
|
||||
$User->can_request(FIC);
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
else
|
||||
if ( isset ($_POST["update_fiche"]) )
|
||||
{
|
||||
$User->can_request(FIC);
|
||||
echo '<DIV class="u_redcontent">';
|
||||
if ( $write ==0)
|
||||
echo "<h2 class=\"error\"> Pas d'accès </h2>";
|
||||
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 '</DIV>';
|
||||
$recherche=false;
|
||||
echo '</DIV>';
|
||||
$recherche=false;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
// Move a card to a new category
|
||||
if ( isset($_POST['move'])){
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$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 '</div>';
|
||||
if ( isset($_POST['move']))
|
||||
{
|
||||
echo '<DIV class="u_redcontent">';
|
||||
$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 '</div>';
|
||||
}
|
||||
//--Search menu
|
||||
if ( $recherche==true) {
|
||||
ShowRecherche();
|
||||
if ( $recherche==true)
|
||||
{
|
||||
ShowRecherche();
|
||||
}
|
||||
html_page_stop();
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue