phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r615 - in trunk/rapport_avance: . include sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r615 - in trunk/rapport_avance: . include sql
Date: Wed, 11 Dec 2013 21:39:38 +0100 (CET)

Author: danydb
Date: 2013-12-11 21:39:37 +0100 (Wed, 11 Dec 2013)
New Revision: 615

Added:
   trunk/rapport_avance/ajax_rapav_listing_display.php
Modified:
   trunk/rapport_avance/ajax.php
   trunk/rapport_avance/include/class_rapav_listing_compute.php
   trunk/rapport_avance/include/class_rapport_avance_sql.php
   trunk/rapport_avance/include/historique.inc.php
   trunk/rapport_avance/rapav_javascript.js
   trunk/rapport_avance/sql/2-listing_compute.sql
Log:
task #941  Listing : voir l'historique des listing sauvegarde

Ajout display + delete
Task #941 - Listing : voir l'historique des listing sauvegard?\195?\169

Modified: trunk/rapport_avance/ajax.php
===================================================================
--- trunk/rapport_avance/ajax.php       2013-12-11 20:09:43 UTC (rev 614)
+++ trunk/rapport_avance/ajax.php       2013-12-11 20:39:37 UTC (rev 615)
@@ -6,7 +6,7 @@
         'rapav_search_code,save_param_detail,rapav_declaration_display,'.
         'listing_modify,listing_remove_modele,listing_display_definition,'.
         'listing_param_add,save_param_listing,listing_detail_remove,'.
-        'listing_search_code');
+        'listing_search_code,rapav_listing_display');
 if ( in_array($act,$a_action ) == true )
 {
     include 'ajax_'.$act.'.php';
@@ -29,6 +29,13 @@
                 array($_GET['d_id']));
         break;
     /////////////////////////////////////////////////////////////////////
+    // Delete a saved listing (from history)
+    /////////////////////////////////////////////////////////////////////
+    case 'rapav_listing_delete':
+        $cn->exec_sql("delete from rapport_advanced.listing_compute where 
lc_id=$1",
+                array($_GET['d_id']));
+        break;
+    /////////////////////////////////////////////////////////////////////
     // Remove a template
     /////////////////////////////////////////////////////////////////////
     case 'rapav_remove_doc_template':

Added: trunk/rapport_avance/ajax_rapav_listing_display.php
===================================================================
--- trunk/rapport_avance/ajax_rapav_listing_display.php                         
(rev 0)
+++ trunk/rapport_avance/ajax_rapav_listing_display.php 2013-12-11 20:39:37 UTC 
(rev 615)
@@ -0,0 +1,18 @@
+<?php
+/**
+ * @file
+ * @brief display a declaration from history but you can't modify it
+ */
+require_once 'include/class_rapav_listing_compute.php';
+global $cn;
+echo HtmlInput::button_action("Retour","$('declaration_list_div').show(); 
$('declaration_display_div').hide();");
+$decl = new RAPAV_Listing_Compute();
+$decl->load($_GET['d_id']);
+$decl->display(false);
+//echo $decl->anchor_document();
+echo '<hr>';
+$decl->propose_CSV();
+echo HtmlInput::button_action("Retour","$('declaration_list_div').show(); 
$('declaration_display_div').hide();");
+// require_once '.php';
+
+?>        
\ No newline at end of file

Modified: trunk/rapport_avance/include/class_rapav_listing_compute.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_compute.php        
2013-12-11 20:09:43 UTC (rev 614)
+++ trunk/rapport_avance/include/class_rapav_listing_compute.php        
2013-12-11 20:39:37 UTC (rev 615)
@@ -60,6 +60,7 @@
         try
         {
             // save an object Listing_Compute with the flag to_keep to N
+            $this->data->l_name=$rapav_listing->data->l_name;
             $this->data->l_start = $p_date_start;
             $this->data->l_end = $p_date_end;
             $this->data->l_keep = 'N';

Modified: trunk/rapport_avance/include/class_rapport_avance_sql.php
===================================================================
--- trunk/rapport_avance/include/class_rapport_avance_sql.php   2013-12-11 
20:09:43 UTC (rev 614)
+++ trunk/rapport_avance/include/class_rapport_avance_sql.php   2013-12-11 
20:39:37 UTC (rev 615)
@@ -421,6 +421,7 @@
     var $l_end;
     var $l_keep;
     var $l_timestamp;
+    var $l_name;
 
     /* example private 
$variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0);
 */
 
@@ -437,6 +438,7 @@
             , "l_end" => "l_end"
             , "l_keep" => "l_keep"
             , "l_timestamp" => "l_timestamp"
+            ,"l_name"=>"l_name"
         );
 
         $this->type = array(
@@ -447,6 +449,7 @@
             , "l_end" => "date"
             , "l_keep" => "text"
             , "l_timestamp" => "date"
+            , "l_name" => "text"
         );
 
         $this->default = array(

Modified: trunk/rapport_avance/include/historique.inc.php
===================================================================
--- trunk/rapport_avance/include/historique.inc.php     2013-12-11 20:09:43 UTC 
(rev 614)
+++ trunk/rapport_avance/include/historique.inc.php     2013-12-11 20:39:37 UTC 
(rev 615)
@@ -33,10 +33,19 @@
                d_description,d_generated,
                to_char(d_start,'YYMMDD') as fmt_start,
                to_char(d_end,'YYMMDD') as fmt_end,
-               to_char(d_end,'YYMMDDHH24MI') as fmt_order_generated
+               to_char(d_generated,'YYMMDDHH24MI') as fmt_order_generated,
+                1 as type
                from rapport_advanced.declaration
                where to_keep='Y'
-               order by d_start,d_title");
+                union all              
+                select 
lc_id,l_name,l_start,l_end,to_char(l_timestamp,'DD/MM/YY HH24:MI') as 
fmt_generated,
+               l_description,l_timestamp,
+               to_char(l_start,'YYMMDD') as fmt_start,
+               to_char(l_end,'YYMMDD') as fmt_end,
+               to_char(l_end,'YYMMDDHH24MI') as fmt_order_generated,
+                2
+               from rapport_advanced.listing_compute
+order by d_start,d_title");
 ?>
 <div id="declaration_list_div">
 <?php
@@ -88,12 +97,24 @@
                <td sortable_customkey="<?php echo 
$data[$i]['fmt_order_generated']?>">
                        <?php echo h($data[$i]['fmt_generated'])?>
                </td>
+<?php if  ($data[$i]['type']==1): ?>
+
                <td  id="mod_<?php echo $data[$i]['d_id']?>">
                        <?php echo 
HtmlInput::anchor("Afficher","",sprintf("onclick=\"rapav_declaration_display('%s','%s','%s','%s')\"",$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier'],$data[$i]['d_id']))?>
                </td>
                <td  id="del_<?php echo $data[$i]['d_id']?>">
                        <?php echo 
HtmlInput::anchor("Efface","",sprintf("onclick=\"rapav_declaration_delete('%s','%s','%s','%s')\"",$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier'],$data[$i]['d_id']))?>
                </td>
+<?php endif; ?>
+<?php if  ($data[$i]['type']==2): ?>
+
+               <td  id="mod_<?php echo $data[$i]['d_id']?>">
+                       <?php echo 
HtmlInput::anchor("Afficher","",sprintf("onclick=\"rapav_listing_display('%s','%s','%s','%s')\"",$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier'],$data[$i]['d_id']))?>
+               </td>
+               <td  id="del_<?php echo $data[$i]['d_id']?>">
+                       <?php echo 
HtmlInput::anchor("Efface","",sprintf("onclick=\"rapav_listing_delete('%s','%s','%s','%s')\"",$_REQUEST['plugin_code'],$_REQUEST['ac'],$_REQUEST['gDossier'],$data[$i]['d_id']))?>
+               </td>
+<?php endif; ?>                
        </tr>
        <?php endfor; ?>
 </table>

Modified: trunk/rapport_avance/rapav_javascript.js
===================================================================
--- trunk/rapport_avance/rapav_javascript.js    2013-12-11 20:09:43 UTC (rev 
614)
+++ trunk/rapport_avance/rapav_javascript.js    2013-12-11 20:39:37 UTC (rev 
615)
@@ -849,3 +849,62 @@
         alert("listing_search_code" + e.message);
     }
 }
+function rapav_listing_display(plugin_code, ac, dossier, d_id)
+{
+    try
+    {
+        $('declaration_list_div').hide();
+        $('declaration_display_div').innerHTML = "";
+        $('declaration_display_div').show();
+        waiting_box();
+        var querystring = 'plugin_code=' + plugin_code + '&ac=' + ac + 
'&gDossier=' + dossier + '&act=rapav_listing_display' + "&d_id=" + d_id;
+        var action = new Ajax.Request(
+                "ajax.php",
+                {
+                    method: 'get',
+                    parameters: querystring,
+                    onFailure: error_get_predef,
+                    onSuccess: function(req) {
+                        remove_waiting_box();
+                        var answer = req.responseText;
+                        $('declaration_display_div').innerHTML = answer;
+                        answer.evalScripts()
+                    }
+                }
+        );
+    }
+    catch (e)
+    {
+        alert(e.message);
+    }
+}
+function rapav_listing_delete(plugin_code, ac, dossier, d_id)
+{
+    try
+    {
+        if (confirm('Confirmez-vous l\'effacement ?') == false) {
+            return;
+        }
+        waiting_box();
+        var querystring = 'plugin_code=' + plugin_code + '&ac=' + ac + 
'&gDossier=' + dossier + '&act=rapav_listing_delete' + "&d_id=" + d_id;
+        var action = new Ajax.Request(
+                "ajax.php",
+                {
+                    method: 'get',
+                    parameters: querystring,
+                    onFailure: error_get_predef,
+                    onSuccess: function(req) {
+                        remove_waiting_box();
+                        $('tr_' + d_id).style.textDecoration = "line-through";
+                        $('tr_' + d_id).style.color = "red";
+                        $('del_' + d_id).innerHTML = "";
+                        $('mod_' + d_id).innerHTML = "";
+                    }
+                }
+        );
+    }
+    catch (e)
+    {
+        alert(e.message);
+    }
+}
\ No newline at end of file

Modified: trunk/rapport_avance/sql/2-listing_compute.sql
===================================================================
--- trunk/rapport_avance/sql/2-listing_compute.sql      2013-12-11 20:09:43 UTC 
(rev 614)
+++ trunk/rapport_avance/sql/2-listing_compute.sql      2013-12-11 20:39:37 UTC 
(rev 615)
@@ -5,8 +5,9 @@
 CREATE TABLE rapport_advanced.listing_compute
 (
   lc_id bigserial NOT NULL, -- PK
+  l_name text, -- Description or note
+  l_description text, -- Description or note
   l_id bigint, -- FK to listing
-  l_description text, -- Description or note
   l_start date, -- start data
   l_end date, -- end_date
   l_keep character(1) NOT NULL DEFAULT 'N'::bpchar, -- If yes, it is keeped 
with N it will deleted
@@ -26,6 +27,7 @@
 ';
 COMMENT ON COLUMN rapport_advanced.listing_compute.lc_id IS 'PK';
 COMMENT ON COLUMN rapport_advanced.listing_compute.l_id IS 'FK to listing';
+COMMENT ON COLUMN rapport_advanced.listing_compute.l_name IS 'Title';
 COMMENT ON COLUMN rapport_advanced.listing_compute.l_description IS 
'Description or note';
 COMMENT ON COLUMN rapport_advanced.listing_compute.l_start IS 'start data';
 COMMENT ON COLUMN rapport_advanced.listing_compute.l_end IS 'end_date';



---
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]