diff --git a/doc/installation-window.odt b/doc/installation-window.odt index 6ce635bf0..ccd568462 100644 Binary files a/doc/installation-window.odt and b/doc/installation-window.odt differ diff --git a/doc/installation-window.pdf b/doc/installation-window.pdf index 047fdf547..afe9601ac 100644 Binary files a/doc/installation-window.pdf and b/doc/installation-window.pdf differ diff --git a/doc/manuel-fr.odt b/doc/manuel-fr.odt index f377246ef..919d6901e 100644 Binary files a/doc/manuel-fr.odt and b/doc/manuel-fr.odt differ diff --git a/doc/manuel-fr.pdf b/doc/manuel-fr.pdf index b95784adb..33053baaa 100644 Binary files a/doc/manuel-fr.pdf and b/doc/manuel-fr.pdf differ diff --git a/html/ajax_poste.php b/html/ajax_poste.php index d4195a443..2b3677c94 100644 --- a/html/ajax_poste.php +++ b/html/ajax_poste.php @@ -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');"; diff --git a/html/category_pdf.php b/html/category_pdf.php index 46b54411c..be717e7fb 100644 --- a/html/category_pdf.php +++ b/html/category_pdf.php @@ -61,7 +61,7 @@ if ($array == null ) { // echo '

Aucune fiche trouvée

'; 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') { diff --git a/html/extension.php b/html/extension.php index dd0b79c5b..815559aa5 100644 --- a/html/extension.php +++ b/html/extension.php @@ -64,13 +64,25 @@ if ( $only_plugin != 'P' ) { $msg=_('Retour au tableau de bord'); $hidden=dossier::hidden(); echo << +
$hidden - +
EOF; +} else { + $msg=_('Retour accueil'); +?> +
+
+ +
+
+ + - + Retour diff --git a/include/ac_common.php b/include/ac_common.php index 1a3bf3e04..601c27799 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -551,4 +551,13 @@ function myereg($p_pattern,$p_string,&$p_array=null) { return $a; } } -?> \ No newline at end of file +/** + *@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; +} +?> diff --git a/include/class_acc_account.php b/include/class_acc_account.php index d5bb337e7..85b12c52c 100644 --- a/include/class_acc_account.php +++ b/include/class_acc_account.php @@ -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)); } } diff --git a/include/class_fiche.php b/include/class_fiche.php index 554cc0d63..880c484f4 100644 --- a/include/class_fiche.php +++ b/include/class_fiche.php @@ -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;$icn->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;$icn->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(); } diff --git a/include/class_lettering.php b/include/class_lettering.php index 32dec1c1b..a7c0bc81d 100644 --- a/include/class_lettering.php +++ b/include/class_lettering.php @@ -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) diff --git a/include/ext_inc.php b/include/ext_inc.php index 349a07a85..a90d75668 100644 --- a/include/ext_inc.php +++ b/include/ext_inc.php @@ -12,9 +12,9 @@ if (isset($_REQUEST['plugin_code']) ) { exit(); } /* show name of extension */ - echo '
'; + echo '
'; echo '

'.$ext->get_parameter('name').'

'; - echo HtmlInput::button_anchor(_('Sortie'),'logout.php?'); + echo '
'; require_once('ext'.DIRECTORY_SEPARATOR.trim($ext->get_parameter('filepath'))); diff --git a/include/impress_fiche.inc.php b/include/impress_fiche.inc.php index 78c2b0fbe..4990b4147 100644 --- a/include/impress_fiche.inc.php +++ b/include/impress_fiche.inc.php @@ -144,6 +144,7 @@ foreach($array as $row) { echo ''; 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 ''; $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') { diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php index 7cb072d80..2fd561faa 100644 --- a/include/param_pcmn.inc.php +++ b/include/param_pcmn.inc.php @@ -150,7 +150,11 @@ if ( isset ($_POST['update'])) { if ( ($p_parent != 0 && Database::num_row($Ret) == 0) || $p_parent==$old_line ) { echo ''; } else { - $acc->update($old_line); + try { + $acc->update($old_line); + } catch(Exception $e) { + alert($e->getMessage()); + } } } else { echo ''; @@ -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 diff --git a/include/template/account_result.php b/include/template/account_result.php index 48f940e88..ec2a83053 100644 --- a/include/template/account_result.php +++ b/include/template/account_result.php @@ -5,10 +5,10 @@
  • - + - + diff --git a/include/template/letter_all.php b/include/template/letter_all.php index a4116f697..b9573b654 100644 --- a/include/template/letter_all.php +++ b/include/template/letter_all.php @@ -22,6 +22,9 @@ endif;?> + + + @@ -52,6 +55,8 @@ $js="this.gDossier=".dossier::id(). content[$i]['j_date_fmt']?> + content[$i]['jr_pj_number']?> + %s', $this->content[$i]['jr_id'], $gDossier, $this->content[$i]['jr_internal']);