diff --git a/html/js/accounting_item.js b/html/js/accounting_item.js index 8ad6f7c38..e384b16f1 100644 --- a/html/js/accounting_item.js +++ b/html/js/accounting_item.js @@ -39,9 +39,16 @@ function set_jrn_parent(p_ctl,p_value) { function PcmnUpdate(p_value,p_lib,p_parent,p_type,p_dossier) - { - var win=window.open('line_update.php?l='+p_value+'&n='+p_lib+'&p='+p_parent+'&m'+p_type+'&gDossier='+p_dossier,'Modifie','toolbar=no,width=500,height=400,scrollbars=yes,resizable=yes'); - } +{ + $('p_valu').value=p_value; + $('p_oldu').value=p_value; + $('p_libu').value=p_lib; + $('p_parentu').value=p_parent; + $('p_typeu').value=p_type; + $('acc_update').style.top=posY+offsetY; + $('acc_update').style.left=posX+offsetX; + $('acc_update').show(); +} /** *@brief show the popup for search an accounting item *@param object this, it must contains some attribute as diff --git a/html/line_update.php b/html/line_update.php deleted file mode 100644 index 3c8ae7dad..000000000 --- a/html/line_update.php +++ /dev/null @@ -1,119 +0,0 @@ -Check(); -html_page_start($User->theme,"onLoad='window.focus();'"); -$cn=new Database($gDossier); -$User->can_request(PARPCMN); - - -include ("user_menu.php"); -/* Modif d'une ligne */ -if ( isset ($_POST["update"] ) ) { - - echo JS_ACCOUNTING_ITEM; - - $p_val=trim($_POST["p_val"]); - $p_lib=trim($_POST["p_lib"]); - $p_parent=trim($_POST["p_parent"]); - $old_line=trim($_POST["p_old"]); - $p_type=htmlentities($_POST['p_type']); - $acc=new Acc_Account($cn); - $acc->set_parameter('libelle',$p_lib); - $acc->set_parameter('value',$p_val); - $acc->set_parameter('parent',$p_parent); - $acc->set_parameter('type',$p_type); - // Check if the data are correct - try { - $acc->check() ; - }catch (Exception $e) { - $message="Valeurs invalides, pas de changement \n ". - $e->getMessage(); - echo ''; - echo ""; - exit(); - - } - if ( strlen ($p_val) != 0 && strlen ($p_lib) != 0 && strlen($old_line)!=0 ) { - if (strlen ($p_val) == 1 ) { - $p_parent=0; - } else { - if ( strlen($p_parent)==0 ) { - $p_parent=substr($p_val,0,strlen($p_val)-1); - } - } - /* Parent existe */ - $Ret=$cn->exec_sql("select pcm_val from tmp_pcmn where pcm_val=$1",array($p_parent)); - if ( ($p_parent != 0 && Database::num_row($Ret) == 0) || $p_parent==$old_line ) { - echo ''; - } else { - $acc->update($old_line); - } - } else { - echo ''; - } - - echo ""; - -} - -?> -
-set_parameter('value',$_GET['l']); -$acc->load(); - -echo $acc->form(true); -?> - - - -
- - ',h($acc->get_parameter('value'))); ?> -
-
- - - diff --git a/include/class_acc_account.php b/include/class_acc_account.php index 4cfb55861..d5bb337e7 100644 --- a/include/class_acc_account.php +++ b/include/class_acc_account.php @@ -38,7 +38,7 @@ class Acc_Account { private $pcm_type; private $pcm_parent; private $pcm_lib; - static private $type=array( + static public $type=array( array('label'=>'Actif','value'=>'ACT'), array('label'=>'Passif','value'=>'PAS'), array('label'=>'Actif c. inverse','value'=>'ACTINV'), diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php index c9036ad76..7cb072d80 100644 --- a/include/param_pcmn.inc.php +++ b/include/param_pcmn.inc.php @@ -25,11 +25,13 @@ require_once ('class_acc_account.php'); include_once ("ac_common.php"); require_once("constant.php"); require_once('class_dossier.php'); +require_once('function_javascript.php'); + $gDossier=dossier::id(); - +echo js_include('infobulle.js'); require_once('class_database.php'); -/* Admin. Dossier */ +/* Admin. Dossier */ $cn=new Database($gDossier); include_once ("class_user.php"); @@ -39,6 +41,30 @@ $User->check_dossier($gDossier); include_once ("user_menu.php"); +echo ''; @@ -88,6 +114,48 @@ if (isset ($_GET['action'])) { } // isset ($l) } //$action == del } // isset action +//---------------------------------------------------------------------- +// Modification +//---------------------------------------------------------------------- +if ( isset ($_POST['update'])) { + $p_val=trim($_POST["p_valu"]); + $p_lib=trim($_POST["p_libu"]); + $p_parent=trim($_POST["p_parentu"]); + $old_line=trim($_POST["p_oldu"]); + $p_type=htmlentities($_POST['p_typeu']); + $acc=new Acc_Account($cn); + $acc->set_parameter('libelle',$p_lib); + $acc->set_parameter('value',$p_val); + $acc->set_parameter('parent',$p_parent); + $acc->set_parameter('type',$p_type); + // Check if the data are correct + try { + $acc->check() ; + }catch (Exception $e) { + $message="Valeurs invalides, pas de changement \n ". + $e->getMessage(); + echo ''; + } + if ( strlen ($p_val) != 0 && strlen ($p_lib) != 0 && strlen($old_line)!=0 ) { + if (strlen ($p_val) == 1 ) { + $p_parent=0; + } else { + if ( strlen($p_parent)==0 ) { + $p_parent=substr($p_val,0,strlen($p_val)-1); + } + } + /* Parent existe */ + $Ret=$cn->exec_sql("select pcm_val from tmp_pcmn where pcm_val=$1",array($p_parent)); + if ( ($p_parent != 0 && Database::num_row($Ret) == 0) || $p_parent==$old_line ) { + echo ''; + } else { + $acc->update($old_line); + } + } else { + echo ''; + } +} //----------------------------------------------------- /* Ajout d'une ligne */ if ( isset ( $_POST["Ajout"] ) ) {