noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 147/173: Error : duplicate function update_ro


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 147/173: Error : duplicate function update_row
Date: Mon, 22 Mar 2021 12:59:16 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 9c40c9df6866a4ef4b9c382ee1f37a06232b551b
Merge: feac9b1 99b6d77
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sun Jun 7 19:24:47 2020 +0200

    Error : duplicate function update_row

 html/image/{logo7300.png => logo7400.png}          | Bin 33648 -> 33498 bytes
 html/image/logo7400.xcf                            | Bin 0 -> 69520 bytes
 html/index.php                                     |   2 +-
 html/install.php                                   |   4 +-
 html/js/acc_ledger.js                              |  40 ++++
 html/js/card.js                                    | 201 ++++++++++++++++++++-
 html/js/lang/calendar-fr.js                        |  18 +-
 html/js/scripts.js                                 |  29 ++-
 html/style-classic.css                             |   7 +
 html/style-classic7.css                            |   6 +
 html/style-light.css                               |   6 +
 html/user_login.php                                |   2 +-
 include/ajax/ajax_card.php                         | 133 +++++++++++---
 include/ajax/ajax_ledger.php                       |  16 ++
 include/class/acc_ledger.class.php                 |  36 ++--
 include/class/acc_ledger_history_generic.class.php |   2 +-
 include/class/acc_ledger_purchase.class.php        |  22 ++-
 include/class/acc_operation.class.php              | 174 ++++++++++++++++++
 include/class/database.class.php                   |   8 +-
 include/class/extension.class.php                  |   2 +-
 include/class/fiche.class.php                      |  39 ++++
 include/class/pdf_operation.class.php              |   2 +-
 include/constant.php                               |   4 +-
 include/export/export_operation_pdf.php            |  35 ++++
 include/fiche.inc.php                              |  32 ++--
 include/lib/ac_common.php                          |  14 +-
 include/lib/config_file.php                        |   1 +
 include/lib/database_core.class.php                |   2 +
 include/lib/html_input.class.php                   |  17 +-
 include/lib/select_box.class.php                   | 123 ++++++++++---
 include/lib/sendmail_core.class.php                |  37 ++--
 include/recover.php                                |  23 ++-
 include/sql/patch/upgrade143.sql                   |   8 +
 include/sql/patch/upgrade36.sql                    |   3 +-
 include/template/ledger_detail_bottom.php          |  38 ++--
 include/template/result_cat_card_summary.php       |  38 +---
 36 files changed, 928 insertions(+), 196 deletions(-)

diff --cc html/js/card.js
index 71d8d4a,1ad8e4e..773c9a0
--- a/html/js/card.js
+++ b/html/js/card.js
@@@ -1022,3 -1053,169 +1051,169 @@@ function delete_card(obj) 
          }
      });
  }
+ /**
+  * Display a card , modify it , redraw the row
+  * before calling this function , it it neeed to have in the web page a 
hidden card_gdossier with the dossier id
+  * @param {type} p_fiche_id
+  * @returns {undefined}
+  */
+ function modify_card(p_fiche_id)
+ {
+     /* window with result */
+     card_layer++;
+ 
+     var content = 'card_' + card_layer;
+     var nTop = 170 + card_layer;
+     if (nTop > 300) {
+         nTop = 170;
+     }
+     var str_top = fixed_position(250, nTop)
+     var str_style = str_top + ";width:45em;height:auto;position:absolute";
+ 
+     var popup = {'id': content, 'cssclass': 'inner_box', 'style': str_style, 
'html': loading(), 'drag': false};
+ 
+     add_div(popup);
+     
+     /* dossier id */
+     if ( ! document.getElementById("card_gdossier")) {
+         
+         console.error("card_gdossier error");
+         throw ("card_gdossier not set");
+     }
+     var dossier = $('card_gdossier').value;
+ 
+     
+     var action = new Ajax.Request('ajax_misc.php',
+             {
+                 method: 'get',
+                 parameters: 
{'gDossier':dossier,"op":'card',"op2":"dc","f_id":p_fiche_id,'ctl':content,after_save:2}
 ,
+                 onFailure: errorFid,
+                 onSuccess: function (respTxt) {
+                     fill_box(respTxt);
+                 }
+             }
+     );
+ }
+ /**
+  * Delete a card and remove the row
+  * before calling this function , it it neeed to have in the web page a 
hidden card_gdossier with the dossier id
+  * @param {type} p_fiche_id
+  * @returns {undefined}
+  */
+ function delete_card_id(p_fiche_id)
+ {
+     var row="row_card"+p_fiche_id;
+     if ( ! document.getElementById("card_gdossier")) {
+         
+         console.error("card_gdossier error");
+         throw ("card_gdossier not set");
+     }
+     $(row).addClassName("background-selected");
+     var dossier = $('card_gdossier').value;
+     smoke.confirm(content[47], function (e) {
+         if (e) {
+             waiting_box();
+             new Ajax.Request("ajax_misc.php", {
+                 "method": "get",
+                 parameters: 
{'gDossier':dossier,"op":'card',"op2":"rm_card","f_id":p_fiche_id,'ctl':row} ,
+                 onSuccess: function (req) {
+                     remove_waiting_box();
+                     var table_card=$('fiche_tb_id');
+                     var answer = req.responseXML;
+                     var a = answer.getElementsByTagName('ctl');
+                     if (a.length == 0)
+                     {
+                         var rec = req.responseText;
+                         alert_box('erreur :' + rec);
+                     }
+                     var html = answer.getElementsByTagName('code');
+                     var namectl = a[0].firstChild.nodeValue;
+                     var nodeXml = html[0];
+                     var code_html = getNodeText(nodeXml);
+                     code_html = unescape_xml(code_html);
+                    
+                     if ((code_html) == "OK") {
+                         Effect.Fade(row, {duration: 0.1});
+                         table_card.tBodies[0].removeChild($(row));
+                         alternate_row_color("fiche_tb_id");
+                     } else {
+                         smoke.alert(code_html);
+                         
+                     }
+                 }
+                     
+             });
+         } else{ 
+                    $(row).removeClassName("background-selected");
+             
+         }
+     });
+   
+ }
+ 
+ /**
+ * update a card in ajax , and update a row
+ * 
+ */
 -function update_row(obj)
++function card_update_row(obj)
+ {
+     try {
+         var name = obj.id;
+ 
+         var qs = Form.serialize(name) + '&op2=upr&op=card';
+         var action = new Ajax.Request('ajax_misc.php',
+                 {
+                     method: 'get',
+                     parameters: qs,
+                     onFailure: errorFid,
+                     onSuccess: function (req) {
+                         try {
+ 
+                             remove_waiting_box();
+ 
+                             var answer = req.responseXML;
+                             var a = answer.getElementsByTagName('ctl');
+                             var html = answer.getElementsByTagName('code');
+                             if (a.length === 0) {
+                                 var rec = req.responseText;
+                                 alert_box('erreur :' + rec);
+                             }
+                             var name_ctl = "row_card" + obj.f_id.value;
+                             var code_html = getNodeText(html[0]); // Firefox 
ne prend que les 4096 car.
+                             code_html = unescape_xml(code_html);
+                             
+                             if ( document.getElementById(name_ctl)) {
+                                 // update the row
+                                 $(name_ctl).innerHTML = code_html;
+                                 new Effect.Highlight(name_ctl ,{startcolor: 
'#FAD4D4',endcolor: '#F78082' });
+                                 
+                             }
+                             $(a[0].firstChild.nodeValue).remove();
+                             
+                             
+                         } catch (e) {
+                             alert_box(e.message);
+                             if (console) {
+                                 console.error(e);
+                                 console.error("log answer = " + 
req.responseText);
+                             }
+                         }
+                         try {
+                             code_html.evalScripts();
+                         } catch (e) {
+                             if (console) {
+                                 console.error(e);
+                                 console.error("log answer = " + 
req.responseText);
+                             }
+                             alert_box(content[53] + "\n" + e.message);
+                         }
+                        
+                  
+                     }
+                 }
+         );
+     } catch (e) {
+         alert_box(e.message);
+         return false;
+     }
+ }
diff --cc include/ajax/ajax_card.php
index 9802158,2053f1a..11c6e70
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@@ -132,6 -132,29 +132,29 @@@ case 'dc'
      $f=new Fiche($cn);
      /* add title + close */
      $html=HtmlInput::title_box(_("Détail fiche"), $ctl,"close","","y");
+     
+     // if there is no qcode then try to find it thanks the card id
+     if ( ! isset ($qcode) ){
+         $f->id=$http->get("f_id","number");
+         $qcode=$f->get_quick_code();
+     }
+     
+     // after save , we can either show a card in readonly or update a row
+     $safter_save=$http->request("after_save","string","1");
+     switch ($safter_save)
+     {
+         case "1":
+             // show a card it readonly and fade it
+             $after_save="update_card(this)";
+             break;
+         case "2":
+             // update a row in the table X
 -            $after_save="update_row(this)";
++            $after_save="card_update_row(this)";
+             break;
+         default:
+             break;
+     }
+ 
      if ( $qcode != '')
      {
          $f->get_by_qcode($qcode);
diff --cc include/class/acc_ledger_purchase.class.php
index 44a5ea0,4365cfd..3a4ee02
--- a/include/class/acc_ledger_purchase.class.php
+++ b/include/class/acc_ledger_purchase.class.php
@@@ -988,14 -900,8 +990,15 @@@ class  Acc_Ledger_Purchase extends Acc_
                  $acc_pay->mt=$mt;
                  $acc_pay->desc=(!isset($e_comm_paiement) || 
strlen(trim($e_comm_paiement)) == 0) ?$e_comm:$e_comm_paiement;
                  
 +                // Add info for currency
 +                $acc_pay->currency_id=$p_currency_code;
 +                $acc_pay->currency_rate=$p_currency_rate;
 +                $acc_pay->currency_rate_ref=$currency_rate_ref->get_rate();
 +                
 +                
 +                // insert into the table JRN
                  $mp_jr_id=$acc_pay->insert_jrn();
+                 $this->payment_operation=$mp_jr_id;
                  $acjrn->grpt_id=$acseq;
                  $acjrn->update_internal_code($acinternal);
                  // add an automatic PJ if ODS
diff --cc include/class/fiche.class.php
index 635c25f,50bb3fb..cf3dea1
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@@ -2325,23 -2258,44 +2325,62 @@@ class Fich
          return _('Cherche').' '.HtmlInput::filter_table($p_table_id, 
'0,1,2,3,4,5,6,7,8,9,10', 1);
      }
      /**
 +     * Returns the Acc_Ledger_Fin ledger for which the card is the default 
bank account or null if no ledger is found.
 +     */
 +    function get_bank_ledger()
 +    {
 +        try {
 +            $id=$this->cn->get_value("select jrn_def_id from jrn_def where 
jrn_def_bank = $1 ",[$this->id]);
 +            if ($id == "") { return NULL;}
 +            $ledger=new Acc_Ledger_Fin($this->cn,$id);
 +            $ledger->load();
 +            return $ledger;
 +        }        
 +        catch (Exception $e) {
 +            record_log(__FILE__.":".__LINE__);
 +            record_log($e->getMessage());
 +            throw $e;
 +        }
 +    }
++    /**
+      * @brief display card as a table row , the tag TR must be added
+      * 
+      * @return HTMLT string starting
+      * 
+      */
+     function display_row()
+     {
+         $this->getAttribut();
+         foreach($this->attribut as $attr) {
+             $sort="";
+ 
+             if ($attr->ad_type!='select') 
+             {
+ 
+                 if ($attr->ad_type=="date") {
+                 // format YYYYMMDD
+                 $sort='sorttable_customkey="'.format_date($attr->av_text, 
"DD.MM.YYYY", "YYYYMMDD").'"';
+                 }
+                 elseif ($attr->ad_type=="poste"){
+                 $sort='sorttable_customkey="TEXT'.$attr->av_text.'"';
+                 }
+                 echo td($attr->av_text, 'style="padding: 0 10 1 
10;white-space:nowrap;" '.$sort);
+              }
+              else {
+                 $value=$this->cn->make_array($attr->ad_extra);
+                 $row_content="";
+                 for ($e=0; $e<count($value); $e++) {
+                     if ( $value[$e]['value']==$attr->av_text) {
+                         $row_content=h($value[$e]['label']);
+                         break;
+                     }
+                 }
+                 echo td($row_content, 'style="padding: 0 10 1 
10;white-space:nowrap;"');
+ 
+             }
+         }
+ 
+     }
  }
  
  ?>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]