Merged revisions 3235-3245 via svnmerge from

file:///home/developper/svn/phpcompta/branches/rel510

........
  r3236 | danydb | 2010-05-21 20:43:57 +0200 (Fri, 21 May 2010) | 1 line
  
  change place button exit
........
  r3237 | danydb | 2010-05-21 20:44:11 +0200 (Fri, 21 May 2010) | 1 line
  
  change place button exit
........
  r3238 | danydb | 2010-05-21 20:44:54 +0200 (Fri, 21 May 2010) | 1 line
  
  cosmetic : Button appearance button
........
  r3239 | danydb | 2010-05-21 20:46:01 +0200 (Fri, 21 May 2010) | 1 line
  
  Print : add receipt# for cat. of card
........
  r3240 | danydb | 2010-05-21 20:46:19 +0200 (Fri, 21 May 2010) | 1 line
  
  Update documentation
........
  r3241 | danydb | 2010-05-21 21:05:51 +0200 (Fri, 21 May 2010) | 1 line
  
  add function sql_string to protect 
........
  r3242 | danydb | 2010-05-22 00:50:31 +0200 (Sat, 22 May 2010) | 1 line
  
  bug in sql_string function : typo
........
  r3243 | danydb | 2010-05-22 12:03:49 +0200 (Sat, 22 May 2010) | 1 line
  
  Fix problem with quote for the TMP_PCMN function (ajax search accounting + add / remove and modify accounting)
........
  r3244 | danydb | 2010-05-22 12:27:19 +0200 (Sat, 22 May 2010) | 2 lines
  
  Bug in ajax_poste : change set_value(pcm_val,pcm_lib) by set_value(pcm_val,g('lib').innerHTML)
........
  r3245 | danydb | 2010-05-24 21:33:53 +0200 (Mon, 24 May 2010) | 2 lines
  
  Fix bug card cannot move due to a typo in Fiche::move_to function
........
This commit is contained in:
Dany De Bontridder 2010-05-25 14:35:08 +00:00
parent e69a078e1f
commit 17a8b3c777
17 changed files with 75 additions and 31 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -104,6 +104,7 @@ case "sf":
}
/* show result */
if ( isset($q) && strlen(trim($q)) > 0) {
$q=sql_string($q);
$sql.=sprintf(" $sep ( pcm_val::text like '%s%%' or pcm_lib::text ilike '%%%s%%') ",
$q,$q);
}
@ -129,9 +130,8 @@ case "sf":
}
if ( isset($l) ){
$lib=str_replace("'","\'",$array[$i]['pcm_lib']);
$str.=sprintf("set_value('%s','%s');",
$l,$lib);
$str.=sprintf("set_value('%s',g('%s').innerHTML);",
$l,"lib$i");
}
$str.="hideIPopup('$ipopup');";

View file

@ -61,7 +61,7 @@ if ($array == null ) {
// echo '<h2 class="info2"> Aucune fiche trouvée</h2>';
exit();
}
$tab=array(13,25,80,20,20,12,20);
$tab=array(13,25,55,20,20,12,20);
$align=array('L','L','L','R','R','R','R');
foreach($array as $row) {
@ -91,6 +91,7 @@ foreach($array as $row) {
$pdf->Cell($tab[0],7,'Date');
$pdf->Cell($tab[1],7,'ref');
$pdf->Cell($tab[1],7,'Int.');
$pdf->Cell($tab[2],7,'Comm');
$pdf->Cell(40,7,'Montant',0,0,'C');
$pdf->Cell($tab[5],7,'Let.',0,0,'R');
@ -111,6 +112,7 @@ foreach($array as $row) {
$str_date=shrink_date($row['j_date_fmt']);
$pdf->Cell($tab[0],4,$str_date,0,0,$align[0],$fill);
$pdf->Cell($tab[1],4,$row['jr_pj_number'],0,0,$align[1],$fill);
$pdf->Cell($tab[1],4,$row['jr_internal'],0,0,$align[1],$fill);
$pdf->Cell($tab[2],4,$row['jr_comment'],0,0,$align[2],$fill);
if ( $row['j_debit'] == 't') {

View file

@ -64,13 +64,25 @@ if ( $only_plugin != 'P' ) {
$msg=_('Retour au tableau de bord');
$hidden=dossier::hidden();
echo <<<EOF
<div style="position:absolute;top:3px;left:3px" class="noprint">
<div style="position:absolute;top:3px;right:30px" class="noprint">
<form method="get" action="access.php" style="display:inline">
$hidden
<input type="SUBMIT" value="$msg">
<input type="SUBMIT" class="button" value="$msg">
</form>
</div>
EOF;
} else {
$msg=_('Retour accueil');
?>
<div style="position:absolute;top:3px;right:30px" class="noprint">
<form method="get" action="access.php" style="display:inline">
<?php
echo HtmlInput::button_anchor('Retour Accueil','user_login.php');
echo HtmlInput::button_anchor(_('Déconnexion'),'logout.php?');
?>
</form>
</div>
<?php
}
/* show all the extension we can access */
$a=new ISelect('plugin_code');

View file

@ -215,9 +215,9 @@ foreach ( $Dossier as $rDossier) {
<input type="Submit" NAME="SAVE" VALUE="Sauver les changements changes">
<input type="Submit" class="button" NAME="SAVE" VALUE="Sauver les changements changes">
<input type="Submit" NAME="DELETE" VALUE="Effacer" onclick="return confirm('Confirmer effacement ?');" >
<input type="Submit" class="button" NAME="DELETE" VALUE="Effacer" onclick="return confirm('Confirmer effacement ?');" >
</FORM>
<A href='admin_repo.php?action=user_mgt'>Retour</a>

View file

@ -551,4 +551,13 @@ function myereg($p_pattern,$p_string,&$p_array=null) {
return $a;
}
}
?>
/**
*@brief remove the quote or double quote them
*@param $q string
*@return string correctly quoted
*/
function sql_string($q) {
$ret=str_replace("'","''",$q);
return $ret;
}
?>

View file

@ -188,14 +188,24 @@ class Acc_Account {
$cn=new Database(dossier::id());
}
/**
*@brief update an accounting, but you can update pcm_val only if
* this accounting has never been used before */
function update($p_old) {
if (strcmp(trim($p_old), trim($this->pcm_val)) !=0 ) {
$count=$this->db->get_value('select count(*) from jrnx where j_poste=$1',
array($p_old)
);
if ($count != 0)
throw new Exception('Impossible de changer la valeur: poste déjà utilisé');
}
$this->pcm_lib=substr($this->pcm_lib,0,150);
$this->check();
$sql="update tmp_pcmn set pcm_val=$1, pcm_lib=$2,pcm_val_parent=$3,pcm_type=$4 where pcm_val=$5";
$Ret=$this->db->exec_sql($sql,array($this->pcm_val,
$this->pcm_lib,
$this->pcm_val_parent,
$this->pcm_type,
$p_old));
$this->pcm_lib,
$this->pcm_val_parent,
$this->pcm_type,
$p_old));
}
}

View file

@ -1448,11 +1448,12 @@ function is_used() {
// remove not valid
$ajnt=$this->cn->get_array('select jft_id from jnt_fic_att_value where f_id=$1 and ad_id not in (select ad_id from jnt_fic_attr where fd_id=$2)',
array($this->id,$p_fdid));
if ( count($ajnt) == 0 ) return;
for ($i=0;$i<count($ajnt);$i++){
$this->cn->exec_sql('delete from attr_value where jft_id=$1',array($ajnt[$i]['jft_id']));
$this->cn->exec_sql('delete from jnt_fic_att_value where jft_id=$1',array($ajnt[$i]['jft_id']));
if ( count($ajnt) != 0 ) {
for ($i=0;$i<count($ajnt);$i++){
$this->cn->exec_sql('delete from attr_value where jft_id=$1',array($ajnt[$i]['jft_id']));
$this->cn->exec_sql('delete from jnt_fic_att_value where jft_id=$1',array($ajnt[$i]['jft_id']));
}
}
$this->cn->commit();
}

View file

@ -335,7 +335,7 @@ order by j_date,j_id";
public function get_all() {
$sql="
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,jr_pj_number,
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
from jrnx join jrn on (j_grpt = jr_grpt_id)
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
@ -349,7 +349,7 @@ order by j_date,j_id";
*/
public function get_letter() {
$sql="
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
from jrnx join jrn on (j_grpt = jr_grpt_id)
@ -365,7 +365,7 @@ order by j_date,j_id";
public function get_unletter() {
$sql="
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
from jrnx join jrn on (j_grpt = jr_grpt_id)
@ -442,7 +442,7 @@ order by j_date,j_id";
*/
public function get_all() {
$sql="
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
from jrnx join jrn on (j_grpt = jr_grpt_id)
@ -458,7 +458,7 @@ order by j_date,j_id";
public function get_letter() {
$sql="
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
from jrnx join jrn on (j_grpt = jr_grpt_id)
@ -473,7 +473,7 @@ order by j_date,j_id";
*/
public function get_unletter() {
$sql="
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter
from jrnx join jrn on (j_grpt = jr_grpt_id)

View file

@ -12,9 +12,9 @@ if (isset($_REQUEST['plugin_code']) ) {
exit();
}
/* show name of extension */
echo '<div style="position:absolute;right:3px;top:3px;margin:0;z-index:10" class="noprint">';
echo '<div style="position:absolute;left:3px;top:3px;margin:0;z-index:10" class="noprint">';
echo '<h2 class="error" style="display:inline;padding:0px;margin:0px">'.$ext->get_parameter('name').'</h2>';
echo HtmlInput::button_anchor(_('Sortie'),'logout.php?');
echo '</div>';
require_once('ext'.DIRECTORY_SEPARATOR.trim($ext->get_parameter('filepath')));

View file

@ -144,6 +144,7 @@ foreach($array as $row) {
echo '<tr>';
echo th(_('Date'));
echo th(_('ref'));
echo th(_('Interne'));
echo th(_('Comm'));
echo th(_('Montant'),' colspan="2"');
echo th(_('Let.'));
@ -156,6 +157,7 @@ foreach($array as $row) {
echo '<tr class="odd">';
$row=$letter->content[$i];
echo td($row['j_date_fmt']);
echo td($row['jr_pj_number']);
echo td($row['jr_internal']);
echo td($row['jr_comment']);
if ( $row['j_debit'] == 't') {

View file

@ -150,7 +150,11 @@ if ( isset ($_POST['update'])) {
if ( ($p_parent != 0 && Database::num_row($Ret) == 0) || $p_parent==$old_line ) {
echo '<SCRIPT> alert(" Ne peut pas modifier; aucun poste parent"); </SCRIPT>';
} else {
$acc->update($old_line);
try {
$acc->update($old_line);
} catch(Exception $e) {
alert($e->getMessage());
}
}
} else {
echo '<script> alert(\'Update Valeurs invalides\'); </script>';
@ -165,7 +169,6 @@ if ( isset ( $_POST["Ajout"] ) ) {
if ( isset ( $p_val) && isset ( $p_lib ) && isNumber($p_val) && isNumber($p_parent) ) {
$p_val=trim($p_val);
$p_lib=FormatString(trim($p_lib));
$p_parent=$_POST["p_parent"];
if ( strlen ($p_val) != 0 && strlen ($p_lib) != 0 ) {
if (strlen ($p_val) == 1 ) {
@ -183,7 +186,7 @@ if ( isset ( $_POST["Ajout"] ) ) {
} else {
// Check if the account already exists
$Count=$cn->count_sql("select * from tmp_pcmn where pcm_val='".$p_val."'");
$Count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val=$1",array($p_val));
if ( $Count != 0 )
{
// Alert message account already exists

View file

@ -5,10 +5,10 @@
<? for ($i=0;$i<sizeof($array);$i++) : ?>
<li>
<a href="javascript:void(0)" onclick="<?=$array[$i]['javascript']?>">
<span>
<span id="val<?=$i?>">
<?=$array[$i]['pcm_val']?>
</span>
<span>
<span id="lib<?=$i?>">
<?=$array[$i]['pcm_lib']?>
</span>
</a>

View file

@ -22,6 +22,9 @@ endif;?>
<th>
<?=_('Ref')?>
</th>
<th>
<?=_('Interne')?>
</th>
<th>
<?=_('Description')?>
</th>
@ -52,6 +55,8 @@ $js="this.gDossier=".dossier::id().
<A class="detail" href="javascript:<?=$js?>"><?=$letter?></A>
</td>
<td> <?=$this->content[$i]['j_date_fmt']?> </td>
<td> <?=$this->content[$i]['jr_pj_number']?> </td>
<?php
$r=sprintf('<A class="detail" style="text-decoration:underline" HREF="javascript:viewOperation(\'%s\',\'%s\')" >%s</A>',
$this->content[$i]['jr_id'], $gDossier, $this->content[$i]['jr_internal']);