From 0b93ac9cad5ce70264687c9673d9f2e27e14b938 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 16 Jun 2012 18:19:00 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20script=20migration=5Fsto?= =?UTF-8?q?ck=20Correct=20erreur=20dans=20fiche.inc.php=20Enl=C3=A8ve=20tr?= =?UTF-8?q?aitement=20lors=20sauvegarde=20pour=20ATTR=5FDEF=5FSTOCK=20Ajou?= =?UTF-8?q?t=20lien=20d=C3=A9tail=20vers=20fiche=20stock=20dans=20historiq?= =?UTF-8?q?ue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/class_fiche.php | 29 +---------------------------- include/class_fiche_def.php | 2 +- include/fiche.inc.php | 13 ++++++------- include/template/stock_histo.php | 4 ++-- include/user_common.php | 3 +++ sql/upgrade.sql | 5 +++++ 6 files changed, 18 insertions(+), 38 deletions(-) diff --git a/include/class_fiche.php b/include/class_fiche.php index b179073e3..4cb7a5565 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -539,7 +539,7 @@ class Fiche $w->label = $attr->ad_text; $w->name = "av_text" . $attr->ad_id; - $r.="" . td($w->label, ' class="input_text" ') . td($w->input()) . td("$msg")." "; + $r.="" . td($w->label, ' class="input_text" ') . td($w->input()." $msg")." "; } $r.= ''; 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) { diff --git a/include/class_fiche_def.php b/include/class_fiche_def.php index ea8ac2d45..7a4963ed5 100644 --- a/include/class_fiche_def.php +++ b/include/class_fiche_def.php @@ -402,7 +402,7 @@ class Fiche_Def $span_mod=''.$l_line['quick_code'] + $_REQUEST['fiche'].'&ac='.$_REQUEST['ac'].'">'.$l_line['quick_code'] .''; echo $span_mod.''.h($l_line['vw_name']).""; diff --git a/include/fiche.inc.php b/include/fiche.inc.php index 6c267ea4a..83ae84dfe 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -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 à 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 '

'.$fiche_def->label.'

'; - $url=$_SERVER['REQUEST_URI']; $fiche=new Fiche($cn,0); - - echo '
'; + var_dump($_SERVER); + echo ''; 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 '
'; @@ -454,7 +453,7 @@ if ( isset ($_POST["add_fiche"]) ) echo '
'; $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(); diff --git a/include/template/stock_histo.php b/include/template/stock_histo.php index 908a9fee4..a36785b3d 100644 --- a/include/template/stock_histo.php +++ b/include/template/stock_histo.php @@ -53,13 +53,13 @@ - + - + diff --git a/include/user_common.php b/include/user_common.php index 4fc709191..b5b1953a3 100644 --- a/include/user_common.php +++ b/include/user_common.php @@ -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; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 0d68c0f5f..e85346db2 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -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; \ No newline at end of file