phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4876 - in phpcompta/trunk: include include/template sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r4876 - in phpcompta/trunk: include include/template sql
Date: Sat, 9 Jun 2012 18:15:18 +0200 (CEST)

Author: danydb
Date: 2012-06-09 18:15:18 +0200 (Sat, 09 Jun 2012)
New Revision: 4876

Modified:
   phpcompta/trunk/include/cat_document.inc.php
   phpcompta/trunk/include/class_document_type.php
   phpcompta/trunk/include/class_follow_up.php
   phpcompta/trunk/include/template/list_category_document.php
   phpcompta/trunk/sql/upgrade.sql
Log:
0000607: Num?\195?\169ro de r?\195?\169f?\195?\169rence action_gestion

Modified: phpcompta/trunk/include/cat_document.inc.php
===================================================================
--- phpcompta/trunk/include/cat_document.inc.php        2012-06-09 15:44:24 UTC 
(rev 4875)
+++ phpcompta/trunk/include/cat_document.inc.php        2012-06-09 16:15:18 UTC 
(rev 4876)
@@ -31,11 +31,13 @@
 if ( isset($_POST['add']) )
 {
     $catDoc=new Document_Type($cn);
-    $catDoc->insert($_POST['cat']);
+    $catDoc->insert($_POST['cat'],$_POST['prefix']);
 }
 $aList=Document_Type::get_list($cn);
 $addCat=new IText('cat');
+$addPrefix=new IText('prefix');
 $str_addCat=$addCat->input();
+$str_addPrefix=$addPrefix->input();
 $str_submit=HtmlInput::submit('add',_('Ajout'));
 echo '<div class="content">';
 require_once('template/list_category_document.php');

Modified: phpcompta/trunk/include/class_document_type.php
===================================================================
--- phpcompta/trunk/include/class_document_type.php     2012-06-09 15:44:24 UTC 
(rev 4875)
+++ phpcompta/trunk/include/class_document_type.php     2012-06-09 16:15:18 UTC 
(rev 4876)
@@ -61,6 +61,7 @@
         for ($i=0;$i<count($r);$i++)
         {
             $tmp['dt_value']=$r[$i]['dt_value'];
+            $tmp['dt_prefix']=$r[$i]['dt_prefix'];
 
             $bt=new IButton('X'.$r[$i]['dt_id']);
             $bt->label=_('Effacer');
@@ -74,15 +75,15 @@
         }
         return $array;
     }
-    function insert($p_value)
+    function insert($p_value,$p_prefix)
     {
-        $sql="insert into document_type(dt_value) values ($1)";
+        $sql="insert into document_type(dt_value,dt_prefix) values ($1,$2)";
         try
         {
             if( $this->db->count_sql('select * from document_type where 
upper(dt_value)=upper(trim($1))',array($p_value))>0)
                 throw new Exception('Nom en double');
             if ( strlen(trim($p_value))>0)
-                $this->db->exec_sql($sql,array($p_value));
+                $this->db->exec_sql($sql,array($p_value,$p_prefix));
         }
         catch (Exception $e)
         {

Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2012-06-09 15:44:24 UTC (rev 
4875)
+++ phpcompta/trunk/include/class_follow_up.php 2012-06-09 16:15:18 UTC (rev 
4876)
@@ -271,10 +271,7 @@
 
                // ag_ref
                // Always false for update
-               $ag_ref = new IText();
-               $ag_ref->readonly = $upd;
-               $ag_ref->name = "ag_ref";
-               $ag_ref->value = sql_string($this->ag_ref);
+
                $client_label = new ISpan();
 
                /* Add button */
@@ -366,7 +363,10 @@
 
 
                $h_agrefid = new IHidden();
-               $str_ag_ref = "<b>" . (($this->ag_ref != "") ? $this->ag_ref : 
" Nouveau ") . "</b>";
+               $iag_ref=new IText("ag_ref");
+               $iag_ref->value=$this->ag_ref;
+               $iag_ref->readOnly = ($p_view == "NEW")?true:false;
+               $str_ag_ref =$iag_ref->input();
                // Preparing the return string
                $r = "";
 
@@ -586,8 +586,9 @@
                $this->ag_id = 
$this->db->get_next_seq('action_gestion_ag_id_seq');
 
                // Create the reference
-               $ref = $this->dt_id . '/' . $this->ag_id;
-               $this->ag_ref = $ref;
+               $ag_ref=$this->db->get_value('select dt_prefix from 
document_type where 
dt_id=$1',array($this->dt_id)).'-'.$this->db->get_next_seq($seq_name);
+               $this->ag_ref = $ag_ref;
+
                if ($this->ag_cal == 'on')
                        $ag_cal = 'C';
                else
@@ -617,7 +618,7 @@
                        $this->dt_id, /* 3 */
                        $this->ag_title, /* 4 */
                        $exp->id, /* 5 */
-                       $ref, /* 6 */
+                       $ag_ref, /* 6 */
                        $this->ag_dest, /* 7 */
                        $this->ag_hour, /* 8 */
                        $this->ag_priority, /* 9 */
@@ -858,12 +859,10 @@
                        $contact->id = 0;
 
 
-               $ref = $this->dt_id . '/' . $this->ag_id;
                if ($this->ag_cal == 'on')
                        $ag_cal = 'C';
                else
                        $ag_cal = 'I';
-               $this->ag_ref = $ref;
                if ($this->ag_dest == 0)
                {
                        $this->ag_dest = null;
@@ -979,6 +978,7 @@
        function fromArray($p_array)
        {
                $this->ag_id = (isset($p_array['ag_id'])) ? $p_array['ag_id'] : 
"";
+               $this->ag_ref = (isset($p_array['ag_ref'])) ? 
$p_array['ag_ref'] : "";
                $this->qcode_dest = (isset($p_array['qcode_dest'])) ? 
$p_array['qcode_dest'] : "";
                $this->f_id_dest = (isset($p_array['f_id_dest'])) ? 
$p_array['f_id_dest'] : 0;
                $this->ag_timestamp = (isset($p_array['ag_timestamp'])) ? 
$p_array['ag_timestamp'] : date('d.m.Y');

Modified: phpcompta/trunk/include/template/list_category_document.php
===================================================================
--- phpcompta/trunk/include/template/list_category_document.php 2012-06-09 
15:44:24 UTC (rev 4875)
+++ phpcompta/trunk/include/template/list_category_document.php 2012-06-09 
16:15:18 UTC (rev 4876)
@@ -9,8 +9,11 @@
 
 <tr id="row<?=$row['dt_id']?>">
 <td colspan="2">
-<?=$row['dt_value'];?>
+<?=h($row['dt_value']);?>
 </td>
+<td colspan="2">
+<?=h($row['dt_prefix']);?>
+</td>
 <td>
 <?=$row['js_remove'];?>
 </td>
@@ -23,6 +26,9 @@
 <?=$str_addCat?>
 </td>
 <td>
+<?=$str_addPrefix?>
+</td>
+<td>
    <?=$str_submit?>
 </td>
 </tr>

Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql     2012-06-09 15:44:24 UTC (rev 4875)
+++ phpcompta/trunk/sql/upgrade.sql     2012-06-09 16:15:18 UTC (rev 4876)
@@ -182,4 +182,10 @@
 DROP FUNCTION comptaproc.action_get_tree(bigint);
 
 insert into menu_ref(me_code,me_menu,me_type) values 
('CSV:ActionGestion','Export Action Gestion','PR');
-insert into profile_menu(me_code,p_id,p_type_display,pm_default) values 
('CSV:ActionGestion',1,'P',0);
\ No newline at end of file
+insert into profile_menu(me_code,p_id,p_type_display,pm_default) values 
('CSV:ActionGestion',1,'P',0);
+
+
+ALTER TABLE document_type ADD COLUMN dt_prefix text;
+COMMENT ON COLUMN document_type.dt_prefix IS 'Prefix for ag_ref';
+
+update document_type set dt_prefix= upper(substr(replace(dt_value,' 
',''),0,7))||dt_id::text 
\ 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]