phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4315 - in phpcompta/trunk: html html/js include include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4315 - in phpcompta/trunk: html html/js include include/template
Date: Sat, 5 Nov 2011 00:42:32 +0100 (CET)

Author: danydb
Date: 2011-11-05 00:42:31 +0100 (Sat, 05 Nov 2011)
New Revision: 4315

Modified:
   phpcompta/trunk/html/ajax_card.php
   phpcompta/trunk/html/js/card.js
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/include/adm.inc.php
   phpcompta/trunk/include/client.inc.php
   phpcompta/trunk/include/template/category_of_card.php
Log:

Improve Cat. of customer, adm...

Modified: phpcompta/trunk/html/ajax_card.php
===================================================================
--- phpcompta/trunk/html/ajax_card.php  2011-11-04 21:46:45 UTC (rev 4314)
+++ phpcompta/trunk/html/ajax_card.php  2011-11-04 23:42:31 UTC (rev 4315)
@@ -398,13 +398,8 @@
         }
 
         $html='';
-        $html.="<h2>"._("Ajout d'une catégorie")."  ".$msg."</h2>";
         /*  show the form */
-        $html.= '<div class="u_content">';
-        $html.=$ctl;
-        $html.= '<form id="newcat" name="newcat" method="post" 
onsubmit="this.ipopup=\''.$ipopup.'\';save_card_category(this);return false;">';
-        $html.= dossier::hidden();
-        $html.=HtmlInput::hidden('cat',$cat);
+
         $search=new IPoste("class_base");
         $search->size=40;
         $search->value=$base;
@@ -413,17 +408,14 @@
         $search->set_attribute('account',$search->name);
         $search->set_attribute('ipopup','ipop_account');
 
+               $nom_mod=new IText("nom_mod");
         $str_poste=$search->input();
+        $submit=HtmlInput::submit('save',_('Sauve'));
         ob_start();
         require('template/category_of_card.php');
         $html.=ob_get_contents();
         ob_clean();
-        $submit=HtmlInput::submit('save',_('Sauve'));
-        $html.= '<p>';
-        $html.= $submit;
-        $html.= '</p>';
-        $html.= '</form>';
-        $html.= '</div>';
+
     }
     else
     {
@@ -438,29 +430,29 @@
     $html='';
     if ( $user->check_action(FICCAT) == 1 )
     {
-        if ( strlen(trim($_POST['nom_mod'])) != 0 &&
-                strlen(trim($_POST['class_base'])) != 0 )
+               $script=create_script("removeDiv('$ctl')");
+               $html.=$script;
+        if ( strlen(trim($_GET['nom_mod'])) != 0 &&
+                strlen(trim($_GET['class_base'])) != 0 )
         {
             $array=array("FICHE_REF"=>$cat,
-                         "nom_mod"=>$_POST['nom_mod'],
-                         "class_base"=>$_POST['class_base']);
+                         "nom_mod"=>$_GET['nom_mod'],
+                         "class_base"=>$_GET['class_base']);
             if ( isset ($_POST['create'])) $array['create']=1;
             $catcard=new Fiche_Def($cn);
             if ( $catcard->Add($array) == -1)
-                $html.="alert('"._('Catégorie existe déjà')."')";
+                $script="alert('"._('Catégorie existe déjà')."')";
             else
-                $html.="alert('"._('Catégorie sauvée')."')";
-            $html.=create_script($html);
+                $script="alert('"._('Catégorie sauvée')."')";
+            $html.=create_script($script);
         }
         else
         {
-            $html.="alert('"._("Le nom et la classe base ne peuvent être 
vide")."')";
-            $html.=create_script($html);
+            $script="alert('"._("Le nom et la classe base ne peuvent être 
vide")."')";
+            $html.=create_script($script);
 
             $invalid=1;
         }
-        $ipop=str_replace('_content','',$ctl);
-        $html.=create_script('hideIPopup(\''.$ipop.'\');');
     }
     else
     {

Modified: phpcompta/trunk/html/js/card.js
===================================================================
--- phpcompta/trunk/html/js/card.js     2011-11-04 21:46:45 UTC (rev 4314)
+++ phpcompta/trunk/html/js/card.js     2011-11-04 23:42:31 UTC (rev 4315)
@@ -397,7 +397,7 @@
         filter=-1;
     }
     var content="select_card_div";
-    if ( $(content)){ removeDiv(content);}
+    if ( $(content)){removeDiv(content);}
     var sx=0;
     if ( window.scrollY)
     {
@@ -529,12 +529,29 @@
  */
 function add_category(obj)
 {
+    var sx=0;
+       if ( window.scrollY)
+       {
+            sx=window.scrollY+120;
+       }
+       else
+       {
+            sx=document.body.scrollTop+120;
+       }
+
+       var div_style="top:"+sx+";width:60%;heigth:80%";
     // show ipopup
-    showIPopup(obj.ipopup);
+       var div={id:obj.ipopup,
+                       cssclass:"op_detail",drag:1,style:div_style};
+       if ( $(div) ) {
+               removeDiv(div);
+       }
+       add_div(div);
+       waiting_box();
     var dossier=$('gDossier').value;
     var queryString='gDossier='+dossier;
     queryString+='&op=ac';
-    queryString+='&ctl='+obj.ipopup+'_content';
+    queryString+='&ctl='+obj.ipopup;
     if ( obj.type_cat)
     {
         queryString+='&cat='+obj.type_cat;
@@ -544,7 +561,7 @@
                                   method:'get',
                                   parameters:queryString,
                                   onFailure:errorFid,
-                                  onSuccess:successFill_ipopcard
+                                  onSuccess:fill_box
                                   }
                                 );
 
@@ -560,25 +577,29 @@
         alert('Erreur pas d\' attribut ipopup '+obj.id);
         return;
     };
-    var content=$(obj).ipopup+'_content';
-    // Data must be taken here
+       try {
+               // Data must be taken here
+
     data=$('newcat').serialize(false);
-    $(content).innerHTML=loading();
-    showIPopup($(obj).ipopup);
     var dossier=$('gDossier').value;
-    var queryString='?';
-    queryString+='&ctl='+content+'&';
+    queryString='ctl='+obj.ipopup+'&';
     queryString+=data;
     queryString+='&op=scc';    // sc for save card
 
     var action=new Ajax.Request ( 'ajax_card.php',
                                   {
-                                  method:'post',
+                                  method:'get',
                                   parameters:queryString,
                                   onFailure:errorFid,
-                                  onSuccess:successFill_ipopcard
+                                  onSuccess:fill_box
                                   }
                                 );
+       } catch(e)
+       {
+               alert(e.message);
+               return false;
+       }
+       return false;
 }
 /**
  address@hidden Remove a definition of an  attribut

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2011-11-04 21:46:45 UTC (rev 4314)
+++ phpcompta/trunk/html/js/scripts.js  2011-11-04 23:42:31 UTC (rev 4315)
@@ -293,47 +293,6 @@
     w.focus();
 }
 /**
- address@hidden show the popup. The top property is adapted if you've scrolled 
the window
- address@hidden name of the object PHP IPopup
- */
-function showIPopup(p_name)
-{
-    var sx=0;
-    if ( window.scrollY)
-    {
-        sx=window.scrollY+40;
-    }
-    else
-    {
-        sx=document.body.scrollTop+40;
-    }
-    $(p_name+'_border').style.top=sx;
-    if ( g(p_name+'_fond') )
-    {
-        show(p_name+'_fond');
-    }
-    show(p_name+'_border');
-    show(p_name+'_content');
-}
-/**
- address@hidden hide the popup
- address@hidden name of the object PHP IPopup
- */
-function hideIPopup(p_name)
-{
-    g(p_name+'_content').innerHTML=loading();
-    if (g(p_name+'_fond'))
-    {
-        hide(p_name+'_fond');
-    }
-    if (g(p_name+'_border'))
-    {
-        hide(p_name+'_border');
-    }
-    hide(p_name+'_content');
-
-}
-/**
  address@hidden replace the special characters (><'") by their HTML 
representation
  address@hidden a string without the offending char.
  */

Modified: phpcompta/trunk/include/adm.inc.php
===================================================================
--- phpcompta/trunk/include/adm.inc.php 2011-11-04 21:46:45 UTC (rev 4314)
+++ phpcompta/trunk/include/adm.inc.php 2011-11-04 23:42:31 UTC (rev 4315)
@@ -80,9 +80,10 @@
     $a=(isset($_GET['query']))?$_GET['query']:"";
     printf (_('Recherche').' <input class="input_text" type="text" 
name="query" value="%s">',
             $a);
+       echo HtmlInput::request_to_hidden(array('ac'));
     $sel_card=new ISelect('cat');
     $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
-                                     ' where  frd_id='.FICHE_TYPE_ADM_TAX.
+                                     ' where  frd_id='.FICHE_TYPE_ADM_TAX.' or 
frd_id ='.FICHE_TYPE_FIN.
                                      ' order by fd_label ',1);
     $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
     $sel_card->javascript=' onchange="submit(this);"';
@@ -90,7 +91,7 @@
 
     ?>
     <input type="submit" class="button" name="submit_query" 
value="<?=_('recherche')?>">
-                                           <input type="hidden" 
name="p_action" value="adm">
+        <input type="hidden" name="p_action" value="adm">
                                                                      </form>
                                                                      </span>
                                                                      <?php
@@ -98,7 +99,7 @@
     $search=(isset($_GET['query']))?$_GET['query']:"";
     $sql="";
     if ( isset($_GET['cat']))
-{
+       {
         if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
     }
 

Modified: phpcompta/trunk/include/client.inc.php
===================================================================
--- phpcompta/trunk/include/client.inc.php      2011-11-04 21:46:45 UTC (rev 
4314)
+++ phpcompta/trunk/include/client.inc.php      2011-11-04 23:42:31 UTC (rev 
4315)
@@ -31,18 +31,8 @@
 require_once('class_fiche_def.php');
 require_once('class_ipopup.php');
 
-echo ICard::ipopup('ipop_newcard');
-$ip_cat = new IPopup('ipop_cat');
-$ip_cat->title = _('Ajout d\'une catégorie');
-$ip_cat->value = '';
-echo $ip_cat->input();
-echo IPoste::ipopup('ipop_account');
-$search_card = new IPopup('ipop_card');
-$search_card->title = _('Recherche de fiche');
-$search_card->value = '';
-echo $search_card->input();
-echo ICard::ipopup('ipopcard');
 
+
 $low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
 /* ! \file
  * \brief Called from the module "Gestion" to manage the customer
@@ -134,14 +124,15 @@
     $f_cat_button->label=_('Ajout d\'une catégorie');
     $f_cat_button->javascript='add_category(this)';
     echo $f_cat_button->input();
+
+       echo '</div>';
     echo '</div>';
-    echo '</div>';
 
 
 }
 /*----------------------------------------------------------------------
  * Detail for a card, Suivi, Contact, Operation,... *
- * cc stands for customer card 
+ * cc stands for customer card
  *----------------------------------------------------------------------*/
 if ( $low_action == 'detail')
 {

Modified: phpcompta/trunk/include/template/category_of_card.php
===================================================================
--- phpcompta/trunk/include/template/category_of_card.php       2011-11-04 
21:46:45 UTC (rev 4314)
+++ phpcompta/trunk/include/template/category_of_card.php       2011-11-04 
23:42:31 UTC (rev 4315)
@@ -1,7 +1,20 @@
-<TABLE BORDER="0" CELLSPACING="0">
+<div 
style="float:right;height:10px;display:block;margin-top:2px;margin-right:2px">
+<?
+     echo '<A style="background-color:blue;color:white;text-decoration:none" 
HREF="javascript:void(0)" onclick="removeDiv(\''.$ctl.'\');">Fermer</A>';
+?>
+</div>
+   <? echo h2info(_("Ajout d'une catégorie").$msg); ?>
+
+<div class="content">
+<form id="newcat" name="newcat" method="get" 
onsubmit="this.ipopup='<?=$ipopup?>';save_card_category(this);return false;">
+<?
+ echo HtmlInput::get_to_hidden(array('gDossier','cat'));
+ ?>
+
+       <TABLE BORDER="0" CELLSPACING="0">
 <TR>
    <TD><?=_('Nom de la catégorie de fiche')?> </TD>
-<TD><INPUT TYPE="INPUT" NAME="nom_mod"></TD>
+<TD><?=$nom_mod->input()?></TD>
 </TR>
 <TR>
    <TD> <?=_('Classe de base')?> </TD>
@@ -23,3 +36,9 @@
 <p class="info">
 <?=_(' A moins qu\'en créant la fiche, vous forcez un autre poste comptable')?>
 </p>
+
+<p>
+<?=$submit?> <?=HtmlInput::button_close($ipopup)?>
+</p>
+</form>
+</div>
\ No newline at end of file




reply via email to

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