Task #1117 - Problème dans le PCMN pour modification du poste 4891

Correction pour Bug #1117,1106 et 1094. 
Problème avec le Plan Comptable
This commit is contained in:
Dany De Bontridder 2015-05-15 13:33:49 +02:00
parent f366769873
commit 1080acfa47
6 changed files with 301 additions and 149 deletions

View file

@ -37,54 +37,22 @@ $cn=new Database($gDossier);
include_once ("class_user.php");
include_once ("user_menu.php");
echo '<div id="acc_update" class="inner_box" style="display:none;position:absolute;text-align:left;z-index:1">';
echo HtmlInput::title_box("Poste comptable", "acc_update", "hide");
echo '<span id="acc_update_info" class="notice"></span>';
echo '<form method="post" id="acc_update_frm_id" onsubmit="account_update(\'acc_update_frm_id\');return false;">';
$val=new IText('p_valu');
$parent=new IText('p_parentu');
$lib=new IText('p_libu');
$lib->css_size="100%";
$type=new ISelect('p_typeu');
$type->value=Acc_Account::$type;
echo '<table>';
$r= td(_('Poste comptable')).td($val->input());
echo tr($r);
$r= td(_('Description')).td($lib->input());
echo tr($r);
$r= td(_('Parent')).td($parent->input());
echo tr($r);
$r= td(_('Type ')).td($type->input());
echo tr($r);
echo '</table>';
echo HtmlInput::hidden('p_oldu','');
echo HtmlInput::hidden('p_action','');
echo dossier::hidden();
$checkbox=new ICheckBox("delete_acc");
echo _('Cocher pour effacer')." ".$checkbox->input();
echo '<hr>';
echo HtmlInput::submit('update',_('Sauve'));
echo HtmlInput::button('hide',_('Annuler'),'onClick="$(\'acc_update\').hide();return true;"');
echo '</form>';
echo '</div>';
echo '<div id="acc_update" class="inner_box" style="display:none;position:absolute;text-align:left;z-index:1"></div>';
/* Store the p_start parameter */
$g_start=HtmlInput::default_value_get('p_start',-1);
echo '<div class="u_subtmenu">';
echo '</div>';
$g_start=HtmlInput::default_value_get('p_start',1);
?>
echo '<div class="content">';
menu_acc_plan($g_start);
echo '</div>';
if ($g_start == -1) return;
echo '<DIV CLASS="myfieldset" style="width:auto">';
<div class="content">
<?php
menu_acc_plan($g_start);
?>
</div>
<DIV CLASS="myfieldset" style="width:auto">
<?php
$Ret=$cn->exec_sql("select pcm_val,pcm_lib,pcm_val_parent,pcm_type,array_to_string(array_agg(j_qcode) , ',') as acode
from tmp_pcmn left join vw_poste_qcode on (j_poste=pcm_val) where substr(pcm_val::text,1,1)='".$g_start."'".
" group by pcm_val,pcm_lib,pcm_val_parent, pcm_type order by pcm_val::text");
@ -92,10 +60,9 @@ $MaxRow=Database::num_row($Ret);
?>
<span style="display:inline;margin: 15px 15px 15px 15px">
<input type="button" class="smallbutton" onclick="PcmnUpdate('','','','',0,0,'new')" value="<?php echo _('Ajout poste comptable'); ?>">
<input type="button" id="pcmn_update_add_bt" class="smallbutton" value="<?php echo _('Ajout poste comptable'); ?>">
</span>
<?php echo _('Filtre')." ".HtmlInput::filter_table("account_tbl_id", "0,1,2,3,4", 1);?>
<FORM METHOD="POST">
<?php
echo HtmlInput::hidden('p_action','pcmn');
//echo HtmlInput::hidden('sa','detail');
@ -103,76 +70,78 @@ echo dossier::hidden();
$limite=MAX_QCODE;
?>
<TABLE id="account_tbl_id" class="result">
<TR>
<TH> Poste comptable </TH>
<TH> Libellé </TH>
<TH> Poste comptable Parent </TH>
<TH> Type </TH>
<TH> Fiche</TH>
</TR>
<TR>
<TH> <?php echo _('Poste comptable') ?> </TH>
<TH> <?php echo _('Libellé') ?> </TH>
<TH> <?php echo _('Poste comptable Parent') ?> </TH>
<TH> <?php echo _('Type') ?> </TH>
<TH> <?php echo _('Fiche') ?></TH>
</TR>
<?php
$str_dossier=dossier::get();
for ($i=0; $i <$MaxRow; $i++)
{
$A=Database::fetch_array($Ret,$i);
if ( $i%2 == 0 )
{
$td ='<TD class="odd">';
$tr ='<TR class="odd">';
}
else
{
$td='<TD class="even">';
$tr='<TR class="even">';
}
echo $tr;
echo "$td";
echo HtmlInput::history_account($A['pcm_val'], $A['pcm_val']);
echo '</td>';
echo "$td";
printf ("<A style=\"text-decoration:underline\" HREF=\"javascript:void(0)\" onclick=\"PcmnUpdate('%s','%s','%s','%s',%d,0,'update')\">",
str_replace("'","\'",$A['pcm_val']),
str_replace("'","\'",$A['pcm_lib']),
str_replace("'","\'",$A['pcm_val_parent']),
str_replace("'","\'",$A['pcm_type']),
dossier::id());
echo h($A['pcm_lib']);
echo $td;
echo $A['pcm_val_parent'];
echo '</TD>';
echo "</td>$td";
echo $A['pcm_type'];
echo "</TD>";
echo $td;
if ( strlen($A['acode']) >0 ) {
if (strpos($A['acode'], ",") >0 ) {
$det_qcode= explode(",", $A['acode']);
echo '<ul style="display:inline;paddding:0;margin:0px;padding-left:0px;list-style-type:none;padding-start-value:0px">';
$max=(count($det_qcode)>MAX_QCODE)?MAX_QCODE:count($det_qcode);
for ($e=0;$e<$max;$e++) {
echo '<li style="padding-start-value:0;display:inline">'.HtmlInput::card_detail($det_qcode[$e],'',' style="display:inline"').'</li>';
}
echo '</ol>';
if ($max < count($det_qcode)) {
echo "...";
}
} else {
echo HtmlInput::card_detail($A['acode']);
}
}
echo '</td>';
echo "</TR>";
}
echo "</TABLE>";
echo "</FORM>";
?>
<input type="button" class="smallbutton" onclick="PcmnUpdate('','','','',0,-230,'new')" value="<?php echo _('Ajout poste comptable'); ?>">
<?php
echo "</DIV>";
$str_dossier=dossier::id();
for ($i=0; $i <$MaxRow; $i++):
$A=Database::fetch_array($Ret,$i);
$class=( $i%2 == 0 )?"even":"odd";
?>
<tr id="row_<?php echo $A['pcm_val']?>" class="<?php echo $class;?>">
<td class="<?php echo $class;?>">
<?php
echo HtmlInput::history_account($A['pcm_val'], $A['pcm_val']);
?>
</td>
<td class="<?php echo $class;?>">
<?php
printf ("<A style=\"text-decoration:underline\" HREF=\"javascript:void(0)\" onclick=\"pcmn_update(%d,'%s')\">",
$str_dossier, $A['pcm_val']);
echo h($A['pcm_lib']);
?>
</td>
<td class="<?php echo $class;?>">
<?php echo $A['pcm_val_parent']; ?>
</TD>
<td class="<?php echo $class;?>">
<?php echo $A['pcm_type'];?>
</TD>
<td class="<?php echo $class;?>">
<?php
if ( strlen($A['acode']) >0 ) :
if (strpos($A['acode'], ",") >0 ) :
$det_qcode= explode(",", $A['acode']);
echo '<ul style="display:inline;paddding:0;margin:0px;padding-left:0px;list-style-type:none;padding-start-value:0px">';
$max=(count($det_qcode)>MAX_QCODE)?MAX_QCODE:count($det_qcode);
for ($e=0;$e<$max;$e++) :
echo '<li style="padding-start-value:0;margin:2px;display:inline">'.HtmlInput::card_detail($det_qcode[$e],'',' style="display:inline"').'</li>';
endfor;
echo '</ol>';
if ($max < count($det_qcode)) :
echo "...";
else :
echo HtmlInput::card_detail($A['acode']);
endif;
endif;
endif;
?>
</td>
</tr>
<?php
endfor;
?>
</TABLE>
<input type="button" id="pcmn_update_add_bt2" class="smallbutton" value="<?php echo _('Ajout poste comptable'); ?>">
</div>
<script>
$('pcmn_update_add_bt').onclick = function ()
{
pcmn_update(<?php echo Dossier::id()?>,'');
}
$('pcmn_update_add_bt2').onclick = function ()
{
pcmn_update(<?php echo Dossier::id()?>,'');
}
</script>
<?php
html_page_stop();
?>