[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4911 - in phpcompta/trunk: html include sql
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4911 - in phpcompta/trunk: html include sql |
Date: |
Sat, 16 Jun 2012 19:35:59 +0200 (CEST) |
Author: danydb
Date: 2012-06-16 19:35:59 +0200 (Sat, 16 Jun 2012)
New Revision: 4911
Modified:
phpcompta/trunk/html/fid_card.php
phpcompta/trunk/include/class_fiche.php
phpcompta/trunk/sql/upgrade.sql
Log:
Code gestion is now of type card, create a fake stock card category and fill it
with existing used code gestion
Modified: phpcompta/trunk/html/fid_card.php
===================================================================
--- phpcompta/trunk/html/fid_card.php 2012-06-16 15:54:34 UTC (rev 4910)
+++ phpcompta/trunk/html/fid_card.php 2012-06-16 17:35:59 UTC (rev 4911)
@@ -61,7 +61,7 @@
}
else if (strpos($d,'sql]')==true)
{
- $filter_card= str_replace('[sql]', "", $d);
+ $filter_card= str_replace('[sql]', " and ", $d);
} else
$filter_card="and fd_id in ($d)";
Modified: phpcompta/trunk/include/class_fiche.php
===================================================================
--- phpcompta/trunk/include/class_fiche.php 2012-06-16 15:54:34 UTC (rev
4910)
+++ phpcompta/trunk/include/class_fiche.php 2012-06-16 17:35:59 UTC (rev
4911)
@@ -337,12 +337,15 @@
* \see constant.php
* \return string
*/
- function strAttribut($p_ad_id)
+ function strAttribut($p_ad_id,$p_return=1)
{
+ $return=($p_return==1)?NOTFOUND:"";
if ( sizeof ($this->attribut) == 0 )
{
- if ($this->id==0) return NOTFOUND;
+ if ($this->id==0) {
+ return $return;
+ }
// object is not in memory we need to look into the database
$sql="select ad_value from fiche_detail
where f_id= $1 and ad_id= $2 ";
@@ -350,7 +353,7 @@
$row=Database::fetch_all($Res);
// if not found return error
if ( $row == false )
- return NOTFOUND;
+ return $return;
return $row[0]['ad_value'];
}
@@ -360,7 +363,7 @@
if ( $e->ad_id == $p_ad_id )
return $e->av_text;
}
- return NOTFOUND;
+ return $return;
}
/*!\brief make an array of attributes of the category of card
(FICHE_DEF.FD_ID)
*The array can be used with the function insert, it will return a struct
like this :
@@ -660,7 +663,9 @@
$w->value = $r->av_text;
break;
case 'card':
+ $uniq=rand(0,1000);
$w = new
ICard("av_text" . $r->ad_id);
+
$w->id="card_".$this->id.$uniq;
// filter on ad_extra
$filter = $r->ad_extra;
@@ -668,11 +673,22 @@
$w->extra = $filter;
$w->extra2 = 0;
$label = new ISpan();
- $label->name =
"av_text" . $r->ad_id . "_label";
+ $label->name =
"av_text" .$uniq. $r->ad_id . "_label";
+ $fiche=new
Fiche($this->cn);
+
$fiche->get_by_qcode($r->av_text);
+ if ($fiche->id == 0 )
+ {
+
$label->value=(trim($r->av_text)=='')?"":" Fiche non trouvé ";
+ $r->av_text="";
+ } else
+ {
+
$label->value=$fiche->strAttribut(ATTR_DEF_NAME)."
".$fiche->strAttribut(ATTR_DEF_FIRST_NAME,0);
+ }
$w->set_attribute('ipopup', 'ipopcard');
$w->set_attribute('typecard', $filter);
$w->set_attribute('inp', "av_text" . $r->ad_id);
-
$w->set_attribute('label', "av_text" . $r->ad_id . "_label");
+
$w->set_attribute('label', $label->name);
+ $w->autocomplete=0;
$w->dblclick="fill_ipopcard(this);";
$msg = $w->search();
$msg.=$label->input();
@@ -711,7 +727,7 @@
$w->readOnly = $p_readonly;
- $ret.="<TR>" . td($r->ad_text . $bulle) .
td($w->input()) . td($msg) . " </TR>";
+ $ret.="<TR>" . td($r->ad_text . $bulle) .
td($w->input()." ". $msg) . " </TR>";
}
$ret.="</table>";
Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql 2012-06-16 15:54:34 UTC (rev 4910)
+++ phpcompta/trunk/sql/upgrade.sql 2012-06-16 17:35:59 UTC (rev 4911)
@@ -286,4 +286,33 @@
delete from stock_goods where sg_code is null or sg_code='' or sg_code not in
(select ad_value from fiche_detail as fd where ad_id=19 and ad_value is not
null);
CREATE INDEX fki_jrnx_j_grpt ON jrnx (j_grpt );
-CREATE INDEX fki_jrn_jr_grpt_id ON jrn (jr_grpt_id );
\ No newline at end of file
+CREATE INDEX fki_jrn_jr_grpt_id ON jrn (jr_grpt_id );
+
+--
+insert into fiche_def (fd_id,frd_id,fd_label) values (500000,15,'Stock');
+insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (500000,1,10);
+insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (500000,9,20);
+insert into jnt_fic_attr (fd_id,ad_id,jnt_order) values (500000,23,30);
+
+create or replace function migrate_stock() returns void
+as
+$body$
+declare
+ rt_row text;
+ n_fid bigint;
+begin
+ for rt_row in select distinct ad_value from fiche_Detail where ad_id=19
and ad_value is not null and ad_Value <> ''
+ loop
+ insert into fiche (fd_id) values(500000) returning f_id into
n_fid;
+ insert into fiche_detail (f_id,ad_id,ad_value) values
(n_fid,1,rt_row);
+ insert into fiche_detail (f_id,ad_id,ad_value) values
(n_fid,9,'Code stock '||rt_row);
+ insert into fiche_detail (f_id,ad_id,ad_value) values
(n_fid,23,'STOCK'||n_fid::text);
+ update fiche_detail set ad_value='STOCK'||n_fid::text where
ad_id=19 and ad_value=rt_row;
+ end loop;
+
+end;
+$body$ language plpgsql;
+
+select migrate_stock();
+
+drop function migrate_stock();
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r4911 - in phpcompta/trunk: html include sql,
phpcompta-dev <=