phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r589 - in trunk/rapport_avance: . include/template


From: phpcompta-dev
Subject: [Phpcompta-dev] r589 - in trunk/rapport_avance: . include/template
Date: Mon, 25 Nov 2013 18:55:32 +0100 (CET)

Author: danydb
Date: 2013-11-25 18:55:31 +0100 (Mon, 25 Nov 2013)
New Revision: 589

Added:
   trunk/rapport_avance/ajax_listing_detail_remove.php
Modified:
   trunk/rapport_avance/ajax.php
   trunk/rapport_avance/ajax_save_param_listing.php
   trunk/rapport_avance/include/template/rapav_listing_definition.php
   trunk/rapport_avance/rapav_javascript.js
Log:
Remove listing detail

Modified: trunk/rapport_avance/ajax.php
===================================================================
--- trunk/rapport_avance/ajax.php       2013-11-25 16:32:09 UTC (rev 588)
+++ trunk/rapport_avance/ajax.php       2013-11-25 17:55:31 UTC (rev 589)
@@ -5,7 +5,7 @@
         'mod_form,add_row_definition,mod_param,add_param_detail,'.
         'rapav_search_code,save_param_detail,rapav_declaration_display,'.
         'listing_modify,listing_remove_modele,listing_display_definition,'.
-        'listing_param_add,save_param_listing');
+        'listing_param_add,save_param_listing,listing_remove_detail');
 if ( in_array($act,$a_action ) == true )
 {
     include 'ajax_'.$act.'.php';
@@ -17,17 +17,19 @@
     // Delete un formulaire_param_detail
     /////////////////////////////////////////////////////////////////////////
     case 'delete_param_detail':
-        $cn->exec_sql("delete from rapport_advanced.formulaire_param_detail 
where fp_id=$1", array($fp_id));
+        $cn->exec_sql("delete from rapport_advanced.formulaire_param_detail "
+                . " where fp_id=$1", array($fp_id));
         break;
-    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
     // Delete a saved declaration (from history)
-    
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
     case 'rapav_declaration_delete':
-        $cn->exec_sql("delete from rapport_advanced.declaration where 
d_id=$1", array($_GET['d_id']));
+        $cn->exec_sql("delete from rapport_advanced.declaration where d_id=$1",
+                array($_GET['d_id']));
         break;
-    
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
     // Remove a template
-    
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+    /////////////////////////////////////////////////////////////////////
     case 'rapav_remove_doc_template':
         require_once 'include/class_rapav_formulaire.php';
         $rapav = new Rapav_Formulaire($_GET['f_id']);

Added: trunk/rapport_avance/ajax_listing_detail_remove.php
===================================================================
--- trunk/rapport_avance/ajax_listing_detail_remove.php                         
(rev 0)
+++ trunk/rapport_avance/ajax_listing_detail_remove.php 2013-11-25 17:55:31 UTC 
(rev 589)
@@ -0,0 +1,20 @@
+<?php
+/**
+ * @file
+ * @brief delete a row in Listing_Param
+ */
+global $cn;
+require_once 'include/class_rapav_listing_param.php';
+$del=new RAPAV_Listing_Param($id);
+$del->Param->delete();
+
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<lp_id>$id</lp_id>
+<code>ok</code>
+</data>
+EOF;
+exit();
+?>     

Modified: trunk/rapport_avance/ajax_save_param_listing.php
===================================================================
--- trunk/rapport_avance/ajax_save_param_listing.php    2013-11-25 16:32:09 UTC 
(rev 588)
+++ trunk/rapport_avance/ajax_save_param_listing.php    2013-11-25 17:55:31 UTC 
(rev 589)
@@ -46,8 +46,8 @@
             $html.=ob_get_contents();
             ob_end_clean();
             $html.='<td id="del_' . $lp_id . '">';
-            $html.=HtmlInput::anchor("Effacer", "", 
sprintf("onclick=\"delete_listing_detail('%s','%s','%s','%s')\""
-                                    , $_REQUEST['plugin_code'], 
$_REQUEST['ac'], $_REQUEST['gDossier'], $lp_id));
+            $html.=HtmlInput::anchor("Effacer", "", 
sprintf("onclick=\"listing_detail_remove('%s','%s','%s','%s')\""
+                                    ,  
$_REQUEST['gDossier'],$_REQUEST['plugin_code'], $_REQUEST['ac'], $lp_id));
             $html.='</td>';
         }
         break;
@@ -123,8 +123,8 @@
         $html.=ob_get_contents();
         ob_end_clean();
         $html.='<td id="del_' . $lp_id . '">';
-        $html.=HtmlInput::anchor("Effacer", "", 
sprintf("onclick=\"delete_listing_detail('%s','%s','%s','%s')\""
-                                , $_REQUEST['plugin_code'], $_REQUEST['ac'], 
$_REQUEST['gDossier'], $lp_id));
+        $html.=HtmlInput::anchor("Effacer", "", 
sprintf("onclick=\"listing_detail_remove('%s','%s','%s','%s')\"",
+                                 $_REQUEST['gDossier'], 
$_REQUEST['plugin_code'], $_REQUEST['ac'], $lp_id));
         $html.='</td>';
         break;
 }

Modified: trunk/rapport_avance/include/template/rapav_listing_definition.php
===================================================================
--- trunk/rapport_avance/include/template/rapav_listing_definition.php  
2013-11-25 16:32:09 UTC (rev 588)
+++ trunk/rapport_avance/include/template/rapav_listing_definition.php  
2013-11-25 17:55:31 UTC (rev 589)
@@ -1,11 +1,9 @@
 <?php
-
 /**
  * @file
  * @brief show a list and all of its parameters and detail
  * 
  */
-
 ?>
 <p>
     Nom listing <?php echo h($this->Data->getp('name')); ?>
@@ -15,9 +13,9 @@
 </p>
 <p>
     Catégorie <?php echo h($this->get_categorie_name()); ?>
-    <?php echo h($this->get_categorie_description());  ?>
+<?php echo h($this->get_categorie_description()); ?>
 </p>
-<?php echo $button->input(); ?>
+    <?php echo $button->input(); ?>
 <table class="result" id="definition_tb_id">
     <tr>
         <th>
@@ -36,34 +34,41 @@
             action
         </th>
     </tr>
-<?php 
-    $nb=count($this->a_detail);
-    for ($i=0;$i<$nb;$i++):
-?>
-    <tr id="tr_<?php echo $this->a_detail[$i]->Param->getp('lp_id')?>">
-        <td>
-           <?php echo $this->a_detail[$i]->Param->getp('code'); ?>
-        </td>
-        <td>
-           <?php echo h($this->a_detail[$i]->Param->getp('comment')); ?>
-        </td>
-        <td>
-            <?php 
-            $obj=   
RAPAV_Listing_Formula::make_object($this->a_detail[$i]->Param);
-            echo $obj->display();
-            ?>
-        </td>
-        <td>
-            <?php echo $this->a_detail[$i]->Param->getp('order'); ?>
-        </td>
-        <td>
-            Efface / modifie
-        </td>
-        
-    </tr>
+<?php
+$nb = count($this->a_detail);
+for ($i = 0; $i < $nb; $i++):
+    ?>
+        <tr id="tr_<?php echo $this->a_detail[$i]->Param->getp('lp_id') ?>">
+            <td>
+    <?php echo $this->a_detail[$i]->Param->getp('code'); ?>
+            </td>
+            <td>
+    <?php echo h($this->a_detail[$i]->Param->getp('comment')); ?>
+            </td>
+            <td>
+    <?php
+    $obj = RAPAV_Listing_Formula::make_object($this->a_detail[$i]->Param);
+    echo $obj->display();
+    ?>
+            </td>
+            <td>
+    <?php echo $this->a_detail[$i]->Param->getp('order'); ?>
+            </td>
+            <td>
+    <?php
+    $json = sprintf(" onclick=\"listing_detail_remove('%s','%s','%s','%s')\"", 
+            Dossier::id(), 
+            $_REQUEST['plugin_code'], 
+            $_REQUEST['ac'], 
+            $this->a_detail[$i]->Param->getp('lp_id') );
+    echo HtmlInput::anchor("Effacer", "", $json)
+    ?>
+            </td>
 
+        </tr>
 
-<?php
-    endfor;
-?>   
+
+                <?php
+            endfor;
+            ?>   
 </table>    
\ No newline at end of file

Modified: trunk/rapport_avance/rapav_javascript.js
===================================================================
--- trunk/rapport_avance/rapav_javascript.js    2013-11-25 16:32:09 UTC (rev 
588)
+++ trunk/rapport_avance/rapav_javascript.js    2013-11-25 17:55:31 UTC (rev 
589)
@@ -699,7 +699,7 @@
                     method: 'get',
                     parameters: qs,
                     onFailure: error_get_predef,
-                    onSuccess: function infodiv(req, json) {
+                    onSuccess: function (req, json) {
                         try {
                             remove_waiting_box();
                             var answer = req.responseXML;
@@ -754,4 +754,60 @@
     }
 
     return false;
+}
+function listing_detail_remove(dossier,plugin_code,ac,id)
+{
+    if ( confirm('Confirmez-vous effacer ce détail ?') == false )
+    {
+        return;
+    }
+    try {
+        var query='plugin_code=' + plugin_code+ '&ac=' + ac+ '&gDossier=' 
+dossier+ '&act=listing_detail_remove' + "&id="+id;
+        waiting_box();
+        var action = new Ajax.Request(
+                "ajax.php",
+                {
+                    method: 'get',
+                    parameters: query,
+                    onFailure: error_get_predef,
+                    onSuccess: function (req, json) {
+                        try {
+                            remove_waiting_box();
+                            var answer = req.responseXML;
+                            var acode = answer.getElementsByTagName('code');
+                            var lp_id = answer.getElementsByTagName('lp_id');
+
+                            if (acode.length == 0) {
+                                var rec = req.responseText;
+                                alert('erreur :' + rec);
+                            }
+                            var code = acode[0].firstChild.nodeValue;
+                            
+                            if (code == 'ok')
+                            {
+                                console.log('tr_'+id);
+                                var row=$('tr_'+id);
+                                row.style.color="red";
+                                row.style.textDecoration='line-through';
+                                row.cells[row.cells.length-1].innerHTML="";
+                                console.log(row.length);
+
+                            }
+                            if (code == 'nok')
+                            {
+                                // montre erreur
+                                alert('effacement non possible');
+                            }
+                        }
+                        catch (e) {
+                            alert("callback : listing_detail_remove " + 
e.message);
+                        }
+
+                    }
+                }
+        );
+    } catch(e)
+    {
+        alert(e.message);
+    }
 }
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

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