noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 07/16: Task #1054 - Menu to list


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 07/16: Task #1054 - Menu to list
Date: Fri, 21 Nov 2014 23:17:34 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 8bfecf7563350e8c47c6be455399c97a2daf8a6d
Author: Dany De Bontridder <address@hidden>
Date:   Sat Nov 22 00:10:59 2014 +0100

    Task #1054 -
    Menu to list
---
 include/anc_pa.inc.php            |  184 ++++++++++++++++++++-----------------
 include/cfgledger.inc.php         |   40 +++++---
 include/class_acc_ledger.php      |    7 +-
 include/class_acc_ledger_sold.php |    5 +-
 4 files changed, 129 insertions(+), 107 deletions(-)

diff --git a/include/anc_pa.inc.php b/include/anc_pa.inc.php
index 4945546..7ab1e18 100644
--- a/include/anc_pa.inc.php
+++ b/include/anc_pa.inc.php
@@ -43,8 +43,8 @@ if ( isset($_REQUEST['sa']))
         $new=new Anc_Plan($cn);
         if ( $new->isAppend() == true)
         {
-            $ret.= '<div class="redcontent">';
-            $ret.= '<h2 class="info">'._("Nouveau plan").'</h2>';
+            $ret.= '<div style="position:absolute;top:25%" class="inner_box">';
+            $ret.=HtmlInput::title_box(_('Nouveau plan'),'','none');
             $ret.= '<form method="post">';
             $ret.=dossier::hidden();
             $ret.= $new->form();
@@ -55,11 +55,12 @@ if ( isset($_REQUEST['sa']))
         }
         else
         {
-            $ret.= '<div class="redcontent">'.
-                   '<h2 class="info">'.
+            $ret.= '<div class="content">'.
+                   '<h2 class="notice">'.
                    _("Maximum de plan analytique est atteint").
                    "</h2></div>";
         }
+        $sa="anc_menu";
     }
     // Add
     if ( $sa == "pa_write")
@@ -69,7 +70,7 @@ if ( isset($_REQUEST['sa']))
 
         if ( $new->isAppend() == false)
         {
-            $ret.= '<h2 class="info">'.
+            $ret.= '<h2 class="notice">'.
                    _("Maximum de plan analytique est atteint").
                    "</h2>";
         }
@@ -80,28 +81,9 @@ if ( isset($_REQUEST['sa']))
             $new->description=$_POST['pa_description'];
             $new->add();
         }
+        $sa="anc_menu";
     }
-    // show the detail
-    if ( $sa == "pa_detail" )
-    {
-        $new=new Anc_Plan($cn,$_GET['pa_id']);
-        $wSa=HtmlInput::hidden("sa","pa_update");
-
-        $new->get();
-
-        $ret.= '<div class="redcontent">';
-        $ret.= '<h2 class="info">'._("Mise à jour").'</h2>';
-        $ret.= '<form method="post">';
-        $ret.=dossier::hidden();
-
-        $ret.= $new->form();
-        $ret.= $wSa;
-        $ret.=HtmlInput::submit("submit",_("Enregistre"));
-        
$ret.=HtmlInput::button_anchor(_('Efface'),"?ac=".$_REQUEST['ac']."&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",'Efface','onclick="return
 confirm(\'Effacer ?\')"');
-        $ret.= '</form>';
-        $ret.= '</div>';
-
-    }
+    
     // Update the PA
     if ( $sa == "pa_update" )
     {
@@ -109,9 +91,10 @@ if ( isset($_REQUEST['sa']))
         $new->name=$_POST['pa_name'];
         $new->description=$_POST['pa_description'];
         $new->update();
-        $ret='<div class="redcontent">';
+        $ret='<div class="content">';
         $ret.='<h2 class="info">'._('Mis à jour').'</h2>';
         $ret.="</div>";
+        $sa="anc_menu";
     }
     // show the form for add a poste
     if ( $sa=='po_add')
@@ -119,7 +102,7 @@ if ( isset($_REQUEST['sa']))
         $po=new Anc_Account($cn);
         $po->pa_id=$_REQUEST['pa_id'];
         $wSa=HtmlInput::hidden("sa","po_write");
-        $ret.='<div class="redcontent">';
+        $ret.='<div class="content">';
         $ret.='<form method="post">';
         $ret.=dossier::hidden();
         $ret.=$po->form();
@@ -127,6 +110,7 @@ if ( isset($_REQUEST['sa']))
         $ret.=HtmlInput::submit("add",_("Ajout"));
         $ret.="</form>";
         $ret.="</div>";
+        
     }
     // record the poste
     if ( $sa=="po_write")
@@ -135,7 +119,8 @@ if ( isset($_REQUEST['sa']))
         $po=new Anc_Account($cn);
         $po->get_from_array($_POST);
         $po->add();
-        $sa="list";
+        $sa="pa_detail";
+        
 
     }
     /* delete pa */
@@ -143,15 +128,17 @@ if ( isset($_REQUEST['sa']))
     {
         $delete=new Anc_Plan($cn,$_GET['pa_id']);
         $delete->delete();
+        $sa="anc_menu";
     }
     /* po detail
-     *
+     *---> in ajax : montre detail d'un poste analytique
+     * 
      */
     if ( $sa=="po_detail")
     {
         $po=new Anc_Account($cn,$_GET['po_id']);
         $po->get_by_id();
-        $ret.='<div class="redcontent">';
+        $ret.='<div class="content">';
         $ret.='<form method="post">';
         $ret.=dossier::hidden();
 
@@ -159,36 +146,61 @@ if ( isset($_REQUEST['sa']))
         $ret.=HtmlInput::hidden('sa','po_update');
         $ret.=HtmlInput::submit('Correction','Correction');
         $ret.=sprintf('<A class="mtitle" 
HREF="?ac='.$_REQUEST['ac'].'&sa=po_delete&po_id=%s&pa_id=%s&'.$str_dossier.'">'.
-                      '<input type="button" class="button" value="Efface" 
onClick="return confirm(\' Voulez-vous vraiment effacer cette 
activité\');"></A>',
+                      '<input type="button" class="smallbutton" value="Efface" 
onClick="return confirm(\' Voulez-vous vraiment effacer cette 
activité\');"></A>',
                       $po->id,
                       $_REQUEST['pa_id']
                      );
 
         $ret.='</form>';
         $ret.='</div>';
+        $sa="";
     }
+    /**
+     * mise à jour po 
+     */
     if ( $sa=="po_update")
     {
         $po=new Anc_Account($cn);
         $po->get_from_array($_POST);
         $po->update();
-        $sa="list";
+        $sa="pa_detail";
     }
+    /**
+     * Efface po
+     */
     if ( $sa=="po_delete")
     {
         $po=new Anc_Account($cn,$_REQUEST['po_id']);
         $po->delete();
-        $sa="list";
+        $sa="pa_detail";
     }
-    /* List poste */
-    if ( $sa == "list" )
+    // show the detail
+    if ( $sa == "pa_detail" )
     {
-        $count=0;
+        $new=new Anc_Plan($cn,$_GET['pa_id']);
+        $wSa=HtmlInput::hidden("sa","pa_update");
+
+        $new->get();
+
+        $ret.= '<div class="content">';
+        $ret.= '<h2 class="info">'._("Mise à jour").'</h2>';
+        $ret.= '<form method="post">';
+        $ret.=dossier::hidden();
+
+        $ret.= $new->form();
+        $ret.= $wSa;
+        $ret.=HtmlInput::submit("submit",_("Enregistre"));
+        
$ret.=HtmlInput::button_anchor(_('Efface'),"?ac=".$_REQUEST['ac']."&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",_('Efface'),'onclick="return
 confirm(\'Effacer ?\')"','smallbutton');
+        $ret.= '</form>';
+        /**
+         * Detail now
+         */
+            $count=0;
 
         $new=new Anc_Plan($cn,$_REQUEST['pa_id']);
         $new->get();
         $array=$new->get_poste_analytique(" order by po_name");
-        $ret.='<div class="redcontent">';
+        $ret.='<div class="content">';
         $ret.='<table class="table_large">';
         $ret.="<tr>";
         $ret.="<th>"._("Nom")." </td>";
@@ -222,76 +234,76 @@ if ( isset($_REQUEST['sa']))
 
         }
         $ret.="</table>";
-        
$ret.=HtmlInput::button_anchor(_('Ajout'),"?ac=".$_REQUEST['ac']."&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier);
-        $ret.='</div>';
-
+        // ---> montre form pour ajouter po
+        
$ret.=HtmlInput::button_anchor(_('Ajout'),"?ac=".$_REQUEST['ac']."&sa=po_add&pa_id=".$_GET['pa_id']."&".$str_dossier,'','','smallbutton');
+        
$href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier']));
+        $ret.= '<a style="display:inline" class="smallbutton" 
href="do.php?'.$href.'">'._('Retour').'</a>';
+        $ret.= '</div>';
+        
     }
-
 }
-
+else {
+    $sa="anc_menu";
+}
 
 //---------------------------------------------------------------------------
 // Show lmenu
 //
 //---------------------------------------------------------------------------
-$obj=new Anc_Plan($cn);
-$list=$obj->get_list();
-
-
+if ($sa=='anc_menu')
+{
 
+    $obj=new Anc_Plan($cn);
+    $list=$obj->get_list();
 
-if ( empty($list)  )
-{
-    echo '<div class="lmenu">';
-    echo '<TABLE>';
-    echo '<TR><TD class="vert_mtitle">';
-    echo '<a class="mtitle" 
href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">'._("Ajout d'un plan 
comptable").'</a>';
-    echo '</TD></TR>';
-    echo '</TABLE>';
 
-    echo '</div>';
-    if ( ! isset ( $_REQUEST['sa']))
-        echo '<div class="notice">'.
-        _("Aucun plan analytique n'est défini").
-        '</div>';
 
-}
-else
-{
-    echo '<div class="lmenu">';
 
-    echo '<table>';
-    foreach ($list as $line)
-    {
-        echo '<TR>';
-        echo '<TD class="vert_mtitle">'.
-        '<a class="mtitle" 
href="?ac='.$_REQUEST['ac'].'&sa=pa_detail&pa_id='.$line['id'].'&'.$str_dossier.'">'.
-        h($line['name']).
-        '</TD>';
-        echo '<td class="vert_mtitle">'.
-        '<a class="mtitle" 
href="?ac='.$_REQUEST['ac'].'&sa=list&pa_id='.$line['id'].'&'.$str_dossier.'">'.
-        "Activités".
-        "</a></td>";
-       echo '<TD>';
-       echo $line['description'];
-       echo '</TD>';
-        echo "</TR>\n";
-    }
-    echo '</table>';
-    if ($obj->isAppend()==true )
+    if (empty($list))
     {
+        echo '<div class="content">';
         echo '<TABLE>';
         echo '<TR><TD class="vert_mtitle">';
-        echo '<a class="mtitle" 
href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">'._("Ajout d'un plan 
comptable").'</a>';
+        echo '<a 
href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">'._("Ajout d'un plan 
comptable").'</a>';
         echo '</TD></TR>';
         echo '</TABLE>';
+
+        echo '</div>';
+        if (!isset($_REQUEST['sa']))
+            echo '<div class="notice">'.
+            _("Aucun plan analytique n'est défini").
+            '</div>';
     }
+    else
+    {
+        echo '<div class="content">';
 
+        echo '<table class="vert_mtitle">';
+        if ($obj->isAppend()==true)
+        {
+            echo '<TR><TD class="first">';
+            echo '<a 
href="?ac='.$_REQUEST['ac'].'&sa=add_pa&'.$str_dossier.'">'._("Ajout d'un plan 
comptable").'</a>';
+            echo '</TD></TR>';
+        }
+        foreach ($list as $line)
+        {
+            echo '<TR>';
+            echo '<TD>'.
+            '<a 
href="?ac='.$_REQUEST['ac'].'&sa=pa_detail&pa_id='.$line['id'].'&'.$str_dossier.'">'.
+            h($line['name']);
 
-    echo '</div>';
+            echo $line['description']."</a>";
+            echo "</td>";
+            echo "</TR>\n";
+        }
+        echo '</TABLE>';
+
+
+        echo '</div>';
+    }
 }
 //---------------------------------------------------------------------------
-// show the redcontent part
+// show the content part
 //
 //
 //---------------------------------------------------------------------------
diff --git a/include/cfgledger.inc.php b/include/cfgledger.inc.php
index 6ddbfaa..03abf1b 100644
--- a/include/cfgledger.inc.php
+++ b/include/cfgledger.inc.php
@@ -36,7 +36,7 @@ require_once 'class_acc_ledger.php';
 
 $gDossier=dossier::id();
 global $cn;
-
+$show_menu=1;
 $ledger=new Acc_Ledger($cn,-1);
 $sa=HtmlInput::default_value("sa","",$_REQUEST);
 //////////////////////////////////////////////////////////////////////////
@@ -50,6 +50,7 @@ if (isset($_POST['update']))
                if ( $ledger->load() == -1) throw new Exception (_('Journal 
inexistant'));
                $ledger->verify_ledger($_POST);
                $ledger->update($_POST);
+                $show_menu=1;
        } catch (Exception $e)
        {
                alert($e->getMessage());
@@ -71,6 +72,7 @@ if (isset($_POST['efface']))
                echo '<div id="jrn_name_div">';
                echo '<h2 id="jrn_name">'.h($name). "  est effacé"."</h2>";
                echo '</div>';
+                $show_menu=1;
        }
        catch (Exception $e)
        {
@@ -90,6 +92,7 @@ if (isset($_POST['add']))
                $ledger->save_new($_POST);
                $sa="detail";
                $_REQUEST['p_jrn']=$ledger->jrn_def_id;
+                $show_menu=1;
        }
        catch (Exception $e)
        {
@@ -97,12 +100,7 @@ if (isset($_POST['add']))
        }
 }
 
-//////////////////////////////////////////////////////////////////////////
-// Display list of ledgers
-//////////////////////////////////////////////////////////////////////////
-echo '<div class="lmenu">';
-echo $ledger->listing();
-echo '</div>';
+
 
 
 
@@ -116,14 +114,17 @@ switch ($sa)
                try
                {
                        $ledger->id=$_REQUEST['p_jrn'];
-                       echo '<div class="redcontent">';
+                       echo '<div class="content">';
                        echo '<form method="POST">';
                        echo $ledger->display_ledger();
-                       echo '<INPUT TYPE="SUBMIT" class="button" 
VALUE="'._("Sauve").'" name="update">
-                       <INPUT TYPE="RESET" class="button" VALUE="Reset">
-                       <INPUT TYPE="submit" class="button"  name="efface" 
value="'._("Efface").'" onClick="return confirm(\'Vous effacez ce journal 
?\')">';
+                       echo '<INPUT TYPE="SUBMIT" class="smallbutton" 
VALUE="'._("Sauve").'" name="update">
+                       <INPUT TYPE="RESET" class="smallbutton" VALUE="Reset">
+                       <INPUT TYPE="submit" class="smallbutton"  name="efface" 
value="'._("Efface").'" onClick="return confirm(\'Vous effacez ce journal 
?\')">';
+                        
$href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier']));
+                        echo '<a style="display:inline" class="smallbutton" 
href="do.php?'.$href.'">'._('Retour').'</a>';
                        echo '</FORM>';
                        echo "</div>";
+                        $show_menu=0;
                }
                catch (Exception $e)
                {
@@ -131,17 +132,24 @@ switch ($sa)
                }
                break;
        case 'add': /* Add a new ledger */
-               echo '<div class="redcontent">';
+               echo '<div class="content">';
                echo '<FORM METHOD="POST">';
                $ledger->input_new();
-               echo HtmlInput::submit('add','Sauver');
-               echo '<INPUT TYPE="RESET" class="button" VALUE="Reset">';
+               echo HtmlInput::submit('add',_('Sauver'));
+               echo '<INPUT TYPE="RESET" class="smallbutton" VALUE="Reset">';
                echo '</FORM>';
                echo "</DIV>";
+                $show_menu=0;
 }
 
-
-
+//////////////////////////////////////////////////////////////////////////
+// Display list of ledgers
+//////////////////////////////////////////////////////////////////////////
+if ( $show_menu == 1 ) {
+    echo '<div class="content">';
+    echo $ledger->listing();
+    echo '</div>';
+}
 
 
 html_page_stop();
diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php
index 03e258d..44a54b0 100644
--- a/include/class_acc_ledger.php
+++ b/include/class_acc_ledger.php
@@ -3358,8 +3358,9 @@ class Acc_Ledger extends jrn_def_sql
                $base_url = "?" . dossier::get() . "&ac=" . $_REQUEST['ac'];
 
                $r = "";
-               $r.='<TABLE>';
-               $r.='<TR><TD class="vert_mtitle"><A class="mtitle" HREF="' . 
$base_url . '&sa=add">' . _('Création') . ' </A></TD></TR>';
+                $r.=_('Filtre')." 
".HtmlInput::filter_table("cfgledger_table_id", "0", "1");
+               $r.='<TABLE id="cfgledger_table_id" class="vert_mtitle">';
+               $r.='<TR><TD class="first"><A HREF="' . $base_url . '&sa=add">' 
. _('Ajout journal') . ' </A></TD></TR>';
                $ret = $this->db->exec_sql("select distinct 
jrn_def_id,jrn_def_name,
                        jrn_def_class_deb,jrn_def_class_cred,jrn_def_type
                        from jrn_def order by jrn_def_name");
@@ -3370,7 +3371,7 @@ class Acc_Ledger extends jrn_def_sql
                {
                        $l_line = Database::fetch_array($ret, $i);
                        $url = $base_url . "&sa=detail&p_jrn=" . 
$l_line['jrn_def_id'];
-                       $r.=sprintf('<TR><TD class="vert_mtitle"><A 
class="mtitle" HREF="%s">%s</A></TD></TR>', $url, h($l_line['jrn_def_name']));
+                       $r.=sprintf('<TR><TD><A HREF="%s">%s</A></TD></TR>', 
$url, h($l_line['jrn_def_name']).' ('.$l_line['jrn_def_type'].')');
                }
                $r.= "</TABLE>";
                return $r;
diff --git a/include/class_acc_ledger_sold.php 
b/include/class_acc_ledger_sold.php
index 5d01d2b..3d98b1f 100644
--- a/include/class_acc_ledger_sold.php
+++ b/include/class_acc_ledger_sold.php
@@ -40,6 +40,7 @@ require_once('class_own.php');
 require_once('class_itva_popup.php');
 require_once('class_acc_ledger_fin.php');
 require_once 'class_stock_goods.php';
+require_once 'class_acc_ledger.php';
 
 /* !\brief Handle the ledger of sold,
  *
@@ -1356,6 +1357,6 @@ class Acc_Ledger_Sold extends Acc_Ledger {
         $a = new Acc_Ledger_Sold($cn, 2);
         echo $a->input();
     }
-
-}
+    
+        }
 



reply via email to

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