From b5250247289407c04b951caa5536d85174c74507 Mon Sep 17 00:00:00 2001 From: Dany wm De Bontridder Date: Wed, 26 Oct 2022 22:08:50 +0200 Subject: [PATCH] Documentation & code cleaning Javascript --- html/js/accounting_item.js | 23 +---------------- html/js/ajax_fiche.js | 52 +++++++++++++++----------------------- html/js/anc_script.js | 28 ++++++++++---------- html/js/calc.js | 10 ++++---- html/js/card.js | 26 +++++++++---------- 5 files changed, 53 insertions(+), 86 deletions(-) diff --git a/html/js/accounting_item.js b/html/js/accounting_item.js index c2c0792b4..59d5a0478 100644 --- a/html/js/accounting_item.js +++ b/html/js/accounting_item.js @@ -18,27 +18,6 @@ /* $Revision$ */ // Copyright Author Dany De Bontridder danydb@aevalys.eu - -/*! \file - * \brief - * containing the javascript for opening a windows to search an account (poste comptable) - */ - -function set_poste_parent(p_ctl,p_value) -{ - var f=g(p_ctl); - f.value+='['+p_value+']'; -} - -function set_jrn_parent(p_ctl,p_value) -{ - var f=g(p_ctl); - if ( f ) - { - if ( trim(f.value)!="") f.value+=' '; - f.value+=p_value; - } -} /** * show the popup for search an accounting item *@param object this, it must contains some attribute as @@ -48,7 +27,7 @@ function set_jrn_parent(p_ctl,p_value) * - label the tag which will contains the label * - bracket if the value must be surrounded by [ ] * - acc_query for the initial query - *\see ajax_poste.php + *@see ajax_poste.php */ function search_poste(obj) { diff --git a/html/js/ajax_fiche.js b/html/js/ajax_fiche.js index b9b7f7c4e..a69972b4a 100644 --- a/html/js/ajax_fiche.js +++ b/html/js/ajax_fiche.js @@ -19,14 +19,15 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/*! \file - * \brief This file permit to use the AJAX function to fill up +/* + * This file permit to use the AJAX function to fill up * info from fiche * */ -/*!\brief clean the row (the label, price and vat) - * \param p_ctl the calling ctrl +/** + * clean the row (the label, price and vat) + * @param p_ctl the calling ctrl */ function clean_Fid(p_ctl) { @@ -55,14 +56,15 @@ function errorFid(request,json) { alert_box('ERRFID'+content[48]); } -/*!\brief this function fills the data from fid.php, - * \param p_ctl object : field of the input, +/** + * this function fills the data from fid.php, + * @param {object} p_ctl : field of the input, * possible object member * - label field to update with the card's name * - price field to update with the card's price * - tvaid field to update with the card's tva_id * - jrn field to force the ledger - *\see successFid errorFid fid.php + *@see successFid errorFid fid.php */ function ajaxFid(p_ctl) { @@ -134,10 +136,11 @@ function ajaxFid(p_ctl) } } -/*!\brief callback function for ajax - * \param request : object request - * \param json : json answer -\verbatim +/** + callback function for ajax + * @param request : object request + * @param json : json answer +@verbatim {"answer":"ok", "flabel":"none", "name":"Chambre de commerce", @@ -147,7 +150,7 @@ function ajaxFid(p_ctl) "sell":" ", "fPrice_purchase":"none", "buy":" "} -\endverbatim +@endverbatim */ function successFid(request,json) { @@ -221,22 +224,9 @@ function ajax_success_saldo(request,json) $('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 -* \param f_id fiche.f_id -* \param p_operation what to do : op : history of operation -* \param ctl : id of the div to show -* \param page -*/ -//function _saajax_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 + +/** + * callback function for ajax_get when successuf */ function ajax_get_success(request,json) { @@ -290,9 +280,9 @@ category_card.add_attribut=function (p_dossier,p_fiche_def_ref,p_object_name) { /** * Remove an attribute (id:p_object_name+"_elt"+ad_id (ad_id = attr_def.ad_id)) * from the list (id:p_object_name+"list") - * @param int p_dossier dossier nb - * @param string p_object_name , name of the prefix for id - * @param int p_fiche_def_ref is the frd_id + * @param {int} p_dossier dossier nb + * @param {string} p_object_name , name of the prefix for id + * @param {int} p_fiche_def_ref is the frd_id * @param {type} p_attribute_id */ category_card.remove_attribut=function (p_dossier,p_fiche_def_ref,p_object_name,p_attribute_id) { diff --git a/html/js/anc_script.js b/html/js/anc_script.js index 41015f741..d2765bd7c 100644 --- a/html/js/anc_script.js +++ b/html/js/anc_script.js @@ -24,7 +24,8 @@ * javascript for the analytic accountancy */ -/*!\brief add a row for the CA +/** + * add a row for the CA * \param p_table_id * \param p_amount amount to reach */ @@ -71,8 +72,8 @@ function add_row(p_table, p_seq) } /** *Compute total of a form from Anc_Operation::display_form_plan - *@param p_table table id - *@param seq sequence of the line + *@param {dom_id} p_table table id + *@param {int}seq sequence of the line *@see Anc_Operation::display_form_plan */ function compute_total_table(p_table, seq) @@ -134,12 +135,12 @@ function anc_refresh_remain(p_table, p_seq) alert_box(a.message); } } -/*! - * \brief Check the amount of the CA - * \param p_style : error or ok, if ok show a ok box if the amount are equal +/** + * Check the amount of the CA + * @param p_style : error or ok, if ok show a ok box if the amount are equal * * - * \return true if the amounts are equal + * @returns true if the amounts are equal */ function verify_ca(div) { @@ -208,14 +209,11 @@ function verify_ca(div) return false; } } -/*! - * \brief open a window for searching a CA account, - * \param p_dossier dossier id - * \param p_target ctrl to update - * \param p_source ctrl containing the pa_id - * - * - * \return +/*** + * open a window for searching a CA account, + * @param p_dossier dossier id + * @param p_target ctrl to update + * @param p_source ctrl containing the pa_id */ function search_ca(p_dossier, p_target, p_source) { diff --git a/html/js/calc.js b/html/js/calc.js index 66b49d382..d62f80afa 100644 --- a/html/js/calc.js +++ b/html/js/calc.js @@ -49,11 +49,11 @@ function cal() p_variable=p_variable.replace(/%/,''); p_variable=p_variable.replace(/;/,''); p_variable=p_variable.replace(/>/,''); - p_variable=p_variable.replace(/ /g,""); - p_variable=p_variable.replace(/\+/g,"+ "); - p_variable=p_variable.replace(/-/g,"- "); - p_variable=p_variable.replace(/\//g,"/ "); - p_variable=p_variable.replace(/,/g,"."); + p_variable=p_variable.replace(/ /g,""); + p_variable=p_variable.replace(/\+/g,"+ "); + p_variable=p_variable.replace(/-/g,"- "); + p_variable=p_variable.replace(/\//g,"/ "); + p_variable=p_variable.replace(/,/g,"."); sub=eval(p_variable); var result=parseFloat(sub); diff --git a/html/js/card.js b/html/js/card.js index e3b11efee..a6fee8619 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -19,7 +19,7 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu -/*! \file +/** \file * \brief javascript for searching a card */ @@ -486,15 +486,16 @@ function result_card_search(req) -/*!\brief Set the value of 2 input fields +/** + * Set the value of 2 input fields * * Set the quick code in the first ctrl and the label of the quickcode in the second one. This function is a variant of SetData for * some specific need. This function is called if the caller is searchcardCtrl * -*\param p_ctrl the input with the name of the quick code -*\param p_quickcode the found quick_code -*\param p_ctrlname the name of the input field with the label -*\param p_label the label of the quickcode +*@param p_ctrl the input with the name of the quick code +*@param p_quickcode the found quick_code +*@param p_ctrlname the name of the input field with the label +*@param p_label the label of the quickcode */ function setCtrl(p_ctrl,p_quickcode,p_ctrlname,p_label) { @@ -512,8 +513,9 @@ function setCtrl(p_ctrl,p_quickcode,p_ctrlname,p_label) -/*!\brief clean the row (the label, price and vat) - * \param p_ctl the calling ctrl +/** + * clean the row (the label, price and vat) + * @param p_ctl the calling ctrl */ function clean_Fid(p_ctl) { @@ -644,10 +646,8 @@ function fill_ipopcard(obj) } /** * - * \param request : object request - * \param json : json answer -\code -\endcode + * @param request : object request + * @param json : json answer */ function successFill_ipopcard(req,json) { @@ -683,7 +683,7 @@ function successFill_ipopcard(req,json) } } /** - *@brief show the ipopup for selecting a card type, it is a needed step before adding + * show the ipopup for selecting a card type, it is a needed step before adding * a card *@param input field (obj) it must have the attribute ipopup * possible attribute :