Merged revisions 2171,2173-2176,2178-2179,2181-2187,2189,2191-2194,2196-2230,2232,2234-2244 via svnmerge from

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

........
  r2174 | danydb | 2008-09-16 21:34:23 +0200 (Tue, 16 Sep 2008) | 3 lines
  
  Removed merge tracking for "svnmerge" for 
  svn+ssh://danydb@svn/svn/phpcompta/branches/rel410-exp
........
  r2178 | danydb | 2008-09-16 21:43:31 +0200 (Tue, 16 Sep 2008) | 1 line
  
  Update version
........
  r2191 | danydb | 2008-09-22 20:31:03 +0200 (Mon, 22 Sep 2008) | 1 line
  
  Add correct version
........
  r2196 | danydb | 2008-10-03 21:46:50 +0200 (Fri, 03 Oct 2008) | 1 line
  
  update index version
........
  r2234 | danydb | 2008-11-19 20:54:30 +0100 (Wed, 19 Nov 2008) | 1 line
  
  Add the payer, not yet finished
........
  r2235 | danydb | 2008-11-21 22:34:32 +0100 (Fri, 21 Nov 2008) | 1 line
  
  Add the form for setting the medium of payment
........
  r2236 | danydb | 2008-11-22 23:15:30 +0100 (Sat, 22 Nov 2008) | 1 line
  
  Improve add : payment (second operation) + generation of a note of fee
........
  r2237 | danydb | 2008-11-23 01:20:40 +0100 (Sun, 23 Nov 2008) | 1 line
  
  Improve Payment method
........
  r2238 | danydb | 2008-11-23 01:45:52 +0100 (Sun, 23 Nov 2008) | 1 line
  
  Get only the valid payment method
........
  r2239 | danydb | 2008-11-24 23:03:34 +0100 (Mon, 24 Nov 2008) | 1 line
  
  cosmetic remove debug info
........
  r2240 | danydb | 2008-11-24 23:04:07 +0100 (Mon, 24 Nov 2008) | 1 line
  
  Filter the search to the good frd_id
........
  r2241 | danydb | 2008-11-26 18:11:30 +0100 (Wed, 26 Nov 2008) | 2 lines
  
  BUG if no class base is given the flag create account is false
........
  r2242 | danydb | 2008-11-26 18:45:56 +0100 (Wed, 26 Nov 2008) | 1 line
  
  Create note of fee + database patch
........
This commit is contained in:
Dany De Bontridder 2008-11-26 18:32:19 +00:00
parent e275645199
commit 8e1db97b25
25 changed files with 925 additions and 134 deletions

View file

@ -124,7 +124,7 @@ class Document
$file_to_parse=$filename;
// affect a number
$this->d_number=NextSequence($this->db,"seq_doc_type_".$row['md_type']);
echo_debug(__FILE__,__LINE__,"seq_doc_type_".$row['md_type'].' = '.$this->d_number);
// parse the document - return the doc number ?
$this->ParseDocument($dirname,$file_to_parse,$type);
@ -190,7 +190,7 @@ class Document
{
if ( mkdir($temp_dir) == false )
{
echo "Ne peut pas cr�er le r�pertoire ".$temp_dir;
echo "Ne peut pas créer le répertoire ".$temp_dir;
exit();
}
}
@ -224,16 +224,18 @@ class Document
//read the file
while(! feof($h))
{
echo_debug(__FILE__,__LINE__,'Read a line');
// replace the tag
$buffer=fgets($h);
// search in the buffer the magic << and >>
// while ereg finds something to replace
while ( eregi ($regex,$buffer,$f) )
{
echo_debug(__FILE__,__LINE__,'Search for a regex');
echo_debug('class_document',__LINE__,'var_export '.var_export( $f,true));
foreach ( $f as $pattern )
{
echo_debug(__FILE__,__LINE__,'for each pattern '.$pattern);
echo_debug('class_document',__LINE__, "pattern");
echo_debug('class_document',__LINE__, var_export($pattern,true));
$to_remove=$pattern;
@ -244,11 +246,7 @@ class Document
// if the pattern if found we replace it
$value=$this->Replace($pattern);
// if the document is OOo, we need to transform accentuate letters
if ( $p_type=='OOo' )
$value = utf8_encode($value);
if ( strpos($value,'ERROR') != false ) $value="";
// replace into the $buffer
// take the position in the buffer
$pos=strpos($buffer,$to_remove);
@ -475,8 +473,8 @@ class Document
*/
function Replace($p_tag)
{
$p_tag=strtoupper($p_tag);
$p_tag=str_replace('=','',$p_tag);
$p_tag=strtoupper($p_tag);
$p_tag=str_replace('=','',$p_tag);
$r="Tag inconnu";
static $counter=0;
switch ($p_tag)
@ -596,6 +594,18 @@ class Document
$tiers->get_by_qcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_NUMBER_CUSTOMER);
break;
case 'CUST_BANQUE_NO':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->get_by_qcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_BQ_NO);
break;
case 'CUST_BANQUE_NAME':
$tiers=new fiche($this->db);
$qcode=isset($_REQUEST['qcode_dest'])?$_REQUEST['qcode_dest']:$_REQUEST['e_client'];
$tiers->get_by_qcode($qcode,false);
$r=$tiers->strAttribut(ATTR_DEF_BQ_NAME);
break;
// Marchandise in $_POST['e_march*']
// \see user_form_achat.php or user_form_ven.php
@ -642,7 +652,7 @@ class Document
// check if the march exists
if ( ! isset (${$id})) return "";
// check that something is sold
if ( ${'e_march'.$counter.'_sell'} != 0 && ${'e_quant'.$counter} != 0 )
if ( ${'e_march'.$counter.'_price'} != 0 && ${'e_quant'.$counter} != 0 )
{
$f=new fiche($this->db);
$f->get_by_qcode(${$id},false);
@ -652,7 +662,7 @@ class Document
case 'VEN_ART_PRICE':
extract ($_POST);
$id='e_march'.$counter.'_sell' ;
$id='e_march'.$counter.'_price' ;
if ( !isset (${$id}) ) return "";
$r=${$id};
break;
@ -674,7 +684,7 @@ class Document
if ( !isset (${$id}) ) return "";
if ( ${$id} == -1 ) return "";
$qt='e_quant'.$counter;
$price='e_march'.$counter.'_sell' ;
$price='e_march'.$counter.'_price' ;
if ( ${$price} == 0 || ${$qt} == 0
|| strlen(trim( $price )) ==0
|| strlen(trim($qt)) ==0)
@ -696,7 +706,7 @@ class Document
case 'TVA_AMOUNT':
extract ($_POST);
$qt='e_quant'.$counter;
$price='e_march'.$counter.'_sell' ;
$price='e_march'.$counter.'_price' ;
$tva='e_march'.$counter.'_tva_id';
if ( !isset (${'e_march'.$counter}) ) return "";
// check that something is sold
@ -715,7 +725,7 @@ class Document
case 'VEN_ART_TVA':
extract ($_POST);
$qt='e_quant'.$counter;
$price='e_march'.$counter.'_sell' ;
$price='e_march'.$counter.'_price' ;
$tva='e_march'.$counter.'_tva_id';
if ( !isset (${'e_march'.$counter}) ) return "";
// check that something is sold
@ -734,7 +744,7 @@ class Document
case 'VEN_ART_TVAC':
extract ($_POST);
$qt='e_quant'.$counter;
$price='e_march'.$counter.'_sell' ;
$price='e_march'.$counter.'_price' ;
$tva='e_march'.$counter.'_tva_id';
if ( !isset (${'e_march'.$counter}) ) return "";
// check that something is sold
@ -758,9 +768,9 @@ class Document
$id='e_quant'.$counter;
if ( !isset (${$id}) ) return "";
// check that something is sold
if ( ${'e_march'.$counter.'_sell'} == 0
if ( ${'e_march'.$counter.'_price'} == 0
|| ${'e_quant'.$counter} == 0
|| strlen(trim( ${'e_march'.$counter.'_sell'} )) ==0
|| strlen(trim( ${'e_march'.$counter.'_price'} )) ==0
|| strlen(trim(${'e_quant'.$counter})) ==0 )
return "";
$r=${$id};
@ -768,13 +778,13 @@ class Document
case 'VEN_HTVA':
extract ($_POST);
$id='e_march'.$counter.'_sell' ;
$id='e_march'.$counter.'_price' ;
$quant='e_quant'.$counter;
if ( !isset (${$id}) ) return "";
// check that something is sold
if ( ${'e_march'.$counter.'_sell'} == 0 || ${'e_quant'.$counter} == 0
|| strlen(trim( ${'e_march'.$counter.'_sell'} )) ==0
if ( ${'e_march'.$counter.'_price'} == 0 || ${'e_quant'.$counter} == 0
|| strlen(trim( ${'e_march'.$counter.'_price'} )) ==0
|| strlen(trim(${'e_quant'.$counter})) ==0)
return "";
/*!\todo verify that price and quant are numeric
@ -787,13 +797,13 @@ class Document
case 'VEN_TVAC':
extract ($_POST);
$id='e_march'.$counter.'_sell' ;
$id='e_march'.$counter.'_price' ;
$quant='e_quant'.$counter;
// if it is exist
if ( ! isset(${$id}))
return "";
// check that something is sold
if ( ${'e_march'.$counter.'_sell'} == 0 || ${'e_quant'.$counter} == 0 )
if ( ${'e_march'.$counter.'_price'} == 0 || ${'e_quant'.$counter} == 0 )
return "";
/*!\todo verify that price and quant are numeric
*/
@ -814,7 +824,7 @@ class Document
$sum=0.0;
for ($i=0;$i<$nb_item;$i++)
{
$sell='e_march'.$i.'_sell';
$sell='e_march'.$i.'_price';
$qt='e_quant'.$i;
echo_debug('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);
@ -842,7 +852,7 @@ class Document
$tva=GetTvaRate($this->db,${'e_march'.$i.'_tva_id'});
$tva_rate=( $tva == null || $tva == 0 )?0.0:$tva['tva_rate'];
echo_debug('class_document',__LINE__,' :'.$i.' sur '.$nb_item);
$sell=${'e_march'.$i.'_sell'};
$sell=${'e_march'.$i.'_price'};
$qt=${'e_quant'.$i};
echo_debug('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);
@ -860,7 +870,7 @@ class Document
$tva=GetTvaRate($this->db,${'e_march'.$i.'_tva_id'});
$tva_rate=( $tva == null || $tva == 0 )?0.0:$tva['tva_rate'];
echo_debug('class_document',__LINE__,' :'.$i.' sur '.$nb_item);
$sell=${'e_march'.$i.'_sell'};
$sell=${'e_march'.$i.'_price'};
$qt=${'e_quant'.$i};
echo_debug('class_document',__LINE__,'sell :'.$sell.' qt = '.$qt);