This file permit to use the AJAX function to fill up info from fiche. More...
Go to the source code of this file.
Functions | |
| function | ajax_card (p_dossier, f_id, p_operation, ctl, page) |
| this function get data from ajax_card.php and fill the hidden div with the return html string | |
| function | ajax_error_saldo (request, json) |
| function | ajax_get_failure (request, json) |
| callback function for ajax_get when fails | |
| function | ajax_get_success (request, json) |
| callback function for ajax_get when successuf | |
| function | ajax_saldo (p_ctl) |
| this function get the saldo | |
| function | ajax_success_saldo (request, json) |
| callback function for ajax | |
| function | ajaxFid (p_ctl) |
| this function fills the data from fid.php, | |
| function | clean_Fid (p_ctl) |
| clean the row (the label, price and vat) | |
| function | errorFid (request, json) |
| function | successFid (request, json) |
| callback function for ajax | |
This file permit to use the AJAX function to fill up info from fiche.
Definition in file ajax_fiche.js.
| function ajax_card | ( | p_dossier, | |
| f_id, | |||
| p_operation, | |||
| ctl, | |||
| page | |||
| ) |
this function get data from ajax_card.php and fill the hidden div with the return html string
| p_dossier | |
| f_id | fiche.f_id |
| p_operation | what to do : op : history of operation |
| ctl | : id of the div to show |
| page |
Definition at line 228 of file ajax_fiche.js.
References ajax_get_failure(), ajax_get_success(), and show.
{
$(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_error_saldo | ( | request, | |
| json | |||
| ) |
Definition at line 184 of file ajax_fiche.js.
References alert().
Referenced by ajax_saldo().
{
alert('erreur : ajax solde ');
}
| function ajax_get_failure | ( | request, | |
| json | |||
| ) |
callback function for ajax_get when fails
Definition at line 246 of file ajax_fiche.js.
References alert().
Referenced by ajax_card().
{
alert("Ajax do not work for ajax_get");
}
| function ajax_get_success | ( | request, | |
| json | |||
| ) |
callback function for ajax_get when successuf
Definition at line 238 of file ajax_fiche.js.
References show.
Referenced by ajax_card().
{
var answer=request.responseText.evalJSON(false);
$(answer.ctl).show();
$(answer.ctl).innerHTML=answer.html;
}
| function ajax_saldo | ( | p_ctl | ) |
this function get the saldo
| p_ctl | the ctrl where we take the quick_code |
Definition at line 191 of file ajax_fiche.js.
References ajax_error_saldo(), ajax_success_saldo(), jrn, trim(), and value.
Referenced by fill_fin_data(), and fill_fin_data_onchange().
{
var gDossier=$('gDossier').value;
var ctl_value=trim($(p_ctl).value);
var jrn=$('p_jrn').value;
queryString="FID="+ctl_value+"&op=saldo";
queryString=queryString+'&gDossier='+gDossier+'&j='+jrn;
queryString=queryString+'&ctl='+ctl_value;
/* alert(queryString); */
var action=new Ajax.Request (
"ajax_misc.php",
{
method:'get',
parameters:queryString,
onFailure:ajax_error_saldo,
onSuccess:ajax_success_saldo
}
);
}
| function ajax_success_saldo | ( | request, | |
| json | |||
| ) |
callback function for ajax
| request | : object request |
| json | : json answer |
Definition at line 215 of file ajax_fiche.js.
References value.
Referenced by ajax_saldo().
{
var answer=request.responseText.evalJSON(true);
$('first_sold').value=answer.saldo;
}
| function ajaxFid | ( | p_ctl | ) |
this function fills the data from fid.php,
| p_ctl | object : field of the input, possible object member
|
Definition at line 67 of file ajax_fiche.js.
References alert(), clean_Fid(), errorFid(), jrn, label, successFid(), trim(), and value.
Referenced by fill_data(), fill_data_onchange(), fill_fin_data(), fill_fin_data_onchange(), ICard::test_me(), and update_value().
{
try
{
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 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
}
);
}catch (e) {
alert(e.message);
alert(p_ctl);
}
}
| function clean_Fid | ( | p_ctl | ) |
clean the row (the label, price and vat)
| p_ctl | the calling ctrl |
Definition at line 31 of file ajax_fiche.js.
References value.
Referenced by ajaxFid().
| function errorFid | ( | request, | |
| json | |||
| ) |
Definition at line 54 of file ajax_fiche.js.
References alert().
Referenced by action_add_concerned_card(), action_remove_concerned(), action_save_concerned(), add_category(), ajaxFid(), dis_blank_card(), fill_ipopcard(), form_blank_card(), save_card(), save_card_category(), search_card(), search_get_card(), select_card_type(), and update_card().
{
alert('erreur : ajax fiche');
}
| function successFid | ( | request, | |
| json | |||
| ) |
callback function for ajax
| request | : object request |
| json | : json answer
{"answer":"ok",
"flabel":"none",
"name":"Chambre de commerce",
"ftva_id":"none",
"tva_id":" ",
"fPrice_sale":"none",
"sell":" ",
"fPrice_purchase":"none",
"buy":" "}
|
Definition at line 151 of file ajax_fiche.js.
References set_value().
Referenced by ajaxFid().
{
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);
}
}