Merged revisions 2963-2973 via svnmerge from

svn+ssh://danydb@svn/svn/phpcompta/branches/rel500

........
  r2965 | danydb | 2010-03-02 14:27:02 +0100 (Tue, 02 Mar 2010) | 1 line
  
  Dutch translation
........
  r2966 | danydb | 2010-03-02 14:31:49 +0100 (Tue, 02 Mar 2010) | 1 line
  
  improve account_insert in Fiche::update()
........
  r2967 | danydb | 2010-03-02 14:35:40 +0100 (Tue, 02 Mar 2010) | 1 line
  
  The jrnx can not be updated after a change in a card
........
  r2968 | danydb | 2010-03-04 00:24:29 +0100 (Thu, 04 Mar 2010) | 6 lines
  
  Modify catego of documents
  ==========================
  
  Start
........
  r2969 | danydb | 2010-03-04 00:58:51 +0100 (Thu, 04 Mar 2010) | 6 lines
  
  Document_type
  =============
  
  Add a new document type
   
........
  r2970 | danydb | 2010-03-06 23:18:18 +0100 (Sat, 06 Mar 2010) | 5 lines
  
  Document_type
  =============
  Remove
........
  r2971 | danydb | 2010-03-06 23:38:56 +0100 (Sat, 06 Mar 2010) | 4 lines
  
  Document_type
  =============
  Bug : when trying to remove one which is still used
........
  r2972 | danydb | 2010-03-06 23:53:50 +0100 (Sat, 06 Mar 2010) | 1 line
  
  add sql patch for document_type
........
  r2973 | danydb | 2010-03-06 23:55:13 +0100 (Sat, 06 Mar 2010) | 1 line
  
  add sql patch for document_type
........
This commit is contained in:
Dany De Bontridder 2010-03-06 23:18:59 +00:00
parent 1ae04859c6
commit 485a3b5131
13 changed files with 210 additions and 19 deletions

Binary file not shown.

View file

@ -0,0 +1,4 @@
begin;
insert into action (ac_id,ac_description,ac_module,ac_code) values (1135,'Ajoute ou modifie des catégories de documents','parametre','PARCATDOC');
update version set val=71;
commit;

View file

@ -53,13 +53,13 @@ $user=new User($cn); $user->check(true);$user->check_dossier($gDossier,true);
$html=var_export($_REQUEST,true);
switch($op)
{
// display new calendar
case 'cal':
require_once('class_calendar.php');
/* others report */
$cal=new Calendar();
$cal->set_periode($per);
$html="";
$html=$cal->display();
$html=escape_xml($html);
@ -72,4 +72,46 @@ echo <<<EOF
</data>
EOF;
break;
/* remove a cat of document */
case 'rem_cat_doc':
require_once('class_document_type.php');
// if user can not return error message
if( $user->check_action(PARCATDOC)==0 ) {
$html="nok";
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<dtid>$html</dtid>
</data>
EOF;
return;
}
// remove the cat if no action
$count_md=$cn->get_value('select count(*) from document_modele where md_type=$1',array($dt_id));
$count_a=$cn->get_value('select count(*) from action_gestion where ag_type=$1',array($dt_id));
if ( $count_md != 0 || $count_a != 0 ) {
$html="nok";
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<dtid>$html</dtid>
</data>
EOF;
exit;
}
$cn->exec_sql('delete from document_type where dt_id=$1',array($dt_id));
$html=$dt_id;
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<dtid>$html</dtid>
</data>
EOF;
return;
break;
}

View file

@ -255,3 +255,25 @@ function loading() { return '<image src="image/loading.gif" alt="chargement"></i
function ajax_misc_failure() {
alert('Ajax Misc failed');
}
/**
*@brief remove a document_modele
*/
function cat_doc_remove(p_dt_id,phpsessid,p_dossier) {
var queryString="PHPSESSID="+phpsessid+"&gDossier="+p_dossier+"&op=rem_cat_doc"+"&dt_id="+p_dt_id;
var action = new Ajax.Request(
"ajax_misc.php" , { method:'get', parameters:queryString,onFailure:ajax_misc_failure,onSuccess:success_cat_doc_remove}
);
}
function success_cat_doc_remove(req) {
try{
var answer=req.responseXML;
var html=answer.getElementsByTagName('dtid');
if ( html.length == 0 ) { var rec=req.responseText;alert ('erreur :'+rec);}
nodeXML=html[0];
row_id=getNodeText(nodeXML);
if ( row_id == 'nok') {alert('Error');return;}
$('row'+row_id).style.textDecoration="line-through";
$('X'+row_id).style.display='none';
}
catch (e) { alert(e.message);}
}

View file

@ -2343,7 +2343,7 @@ msgstr ""
#: include/user_menu.php:312
#: include/ext_inc.php:17
msgid "Sortie"
msgstr ""
msgstr "Uitgang"
#: include/user_menu.php:336
msgid "Sociétés"
@ -3053,11 +3053,11 @@ msgstr ""
#: include/fiche.inc.php:71
msgid "Recherche :"
msgstr ""
msgstr "Zoeken"
#: include/jrn.php:291
msgid "Echéance "
msgstr ""
msgstr "Termijn"
#: include/ext/stock/class_ext_stock.php:341
#: include/ext/stock/class_ext_stock.php:347

View file

@ -135,7 +135,8 @@ if ( $p_action == 'divers') {
array('parametre.php?p_action=divers&sa=mp&'.$s,_('Moyen de paiement'),_('Moyen de paiement'),2),
array('parametre.php?p_action=divers&sa=tva&'.$s,_('Tva'),_('Taux et poste comptable tva'),4),
array('parametre.php?p_action=divers&sa=poste&'.$s,_('Poste Comptable'),_('Poste comptable constant'),7),
array('parametre.php?p_action=divers&sa=fiche&'.$s,_('Catégorie de fiche'),_('Modifie les classe de base, les attribut,...'),5)
array('parametre.php?p_action=divers&sa=fiche&'.$s,_('Catégorie de fiche'),_('Modifie les classe de base, les attribut,...'),5),
array('parametre.php?p_action=divers&sa=cdoc&'.$s,_('Catégorie de documents'),_('Ajoute des catégories de documents,...'),6)
);
$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:'';
$sb=(isset($_REQUEST['sb']))?$_REQUEST['sb']:'';
@ -153,6 +154,9 @@ if ( $p_action == 'divers') {
case 'fiche':
$def=5;
break;
case 'cdoc':
$def=6;
break;
}
echo '<div class="lmenu">';
echo ShowItem($array,'H','mtitle','mtitle',$def);
@ -192,7 +196,15 @@ if ( $p_action == 'divers') {
require_once('fiche_def.inc.php');
return;
}
//----------------------------------------------------
// Cat. Document
//----------------------------------------------------
if ( $def== 6) {
$User->can_request(PARCATDOC,1);
require_once('cat_document.inc.php');
return;
}
}
//-----------------------------------------------------
// Extension

View file

@ -0,0 +1,41 @@
<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/*!\file
* \brief this file is included to perform modification on category of document
* table document_type
*/
// show list of document
require_once ('class_document_type.php');
if ( isset($_POST['add']) ) {
$catDoc=new Document_Type($cn);
$catDoc->insert($_POST['cat']);
}
$aList=Document_Type::get_list($cn);
$addCat=new IText('cat');
$str_addCat=$addCat->input();
$str_submit=HtmlInput::submit('add',_('Ajout'));
echo '<div class="content">';
require_once('template/list_category_document.php');
echo '</div>';
?>

View file

@ -42,11 +42,40 @@ class Document_type
*/
function get()
{
$sql="select * from document_type where dt_id=".$this->dt_id;
$R=$this->db->exec_sql($sql);
$sql="select * from document_type where dt_id=$1";
$R=$this->db->exec_sql($sql,array($this->dt_id));
$r=Database::fetch_array($R,0);
$this->dt_id=$r['dt_id'];
$this->dt_value=$r['dt_value'];
}
/**
*@brief get a list
*@parameter $p_cn database connection
*@return array of data from document_type
*/
static function get_list($p_cn) {
$sql="select * from document_type";
$r=$p_cn->get_array($sql);
$array=array();
for ($i=0;$i<count($r);$i++) {
$tmp['dt_value']=$r[$i]['dt_value'];
$bt=new IButton('X'.$r[$i]['dt_id'],"X");
$bt->javascript="cat_doc_remove('".$r[$i]['dt_id']."','".$_REQUEST['PHPSESSID']."','".Dossier::id()."');";
$tmp['js_remove']=$bt->input();
$tmp['dt_id']=$r[$i]['dt_id'];
$array[$i]=$tmp;
}
return $array;
}
function insert($p_value) {
$sql="insert into document_type(dt_value) values ($1)";
try {
if( $this->db->count_sql('select * from document_type where upper(dt_value)=upper(trim($1))',array($p_value))>0)
throw new Exception('Nom en double');
if ( strlen(trim($p_value))>0)
$this->db->exec_sql($sql,array($p_value));
}catch (Exception $e){
alert(j(_("Impossible d'ajouter [$p_value] ").$e->getMessage()));
}
}
}

View file

@ -577,21 +577,22 @@ Array
echo_debug("insert ATTR_DEF_ACCOUNT");
$v=FormatString($value);
try {
if (isNumber($v) == 1 || strpos($v,',') != 0)
{
$sql=sprintf("select account_insert(%d,'%s')",
$this->id,$v);
$parameter=array($this->id,$v);
// $sql=sprintf("select account_insert(%d,'%s')",$this->id,$v);
}
else
{
$sql=sprintf("select account_insert(%d,null)",
$this->id);
$parameter=array($this->id,null);
// $sql=sprintf("select account_insert(%d,null)", $this->id);
}
$this->cn->exec_sql($sql);
$this->cn->exec_sql("select account_insert($1,$2)",$parameter);
echo_debug(__FILE__,__LINE__,$sql);
} catch (Exception $e) {
throw new Exception ("Erreur : ce compte [$v] n'a pas de compte parent.".
"L'op&eacute;ration est annul&eacute;e",
"L'opération est annulée",
1);
}
continue;
@ -749,14 +750,15 @@ Array
$Ret=$this->cn->exec_sql($sql);
/* update also the jrnx */
$sql='update jrnx set j_poste=$1 where j_qcode in (select quick_code from vw_fiche_attr where f_id=$2)';
/* The jrnx CANNOT BE UPDATED
$sql='update jrnx set j_poste=$1 where j_qcode in (select quick_code from vw_fiche_attr where f_id=$2)';
$this->cn->exec_sql(
$sql,
array($v,$this->id));
*/
} catch (Exception $e) {
throw new Exception(__LINE__."Erreur : ce compte [$v] n'a pas de compte parent.".
"L'op&eacute;ration est annul&eacute;e");
"L'opération est annulée");
}
continue;

View file

@ -120,6 +120,8 @@ class HtmlInput {
public function get_js_attr(){
require_once('function_javascript.php');
$attr="";
if ( count($this->attribute) == 0) return "";
/* Add properties at the widget */
for ($i=0;$i< count($this->attribute);$i++){
list($name,$value)=$this->attribute[$i];

View file

@ -26,7 +26,7 @@
require_once ('config.inc.php');
require_once('constant.security.php');
define ("DBVERSION",70);
define ("DBVERSION",71);
define ("MAX_COMPTE",4);
define ('MAX_ARTICLE',9);

View file

@ -25,6 +25,7 @@ define ("PARCA",1100); //Mode comptabilité analytique
define ("PARPER",1110); //Ajout de période
define ("PARFIC",1120); //Catégorie des fiches
define ("PARDOC",1130); //Document
define ("PARCATDOC",1135); //Add Document category
define ("PARJRN",1140); //Modification journaux
define ("PARSEC",1245); /* Sécurité */
define ("PARTVA",1150); //TVA

View file

@ -0,0 +1,36 @@
<form method="post">
<table>
<?php
for ($i=0;$i<count($aList);$i++) :
$row=$aList[$i];
?>
<tr id="row<?=$row['dt_id']?>">
<td colspan="2">
<?=$row['dt_value'];?>
</td>
<td>
<?=$row['js_remove'];?>
</td>
</tr>
<?
endfor;
?>
<tr>
<td>
<?=$str_addCat?>
</td>
<td>
<?=$str_submit?>
</td>
</tr>
</table>
<?
echo HtmlInput::phpsessid().dossier::hidden();
echo HtmlInput::hidden('p_action',$_REQUEST['p_action']);
echo HtmlInput::hidden('sa',$_REQUEST['sa']);
?>
</form>