noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 05/10: Task #748 - Paramètre -> journaux, en


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 05/10: Task #748 - Paramètre -> journaux, en cas d'erreur les anciennes données sont effacées Verifie choix du journal et permet de réintroduire, certaines valeurs sont gardées mais pas toutes, trop compliqué
Date: Thu, 27 Nov 2014 22:55:06 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 598914fe8436504cb5ba2b49840a849f6363acf4
Author: Dany De Bontridder <address@hidden>
Date:   Thu Nov 27 14:02:10 2014 +0100

    Task #748 - Paramètre -> journaux, en cas d'erreur les anciennes données 
sont effacées
    Verifie choix du journal et permet de réintroduire, certaines valeurs sont 
gardées mais pas toutes, trop compliqué
---
 include/class_acc_ledger.php            |   17 +++++++++++++++--
 include/class_anc_operation.php         |   28 +++++++++++++++-------------
 include/class_html_input.php            |    3 ++-
 include/template/form_ledger_detail.php |    8 ++++----
 include/template/ledger_detail_top.php  |    7 +++++--
 include/template/param_jrn.php          |    7 +++++++
 6 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php
index 728ee22..c06ff88 100644
--- a/include/class_acc_ledger.php
+++ b/include/class_acc_ledger.php
@@ -3500,6 +3500,9 @@ class Acc_Ledger extends jrn_def_sql
                                if ($result == 1)
                                        throw new Exception(_("Aucun compte en 
banque n'est donné"));
                        }
+                        if ($p_jrn_type == "-1") {
+                            throw new Exception(_('Choix du type de journal 
est obligatoire'));
+                        }
                }
                catch (Exception $e)
                {
@@ -3573,6 +3576,14 @@ class Acc_Ledger extends jrn_def_sql
         */
        function input_new()
        {
+            $retry=HtmlInput::default_value_post("sa", "");
+//            if ( $retry == "add") {
+                $default_type=HtmlInput::default_value_post("p_jrn_type", -1);
+                
$previous_jrn_def_pj_pref=HtmlInput::default_value_post("jrn_def_pj_pref","");
+                
$previous_p_description=HtmlInput::default_value_post("p_description","");
+                
$previous_p_jrn_name=HtmlInput::default_value_post('p_jrn_name','');
+                $previous_p_jrn_type = 
HtmlInput::default_value_post("p_jrn_type","");
+//            }
                 global $g_user;
                 $f_add_button=new ISmallButton('add_card');
                 $f_add_button->label=_('Créer une nouvelle fiche');
@@ -3619,7 +3630,7 @@ class Acc_Ledger extends jrn_def_sql
                $hidden.=HtmlInput::hidden('p_ech_lib', 'echeance');
 
                /* properties of the ledger */
-               $name = "";
+               $name = $previous_p_jrn_name;
                $code = "";
                $wType = new ISelect();
                 $a_jrn= $this->db->make_array("select '-1',' -- "._("choix du 
type de journal")." -- ' union select jrn_type_id,jrn_desc from jrn_type");
@@ -3628,17 +3639,19 @@ class Acc_Ledger extends jrn_def_sql
                $wType->name = "p_jrn_type";
                $wType->id= "p_jrn_type_select_id";
                 $wType->javascript=' onchange="show_ledger_div()"';
+                $wType->selected=$default_type;
                $type = $wType->input();
                $rcred = $rdeb = array();
                 $wPjPref = new IText();
                $wPjPref->name = 'jrn_def_pj_pref';
+                $wPjPref->value=$previous_jrn_def_pj_pref;
                $pj_pref = $wPjPref->input();
                $pj_seq = '';
                $last_seq = 0;
                $new = 1;
                 $description=new ITextarea('p_description');
                 $description->style='class="itextarea" style="margin:0px;"';
-                $description->value="";
+                $description->value=$previous_p_description;
                 $str_description=$description->input();
                /* bank card */
                $qcode_bank = '';
diff --git a/include/class_anc_operation.php b/include/class_anc_operation.php
index cd56324..6fa9278 100644
--- a/include/class_anc_operation.php
+++ b/include/class_anc_operation.php
@@ -147,9 +147,9 @@ class Anc_Operation
         $cond_poste="";
 
         if ($p_from!="")
-            $cond="and jr_date >= to_date('$p_from','DD.MM.YYYY') ";
+            $cond="and (jr_date >= to_date('$p_from','DD.MM.YYYY')  or oa_date 
>= to_date('$p_from','DD.MM.YYYY') )";
         if ( $p_to!="" )
-            $cond.="and jr_date <=to_date('$p_to','DD.MM.YYYY')";
+            $cond.="and (jr_date <=to_date('$p_to','DD.MM.YYYY') or  oa_date 
<=to_date('$p_to','DD.MM.YYYY')) ";
 
         if ($p_from_poste != "" )
             $cond_poste=" and upper(po_name) >= upper('".$p_from_poste."')";
@@ -159,12 +159,13 @@ class Anc_Operation
         if ( isset ( $this->pa_id) && $this->pa_id !='')
             $pa_id_cond= "pa_id=".$this->pa_id." and";
        $sql="
+        
        select oa_id,
        po_name,
        oa_description,
        po_description,
        oa_debit,
-       to_char(jr_date,'DD.MM.YYYY') as oa_date,
+       (case when jr_date is not null then to_char(jr_date,'DD.MM.YYYY') else 
to_char(oa_date,'DD.MM.YYYY') end )  as oa_date,
        oa_amount,
        oa_group,
        j_id ,
@@ -173,7 +174,8 @@ class Anc_Operation
        jr_comment,
        j_poste,
        jrnx.f_id,
-       ( select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) 
as qcode
+       ( select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) 
as qcode,
+        jr_pj_number
        from operation_analytique as B join poste_analytique using(po_id)
        left join jrnx using (j_id)
        left join jrn on  (j_grpt=jr_grpt_id)
@@ -253,18 +255,18 @@ class Anc_Operation
                     $ret.='</table>';
 
                 }
-                $ret.='<table id="'.$row['oa_group'].'" 
style="margin-bottom:2px;border: 1px solid blue; width: 90%;">';
+                $ret.='<table id="'.$row['oa_group'].'" class="result">';
 
-                $ret.="<th>".
-                      $row['oa_date'].
-                      "</th>".
-                      "<th>".
-                      h($row['oa_description']).
-                      "</th>";
+                $ret.="<tr class=\"highlight\">".
+                      td($row['oa_date']).
+                      "<td>".
+                      HtmlInput::detail_op($row['jr_id'],  
h($row['oa_description']." ".$row['jr_pj_number'])).
+                      "</td>".
+                        td();
 
-                $ret.="<th>".
+                $ret.="<td>".
                       "Groupe id : ".$row['oa_group'].
-                      "</th>";
+                      "</td>".
 
                 $oldgroup=$group;
 
diff --git a/include/class_html_input.php b/include/class_html_input.php
index 202846b..ee40566 100755
--- a/include/class_html_input.php
+++ b/include/class_html_input.php
@@ -352,6 +352,7 @@ class HtmlInput
         echo '</form>';
         echo '</div>';
         echo '</div>';
+  
         $ret=ob_get_contents();
         ob_end_clean();
         return $ret;
@@ -427,7 +428,7 @@ class HtmlInput
     {
        $r='';
        $r.='<div 
style="float:right;margin-right:2px;margin-top:5px;padding:0px;">';
-       $r.= '<A id="close_div" class="input_text" HREF="javascript:void(0)" 
onclick="removeDiv(\''.$div.'\');">'._('Fermer').'</A>';
+       $r.= '<A id="close_div" class="input_text" 
onclick="removeDiv(\''.$div.'\');">'._('Fermer').'</A>';
        $r.='</div>';
        return $r;
     }
diff --git a/include/template/form_ledger_detail.php 
b/include/template/form_ledger_detail.php
index cc2e6ce..3ce1032 100644
--- a/include/template/form_ledger_detail.php
+++ b/include/template/form_ledger_detail.php
@@ -103,21 +103,21 @@ echo '</tr>';
 ?>
 </table>
 
-<div 
style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;color:blue">
+<div 
style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold">
       <?php echo 
HtmlInput::button('act',_('Actualiser'),'onClick="compute_all_ledger();"'); ?>
  </div>
 
-    <div 
style="position:float;float:right;text-align:left;font-size:1.2em;font-weight:bold;color:blue"
 id="sum">
+    <div 
style="position:float;float:right;text-align:left;font-size:1.2em;font-weight:bold;"
 id="sum">
     <br><span id="htva">0.0</span>
 <?php
     if ( $flag_tva=='Y' )  : ?>
      <br><span id="tva">0.0</span>
-    <br><span id="tvac">0.0</span>
+    <br><span id="tvac" >0.0</span>
 <?php    endif;     ?>
 
  </div>
 
-<div 
style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;color:blue">
+<div 
style="position:float;float:right;text-align:right;padding-right:5px;font-size:1.2em;font-weight:bold;">
 <?php
        if ( $flag_tva =='Y') :
        ?>
diff --git a/include/template/ledger_detail_top.php 
b/include/template/ledger_detail_top.php
index 66e56b0..f569746 100644
--- a/include/template/ledger_detail_top.php
+++ b/include/template/ledger_detail_top.php
@@ -6,9 +6,12 @@
    if ($div != "popup") {
      $callback=$_SERVER['PHP_SELF'];
      $str=$_SERVER['QUERY_STRING']."&act=$action&ajax=$callback";
-     echo '<A id="close_div" onclick="var 
a=window.open(\'popup.php?'.$str.'\',\'\',\'location=no,toolbar=no,fullscreen=yes,scrollbars=yes,resizable=yes,status=no\');
 a.focus();removeDiv(\''.$div.'\')">
+     $msg_close=_('Fermer');
+     $msg_pop=_('Ouvrir dans une fenêtre séparée');
+     
+     echo '<A id="close_div" title="'.$msg_pop.'" onclick="var 
a=window.open(\'popup.php?'.$str.'\',\'\',\'location=no,toolbar=no,fullscreen=yes,scrollbars=yes,resizable=yes,status=no\');
 a.focus();removeDiv(\''.$div.'\')">
 !pop me out ! </A>';
-     echo '<A id="close_div" 
onclick="removeDiv(\''.$div.'\');">'._("Fermer").'</A>';
+     echo '<A id="close_div" title="'.$msg_close.'"  
onclick="removeDiv(\''.$div.'\');">'._("Fermer").'</A>';
    }
 ?>
 </div>
diff --git a/include/template/param_jrn.php b/include/template/param_jrn.php
index fcd464e..d07c7ed 100644
--- a/include/template/param_jrn.php
+++ b/include/template/param_jrn.php
@@ -379,5 +379,12 @@ echo $str_add_button;
    }
     hide_ledger();
     hide_row();
+    <?php
+    if (isset ($previous_p_jrn_type)  ):
+    ?>
+      show_ledger_div();              
+    <?php
+    endif;
+    ?>
 </script>
 <?php endif; ?>



reply via email to

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