Mise à jour script migration_stock

Correct erreur dans fiche.inc.php
Enlève traitement lors sauvegarde pour ATTR_DEF_STOCK
Ajout lien détail vers fiche stock dans historique
This commit is contained in:
Dany De Bontridder 2012-06-16 18:19:00 +00:00
parent 2928c8532c
commit 0b93ac9cad
6 changed files with 18 additions and 38 deletions

View file

@ -539,7 +539,7 @@ class Fiche
$w->label = $attr->ad_text;
$w->name = "av_text" . $attr->ad_id;
$r.="<TR>" . td($w->label, ' class="input_text" ') . td($w->input()) . td("$msg")." </TR>";
$r.="<TR>" . td($w->label, ' class="input_text" ') . td($w->input()." $msg")." </TR>";
}
$r.= '</table>';
return $r;
@ -926,33 +926,6 @@ class Fiche
}
if ( $id == ATTR_DEF_STOCK )
{
$st=$this->cn->count_sql('select * from stock_goods where '.
" f_id=".$this->id);
if ( $st == 0 )
{
$exercice=$g_user->get_exercice();
if ( $exercice == 0 ) throw new Exception ('Annee invalide erreur');
$str_stock=sprintf('insert into stock_goods(f_id,sg_quantity,sg_comment,sg_code,sg_type,sg_exercice) '.
' values (%d,0,\'%s\',upper(\'%s\'),\'d\',\'%s\')',
$this->id,
'initial',
sql_string($value),
$exercice);
$this->cn->exec_sql($str_stock);
}
else
{
$str_stock=sprintf("update stock_goods set sg_code=upper('%s') where f_id=%d",
sql_string($value),
$this->id);
$this->cn->exec_sql($str_stock);
}
}
// account
if ($id == ATTR_DEF_ACCOUNT)
{

View file

@ -402,7 +402,7 @@ class Fiche_Def
$span_mod='<TD><A href="?p_action=fiche&'.$str_dossier.
'&action=detail&fiche_id='.$l_line['f_id'].$str.'&fiche='.
$_GET['fiche'].'&ac='.$_REQUEST['ac'].'">'.$l_line['quick_code']
$_REQUEST['fiche'].'&ac='.$_REQUEST['ac'].'">'.$l_line['quick_code']
.'</A></TD>';
echo $span_mod.'<TD>'.h($l_line['vw_name'])."</TD>";

View file

@ -304,7 +304,7 @@ if ( isset ( $_GET["action"]) )
if ( $write != 0 )
{
$iselect=new ISelect('move_to');
$iselect->value=$cn->make_array('select fd_id,fd_label from fiche_def '); //where frd_id='.$fiche->get_fiche_def_ref_id());
$iselect->value=$cn->make_array('select fd_id,fd_label from fiche_def order by fd_label'); //where frd_id='.$fiche->get_fiche_def_ref_id());
echo HtmlInput::submit("update_fiche","Mise &agrave; jour");
echo HtmlInput::submit("delete" ,"Effacer cette fiche","onclick=\"return confirm('"._('Vous confirmez ?')."');\"");
@ -401,15 +401,14 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) )
$fiche_def=new Fiche_Def($cn,$_POST['fiche']);
$fiche_def->Get();
echo '<h2 class="info">'.$fiche_def->label.'</h2>';
$url=$_SERVER['REQUEST_URI'];
$fiche=new Fiche($cn,0);
echo '<form method="post" action="'.$url.'&fiche='.$_POST['fiche'].'">';
var_dump($_SERVER);
echo '<form method="post" >';
echo dossier::hidden();
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('fiche',$_POST['fiche']);
echo $fiche->blank($_POST['fiche']);
echo HtmlInput::submit("add_fiche","Ajout");
echo HtmlInput::button_anchor(_('Annuler'),$url.'&fiche='.$_POST['fiche'].'&'.$str_dossier);
echo '</form>';
@ -454,7 +453,7 @@ if ( isset ($_POST["add_fiche"]) )
echo '<DIV class="redcontent" style="width:auto">';
$fiche=new Fiche($cn);
$fiche->Save($_REQUEST['fiche']);
$fiche_def=new Fiche_Def($cn,$_GET['fiche']);
$fiche_def=new Fiche_Def($cn,$_REQUEST['fiche']);
$fiche_def->myList();

View file

@ -53,13 +53,13 @@
<?=$row['cdate']?>
</td>
<td>
<?=$row['sg_code']?>
<?=HtmlInput::card_detail($row['sg_code'],"",' class="line" ')?>
</td>
<td>
<?=$row['r_name']?>
</td>
<td>
<?=HtmlInput::card_detail($row['qcode'],$row['fname'])?>
<?=HtmlInput::card_detail($row['qcode'],$row['fname'],' class="line" ')?>
</td>
<td>
<?=HtmlInput::detail_op($row['jr_id'],$row['jr_internal'])?>

View file

@ -51,6 +51,9 @@ require_once("class_acc_operation.php");
*/
function InsertStockGoods($p_cn, $p_j_id, $p_good, $p_quant, $p_type,$p_depot)
{
/**
*@todo function insertStockGoods doit être déplacée dans class_stock
*/
global $g_user;
if ( $g_user->can_write_repo($p_depot) == false )
return false;

View file

@ -308,6 +308,7 @@ begin
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;
update stock_goods set sg_code='STOCK'||n_fid::text where sg_code=rt_row;
end loop;
end;
@ -315,4 +316,8 @@ $body$ language plpgsql;
select migrate_stock();
select migrate_stock();
drop function migrate_stock();
update attr_def set ad_type='card', ad_extra='[sql] fd_id = 500000 ' where ad_id=19;