0000607: Numéro de référence action_gestion

This commit is contained in:
Dany De Bontridder 2012-06-09 16:15:18 +00:00
parent bbe3feed97
commit cbdd7fc0b3
5 changed files with 31 additions and 16 deletions

View file

@ -31,11 +31,13 @@ require_once ('class_document_type.php');
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');

View file

@ -61,6 +61,7 @@ class Document_type
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 @@ class Document_type
}
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)
{

View file

@ -271,10 +271,7 @@ class Follow_Up
// 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 @@ class Follow_Up
$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 @@ class Follow_Up
$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 @@ class Follow_Up
$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 @@ class Follow_Up
$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 @@ class Follow_Up
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');

View file

@ -9,7 +9,10 @@ for ($i=0;$i<count($aList);$i++) :
<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'];?>
@ -22,6 +25,9 @@ endfor;
<td>
<?=$str_addCat?>
</td>
<td>
<?=$str_addPrefix?>
</td>
<td>
<?=$str_submit?>
</td>

View file

@ -182,4 +182,10 @@ update menu_ref set me_menu='Action Gestion' where me_code='FOLLOW';
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);
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