phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r484 - in trunk/rapport_avance: . include include/templa


From: phpcompta-dev
Subject: [Phpcompta-dev] r484 - in trunk/rapport_avance: . include include/template sql
Date: Tue, 30 Apr 2013 21:47:19 +0200 (CEST)

Author: danydb
Date: 2013-04-30 21:47:19 +0200 (Tue, 30 Apr 2013)
New Revision: 484

Modified:
   trunk/rapport_avance/ajax.php
   trunk/rapport_avance/include/class_formulaire_param.php
   trunk/rapport_avance/include/class_rapav_declaration.php
   trunk/rapport_avance/include/class_rapav_formulaire.php
   trunk/rapport_avance/include/class_rapport_avance_sql.php
   trunk/rapport_avance/include/formulaire.inc.php
   trunk/rapport_avance/include/template/declaration_display.php
   trunk/rapport_avance/include/template/formulaire_definition.php
   trunk/rapport_avance/rapav_javascript.js
   trunk/rapport_avance/sql/upgrade3.sql
Log:
0000739: G?\195?\169n?\195?\169ration de d?\195?\169claration
- Nouveau type de ligne : remarque et texte

Modified: trunk/rapport_avance/ajax.php
===================================================================
--- trunk/rapport_avance/ajax.php       2013-04-26 22:09:41 UTC (rev 483)
+++ trunk/rapport_avance/ajax.php       2013-04-30 19:47:19 UTC (rev 484)
@@ -11,18 +11,7 @@
                require_once 'include/class_rapav_formulaire.php';
                if (!isset($_GET['f_id']) && isNum($_GET['f_id']) == 0)
                        exit();
-               echo '<h1>Définition </h1>';
-               $form = new RAPAV_formulaire($_REQUEST['f_id']);
-               $form->load_definition();
-               echo '<form method="POST" enctype="multipart/form-data" 
class="print">';
-               $form->input_formulaire();
-               $form->input_definition();
-               echo '<p>';
-               $delete = new ICheckBox('delete');
-               echo "Cochez la case pour effacer ce formulaire " . 
$delete->input();
-               echo '</p>';
-               echo HtmlInput::submit('form_def_sub', 'Sauve');
-               echo '</form>';
+               require_once 'include/formulaire_definition_show.inc.php';
                break;
        /*       * 
**************************************************************************************************************
         * Ajoute une ligne dans la definition
@@ -32,6 +21,9 @@
                $type_periode = $cn->make_array("select t_id,t_description from 
rapport_advanced.periode_type order by t_description");
                ?>
                <td>
+                       Nouv.
+               </td>
+               <td>
                        <?= HtmlInput::hidden('p_id[]', -1)?>
                        <?
                        $p_code = new IText('p_code[]');
@@ -68,13 +60,6 @@
                        echo $p_order->input();
                        ?>
                </td>
-               <td>
-                       <?
-                       $p_info = new IText('p_info[]');
-                       $p_info->css_size = "100%";
-                       echo $p_info->input();
-                       ?>
-               </td>'
                <?
                break;
        /*       * 
**************************************************************************************************************

Modified: trunk/rapport_avance/include/class_formulaire_param.php
===================================================================
--- trunk/rapport_avance/include/class_formulaire_param.php     2013-04-26 
22:09:41 UTC (rev 483)
+++ trunk/rapport_avance/include/class_formulaire_param.php     2013-04-30 
19:47:19 UTC (rev 484)
@@ -72,9 +72,9 @@
                header('Pragma: public');
                header('Content-type: application/bin');
                header('Content-Disposition: attachment;filename="' . $title . 
'.bin"', FALSE);
-               fputcsv($out, array("RAPAV", '2'), ";");
-               fputcsv($out, array($form->f_title, $form->f_description));
-               $array = $cn->get_array("select p_id,p_code, p_libelle, p_type, 
p_order, f_id, p_info, t_id
+               fputcsv($out, array("RAPAV", '3'), ";");
+               fputcsv($out, array($form->f_title, $form->f_description), ";");
+               $array = $cn->get_array("select p_id,p_code, p_libelle, p_type, 
p_order, f_id,  t_id
                        from rapport_advanced.formulaire_param where f_id=$1", 
array($p_id));
                for ($i = 0; $i < count($array); $i++)
                {
@@ -104,6 +104,7 @@
                                throw new Exception('Formulaire invalide');
                        }
                        // $a[1] contains the version
+                       $rapav_version=$a[1];
                        // first line is the title and description
                        $form = new formulaire_sql();
                        $first = fgetcsv($in, 0, ";");
@@ -116,10 +117,13 @@
                        {
                                if ($csv[0] != "RAPAV_DETAIL")
                                {
+                                       if ( $rapav_version == 2 ) {
+                                               unset($csv[6]);
+                                       }
                                        $csv[5]=$form->f_id;
                                        $cn->get_array("INSERT INTO 
rapport_advanced.restore_formulaire_param(
-                                                   p_id, p_code, p_libelle, 
p_type, p_order, f_id, p_info, t_id)
-                                                               VALUES ($1, $2, 
$3, $4, $5, $6, $7, $8)", $csv);
+                                                   p_id, p_code, p_libelle, 
p_type, p_order, f_id, t_id)
+                                                               VALUES ($1, $2, 
$3, $4, $5, $6, $7)", $csv);
                                } else
                                        break;
                        }
@@ -144,7 +148,7 @@
                        $cn->exec_sql("update 
rapport_advanced.restore_formulaire_param set 
p_id=nextval('rapport_advanced.formulaire_param_p_id_seq')");
                        $cn->exec_sql("update 
rapport_advanced.restore_formulaire_param_detail set 
fp_id=nextval('rapport_advanced.formulaire_param_detail_fp_id_seq')");
 
-                       $cn->exec_sql('insert into 
rapport_advanced.formulaire_param select  p_id, p_code, p_libelle, p_type, 
p_order, f_id, p_info, t_id
+                       $cn->exec_sql('insert into 
rapport_advanced.formulaire_param select  p_id, p_code, p_libelle, p_type, 
p_order, f_id, t_id
                                from rapport_advanced.restore_formulaire_param 
where f_id=$1',array($form->f_id));
 
                        $cn->exec_sql('insert into 
rapport_advanced.formulaire_param_detail select fp_id, p_id, tmp_val, tva_id, 
fp_formula, fp_signed, jrn_def_type,

Modified: trunk/rapport_avance/include/class_rapav_declaration.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_declaration.php    2013-04-26 
22:09:41 UTC (rev 483)
+++ trunk/rapport_avance/include/class_rapav_declaration.php    2013-04-30 
19:47:19 UTC (rev 484)
@@ -45,7 +45,7 @@
        static function to_csv($p_id)
        {
                global $cn;
-               $a_row=$cn->get_array('select 
dr_code,dr_libelle,dr_amount,dr_info from rapport_advanced.declaration_row
+               $a_row=$cn->get_array('select dr_code,dr_libelle,dr_amount from 
rapport_advanced.declaration_row
                        where d_id=$1 order by dr_order',array($p_id));
 
                $a_title=$cn->get_array("select d_title
@@ -67,11 +67,11 @@
 
                for ($i = 0; $i < count($a_row); $i++)
                {
-                       printf ('"%s";"%s";%s;"%s"'."\r\n",
+                       printf ('"%s";"%s";%s'."\r\n",
                                        $a_row[$i]['dr_code'],
                                        $a_row[$i]['dr_libelle'],
-                                       nb($a_row[$i]['dr_amount']),
-                                       $a_row[$i]['dr_info']);
+                                       nb($a_row[$i]['dr_amount'])
+                                       );
                }
        }
        function compute($p_id, $p_start, $p_end)
@@ -92,7 +92,7 @@
                /*
                 * First we compute the formula and tva_code for each detail
                 */
-               $array = $cn->get_array("select 
p_id,p_code,p_libelle,p_type,p_order,f_id,p_info,t_id
+               $array = $cn->get_array("select 
p_id,p_code,p_libelle,p_type,p_order,f_id,t_id
                        from rapport_advanced.formulaire_param
                        where
                        f_id=$1
@@ -111,11 +111,11 @@
                /**
                 * Add the lines missing lines
                 */
-               $array = $cn->get_array("select 
fp.p_id,p_code,p_libelle,p_type,p_order,f_id,p_info,t_id
+               $array = $cn->get_array("select 
fp.p_id,p_code,p_libelle,p_type,p_order,f_id,t_id
                        from rapport_advanced.formulaire_param as fp
                        where
                        f_id=$1
-                       and p_type in (1,2,6)", array($p_id));
+                       and p_type in (1,2,6,7,8)", array($p_id));
                for ($i = 0; $i < count($array); $i++)
                {
                        $row = new Rapav_Declaration_Param();
@@ -173,7 +173,6 @@
        function insert()
        {
                $data = new RAPAV_Declaration_Row_SQL();
-               $data->dr_info = $this->param->p_info;
                $data->dr_code = $this->param->p_code;
                $data->dr_libelle = $this->param->p_libelle;
                $data->dr_order = $this->param->p_order;
@@ -193,14 +192,13 @@
         *    - 'p_type',
         *    - 'p_order',
         *    - 'f_id',
-        *    - 'p_info',
         *    - 't_id'
         * @param type $p_array
         */
        function from_array($p_array)
        {
                $this->param = new Formulaire_Param();
-               foreach (array('p_id', 'p_code', 'p_libelle', 'p_type', 
'p_order', 'f_id', 'p_info', 't_id') as $e)
+               foreach (array('p_id', 'p_code', 'p_libelle', 'p_type', 
'p_order', 'f_id', 't_id') as $e)
                {
                        $this->param->$e = $p_array[$e];
                }

Modified: trunk/rapport_avance/include/class_rapav_formulaire.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_formulaire.php     2013-04-26 
22:09:41 UTC (rev 483)
+++ trunk/rapport_avance/include/class_rapav_formulaire.php     2013-04-30 
19:47:19 UTC (rev 484)
@@ -112,19 +112,20 @@
         */
        static function update_definition($p_array)
        {
+               global $cn;
                $rapav = new RAPAV_Formulaire($p_array['f_id']);
                // save into table formulaire
                $rapav->f_title = $p_array['f_title'];
                $rapav->f_description = $p_array['f_description'];
                $rapav->update();
-
-               for ($i = 0; $i < count($p_array['p_id']); $i++)
+               $nb_line=count($p_array['p_id']);
+               for ($i = 0; $i < $nb_line ; $i++)
                {
                        $form_param = new 
formulaire_param_sql($p_array['p_id'][$i]);
                        $form_param->p_code = $p_array['p_code'][$i];
                        $form_param->p_libelle = $p_array['p_libelle'][$i];
                        $form_param->p_type = $p_array['p_type'][$i];
-                       $form_param->p_order = 
(isNumber($p_array['p_order'][$i]) == 0) ? $i * 10 : $p_array['p_order'][$i];
+                       $form_param->p_order = 
(isNumber($p_array['p_order'][$i]) == 0) ?  ($i+1) * 10 : 
$p_array['p_order'][$i];
                        $form_param->t_id = $p_array['t_id'][$i];
                        $form_param->f_id = $p_array['f_id'];
                        // update or insert the row
@@ -133,14 +134,23 @@
                        else
                                $form_param->update();
                }
+               // delete checked rows
+               if ( isset ($p_array["del_row"]))
+               {
+                       for ($i=0;$i<count($p_array['del_row']);$i++)
+                       {
+                               echo $p_array['del_row'][$i];
+                               if (isNumber($p_array['del_row'][$i]) == 1 &&  
$p_array['del_row'][$i]!=-1) {
+                                       $cn->exec_sql('delete from 
rapport_advanced.formulaire_param where 
p_id=$1',array($p_array['del_row'][$i]));
+                               }
+                       }
+               }
                self::load_file($rapav);
        }
 
        static function load_file(RAPAV_Formulaire $p_rapav)
        {
                global $cn;
-               var_dump($p_rapav);
-               var_dump($_FILES);
                // nothing to save
                if (sizeof($_FILES) == 0)
                        return;

Modified: trunk/rapport_avance/include/class_rapport_avance_sql.php
===================================================================
--- trunk/rapport_avance/include/class_rapport_avance_sql.php   2013-04-26 
22:09:41 UTC (rev 483)
+++ trunk/rapport_avance/include/class_rapport_avance_sql.php   2013-04-30 
19:47:19 UTC (rev 484)
@@ -44,7 +44,6 @@
                        "p_type" => "p_type",
                        "p_order" => "p_order",
                        "f_id" => "f_id",
-                       "p_info" => "p_info",
                        "t_id" => "t_id"
                );
 
@@ -55,7 +54,6 @@
                        "p_type" => "numeric",
                        "p_order" => "numeric",
                        "f_id" => "numeric",
-                       "p_info" => "text",
                        "t_id" => "numeric"
                );
 
@@ -213,8 +211,7 @@
                        "dr_order"=>"dr_order",
                        "dr_code"=>"dr_code",
                        "dr_amount"=>"dr_amount",
-                       "dr_type"=>"dr_type",
-                       "dr_info"=>"dr_info"
+                       "dr_type"=>"dr_type"
                );
 
                $this->type = array(
@@ -224,8 +221,7 @@
                        "dr_order"=>"text",
                        "dr_code"=>"numeric",
                        "dr_amount"=>"numeric",
-                       "dr_type"=>"numeric",
-                       "dr_info"=>'text'
+                       "dr_type"=>"numeric"
 
                );
 

Modified: trunk/rapport_avance/include/formulaire.inc.php
===================================================================
--- trunk/rapport_avance/include/formulaire.inc.php     2013-04-26 22:09:41 UTC 
(rev 483)
+++ trunk/rapport_avance/include/formulaire.inc.php     2013-04-30 19:47:19 UTC 
(rev 484)
@@ -37,7 +37,8 @@
        else
        {
                RAPAV_formulaire::save_definition($_POST);
-
+               require_once 'formulaire_definition_show.inc.php';
+               exit();
        }
 }
 if (isset ($_POST['add_form']))

Modified: trunk/rapport_avance/include/template/declaration_display.php
===================================================================
--- trunk/rapport_avance/include/template/declaration_display.php       
2013-04-26 22:09:41 UTC (rev 483)
+++ trunk/rapport_avance/include/template/declaration_display.php       
2013-04-30 19:47:19 UTC (rev 484)
@@ -40,21 +40,25 @@
 {
        case 1:
                echo '<h1  class="title">'.$row['dr_libelle'].'</h1>';
-               echo '<span class="notice">'.$row['dr_info'].'</span>';
                break;
        case 2:
                echo '<h2  class="title">'.$row['dr_libelle'].'</h2>';
-               echo '<span class="notice">'.$row['dr_info'].'</span>';
                break;
        case 6:
                echo '<h3  class="title">'.$row['dr_libelle'].'</h3>';
-               echo '<span class="notice">'.$row['dr_info'].'</span>';
                break;
        case 3:
                $input=new INum('amount[]',$row['dr_amount']);
                $input->size=15;
                echo HtmlInput::hidden('code[]',$row['dr_id']);
-               echo '<p>'.$row['dr_code']." ".$row['dr_libelle']." = 
".$input->input(). '<span class="notice">'.$row['dr_info'].'</span>'.'</p>';
+               echo '<p>'.$row['dr_code']." ".$row['dr_libelle']." = 
".$input->input().'</p>';
+               break;
+       case 7:
+               echo '<p>'.$row['dr_libelle'].'</p>';
+               break;
+       case 8:
+               echo '<span class="notice" > '.$row['dr_libelle'].'</span>';
+               break;
 
 }
 endfor;

Modified: trunk/rapport_avance/include/template/formulaire_definition.php
===================================================================
--- trunk/rapport_avance/include/template/formulaire_definition.php     
2013-04-26 22:09:41 UTC (rev 483)
+++ trunk/rapport_avance/include/template/formulaire_definition.php     
2013-04-30 19:47:19 UTC (rev 484)
@@ -32,13 +32,16 @@
 <table id="table_formulaire_definition_id" class="result" style="table-layout: 
auto">
        <thead>
        <tr>
+       <th>
+               A effacer
+       </th>
        <th style="width:92px">
                Code <?=HtmlInput::infobulle(200)?>
        </th>
        <th>
                Libellé
        </th>
-       <th style="width:192px">
+       <th style="width:92px">
                Type de ligne
        </th>
        <th>
@@ -47,16 +50,18 @@
        <th style="width:92px">
                Ordre d'apparition
        </th>
-       <th>
-               Message d'aide
-       </th>
        </tr>
        </thead>
        <tbody id="table_body_id">
        <? for ($i=0;$i<$max;$i++):?>
        <tr id="row_<?=$i?>">
-
                <td>
+                       <?
+                       $a=new 
ICheckBox('del_row[]',$this->definition[$i]->p_id);
+                       echo $a->input();
+                       ?>
+               </td>
+               <td>
                        
<?=HtmlInput::hidden('p_id[]',$this->definition[$i]->p_id) ?>
                        <?
                                $p_code=new 
IText('p_code[]',$this->definition[$i]->p_code);
@@ -67,7 +72,8 @@
                <td>
                        <?
                                $p_libelle=new 
IText('p_libelle[]',$this->definition[$i]->p_libelle);
-                               $p_libelle->css_size="100%";
+                               $p_libelle->size="50";
+                               //$p_libelle->css_size="100%";
                                echo $p_libelle->input();
                        ?>
                </td>
@@ -99,13 +105,6 @@
                                echo $p_order->input();
                        ?>
                </td>
-               <td>
-                       <?
-                               $p_info=new 
IText('p_info[]',$this->definition[$i]->p_info);
-                               $p_info->css_size="100%";
-                               echo $p_info->input();
-                       ?>
-               </td>
        </tr>
        <?endfor;?>
        </tbody>

Modified: trunk/rapport_avance/rapav_javascript.js
===================================================================
--- trunk/rapport_avance/rapav_javascript.js    2013-04-26 22:09:41 UTC (rev 
483)
+++ trunk/rapport_avance/rapav_javascript.js    2013-04-30 19:47:19 UTC (rev 
484)
@@ -366,7 +366,7 @@
  * @param plugin_code code of plugin
  * @param ac code AD
  * @param dossier gDossier
- * @param d_id id 
+ * @param d_id id
  * @returns {undefined}
  */
 function rapav_form_export(plugin_code,ac,dossier,d_id)
@@ -428,4 +428,4 @@
        {
                alert(e.message);
        }
-}
\ No newline at end of file
+}

Modified: trunk/rapport_avance/sql/upgrade3.sql
===================================================================
--- trunk/rapport_avance/sql/upgrade3.sql       2013-04-26 22:09:41 UTC (rev 
483)
+++ trunk/rapport_avance/sql/upgrade3.sql       2013-04-30 19:47:19 UTC (rev 
484)
@@ -10,3 +10,11 @@
 ALTER TABLE rapport_advanced.formulaire ADD COLUMN f_size bigint;
 COMMENT ON COLUMN rapport_advanced.formulaire.f_size IS 'Size of the file';
 
+insert into rapport_advanced.type_row(p_type,p_description) values (7,'Texte');
+insert into rapport_advanced.type_row(p_type,p_description) values 
(8,'Remarque');
+
+insert into 
rapport_advanced.formulaire_param(p_code,p_libelle,p_type,p_order,f_id,t_id)
+       select p_code||'note',p_info,8,p_order+1,f_id,t_id from 
rapport_advanced.formulaire_param where coalesce(p_info,'') <> '';
+
+alter table rapport_advanced.formulaire_param drop p_info;
+ALTER TABLE rapport_advanced.declaration_row DROP COLUMN dr_info ;



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