diff --git a/html/ajax_misc.php b/html/ajax_misc.php index fa7a152a2..3420617d1 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -66,15 +66,10 @@ $html = var_export($_REQUEST, true); switch ($op) { case "remove_anc": - if ($user->check_action(CAOD)) $cn->exec_sql("delete from operation_analytique where oa_group=$1", array($_GET['oa'])); break; case "rm_stock": require_once('constant.security.php'); - if ($user->check_action(STOWRITE) == 0) - { - exit(); - } $cn->exec_sql('delete from stock_goods where sg_id=$1', array($s_id)); $html = escape_xml($s_id); header('Content-type: text/xml; charset=UTF-8'); @@ -537,5 +532,5 @@ EOF; case 'autoanc': require_once('ajax_auto_anc_card.php'); break; - + } \ No newline at end of file diff --git a/include/class_acc_bilan.php b/include/class_acc_bilan.php index dad824b1e..f20d791c5 100644 --- a/include/class_acc_bilan.php +++ b/include/class_acc_bilan.php @@ -144,6 +144,7 @@ class Acc_Bilan /*!\brief verify that the saldo is good for the type of account */ function verify() { + bcscale(2); echo '

Comptes normaux

'; $this->warning('Actif avec un solde crediteur','ACT','D'); $this->warning('Passif avec un solde debiteur','PAS','C'); @@ -171,7 +172,7 @@ class Acc_Bilan $sql.="and $sql_periode"; $credit_actif=$this->db->get_value($sql); - $total_actif=abs($debit_actif-$credit_actif); + $total_actif=abs(bcsub($debit_actif,$credit_actif)); echo ''; echo tr(td( 'Total actif ').td($total_actif,'style="text-align:right"')); @@ -187,13 +188,13 @@ class Acc_Bilan " where j_debit='f' and (pcm_type='PAS' or pcm_type='PASINV') "; $sql.="and $sql_periode"; $credit_passif=$this->db->get_value($sql); - $total_passif=abs($debit_passif-$credit_passif); + $total_passif=abs(bcsub($debit_passif,$credit_passif)); /* diff actif / passif */ echo tr(td('Total passif ').td($total_passif,'style="text-align:right"')); if ( $total_actif != $total_passif ) { - $diff=$total_actif-$total_passif; + $diff=bcsub($total_actif,$total_passif); echo tr(td(' Difference Actif - Passif ').td($diff,'style="text-align:right"'),'style="font-weight:bolder"'); } @@ -208,7 +209,7 @@ class Acc_Bilan " where j_debit='f' and (pcm_type='CHA' or pcm_type='CHAINV')"; $sql.="and $sql_periode"; $credit_charge=$this->db->get_value($sql); - $total_charge=abs($debit_charge-$credit_charge); + $total_charge=abs(bcsub($debit_charge,$credit_charge)); echo tr(td('Total charge ').td($total_charge,'style="text-align:right"')); @@ -223,10 +224,10 @@ class Acc_Bilan " where j_debit='f' and (pcm_type='PRO' or pcm_type='PROINV')"; $sql.="and $sql_periode"; $credit_pro=$this->db->get_value($sql); - $total_pro=abs($debit_pro-$credit_pro); + $total_pro=abs(bcsub($debit_pro,$credit_pro)); echo tr(td('Total produit ').td($total_pro,'style="text-align:right"')); - $diff=$total_pro-$total_charge; + $diff=bcsub($total_pro,$total_charge); echo tr( td("Difference Produit - Charge",'style="padding-right:20px"').td($diff,'style="text-align:right"'),'style="font-weight:bolder"'); echo '
'; @@ -296,7 +297,7 @@ class Acc_Bilan * \param $p_handle the handle to the file * \param * \param - * + * * * \return */ @@ -324,9 +325,9 @@ class Acc_Bilan }// end read form line per line } /*!\brief generate the ods document - * \param the handle to the template file - * \return the xml - *@note + * \param the handle to the template file + * \return the xml + *@note * Sur une seule ligne il y a plusieurs données, donc il y a plusieurs boucles, pour les autres documents * cela devrait être fait aussi, actuellement ces documents, n'acceptent qu'une formule par ligne. *@note @@ -352,13 +353,13 @@ class Acc_Bilan ob_start(); /* unzip the document */ $zip = new Zip_Extended; - if ($zip->open($work_file) === TRUE) + if ($zip->open($work_file) === TRUE) { $zip->extractTo($dirname.DIRECTORY_SEPARATOR); $zip->close(); - } else + } else { - echo __FILE__.":".__LINE__."cannot unzip model ".$filename; + echo __FILE__.":".__LINE__."cannot unzip model ".$filename; } ob_end_clean(); @@ -391,7 +392,7 @@ class Acc_Bilan // the line contains the magic << $tmp=""; - + while (preg_match_all($regex,$line_rtf,$f2) > 0 ) { // the f2 array contains all the magic << in the line @@ -606,13 +607,13 @@ class Acc_Bilan case 'ods': /* header("Pragma: public"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Cache-Control: must-revalidate"); + header("Cache-Control: must-revalidate"); if ( $this->b_type == 'odt' ) header('Content-type: application/vnd.oasis.opendocument.text'); if ( $this->b_type == 'ods' ) header('Content-type: application/vnd.oasis.opendocument.spreadsheet'); header('Content-Disposition: attachment;filename="'.$this->b_name.'.odt"',FALSE); - header("Accept-Ranges: bytes"); + header("Accept-Ranges: bytes"); */ ob_start(); // save the file in a temp folder @@ -636,14 +637,14 @@ class Acc_Bilan */ ob_start(); $zip = new Zip_Extended; - if ($zip->open($work_file) === TRUE) + if ($zip->open($work_file) === TRUE) { $zip->extractTo($dirname.DIRECTORY_SEPARATOR); $zip->close(); - } - else + } + else { - echo __FILE__.":".__LINE__."cannot unzip model ".$filename; + echo __FILE__.":".__LINE__."cannot unzip model ".$filename; } // Remove the file we do not need anymore diff --git a/include/class_acc_ledger_fin.php b/include/class_acc_ledger_fin.php index e66b808de..85fa22a44 100644 --- a/include/class_acc_ledger_fin.php +++ b/include/class_acc_ledger_fin.php @@ -472,7 +472,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $r.=""; $r.="code"; $r.="Commentaire"; - $r.="Montant"; + $r.="Montant"; $r.=' Op. Concernée(s)'; /* if we use the AC */ @@ -521,8 +521,12 @@ class Acc_Ledger_Fin extends Acc_Ledger // amount $r.=''.nbm($tiers_amount).''; // concerned - $r.=''; - $r.=${"e_concerned".$i}; + $r.=''; + if (${"e_concerned".$i} != '') + { + $jr_internal=$this->db->get_value("select jr_internal from jrn where jr_id=$1",array(${"e_concerned".$i})); + $r.=HtmlInput::detail_op(${"e_concerned".$i},$jr_internal); + } $r.=''; // encode the pa if ( $g_parameter->MY_ANALYTIC!='nu' && preg_match("/^[6,7]/",$fTiers->strAttribut(ATTR_DEF_ACCOUNT))==1 ) // use of AA @@ -636,7 +640,7 @@ class Acc_Ledger_Fin extends Acc_Ledger $amount=0.0; $idx_operation=0; $ret=''; - $ret.=tr(th('Quick Code').th('Nom').th('Libellé').th('Montant')); + $ret.=tr(th('Quick Code').th('Nom').th('Libellé').th('Montant',' style="text-align:right"')); // Credit = goods for ( $i = 0; $i < $nb_item;$i++) { diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index 7c83e4d90..f9547b870 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -331,7 +331,6 @@ class Acc_Ledger_Sold extends Acc_Ledger $tva[$idx_tva]+=$tva_item; else $tva[$idx_tva]=$tva_item; - var_dump($oTva->get_parameter("both_side")); if ($oTva->get_parameter("both_side")==0) $tot_tva=round(bcadd($tva_item,$tot_tva),2); } @@ -1283,7 +1282,6 @@ class Acc_Ledger_Sold extends Acc_Ledger $r.=HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"'); - $r.=""; return $r; } diff --git a/include/class_contact.php b/include/class_contact.php index c928ed347..e2f573382 100644 --- a/include/class_contact.php +++ b/include/class_contact.php @@ -42,12 +42,12 @@ class contact extends Fiche /*! Summary ************************************************** * \brief show the default screen - * + * * \param p_search (filter) - * + * * \return string to display */ - function Summary($p_search="",$p_action="",$p_sql="") + function Summary($p_search="",$p_action="",$p_sql="",$p_nothing=false) { $p_search=sql_string($p_search); $extra_sql=""; diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index 6f202a8d1..7417c6bf7 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -169,6 +169,9 @@ if (!isset($_REQUEST ['p_jrn'])) else $Ledger->id = $_REQUEST ['p_jrn']; +if (isset ($_REQUEST['p_jrn_predef'])){ + $Ledger->id=$_REQUEST['p_jrn_predef']; +} // pre defined operation // echo '
'; diff --git a/include/compta_ods.inc.php b/include/compta_ods.inc.php index ce5373493..9e434a443 100644 --- a/include/compta_ods.inc.php +++ b/include/compta_ods.inc.php @@ -40,12 +40,12 @@ global $g_user; $cn = new Database(dossier::id()); $id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1; +$id = (isset($_REQUEST['p_jrn_predef'])) ? $_REQUEST['p_jrn_predef'] : -1; $ledger = new Acc_Ledger($cn, $id); $first_ledger = $ledger->get_first('ODS'); $ledger->id = ($ledger->id == -1) ? $first_ledger['jrn_def_id'] : $id; /* !\brief show a form for quick_writing */ -$id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1; $def = -1; $ledger->with_concerned = true; diff --git a/include/compta_ven.inc.php b/include/compta_ven.inc.php index 5585eaa98..7f6ad39ac 100644 --- a/include/compta_ven.inc.php +++ b/include/compta_ven.inc.php @@ -180,14 +180,17 @@ global $g_parameter; // pre defined operation // - if ( !isset($_REQUEST ['p_jrn'])) + if ( !isset($_REQUEST ['p_jrn']) ) { $def_ledger=$Ledger->get_first('ven'); $Ledger->id=$def_ledger['jrn_def_id']; } else $Ledger->id=$_REQUEST ['p_jrn']; - + if (isset ($_REQUEST['p_jrn_predef'])){ + $Ledger->id=$_REQUEST['p_jrn_predef']; + } + echo '
'; echo '
'; echo HtmlInput::hidden('ac',$_REQUEST['ac']); diff --git a/include/export_fiche_balance_pdf.php b/include/export_fiche_balance_pdf.php index 0ed44165d..10f41a937 100644 --- a/include/export_fiche_balance_pdf.php +++ b/include/export_fiche_balance_pdf.php @@ -72,7 +72,7 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5) $afiche[0]=array('fd_id'=>$_REQUEST['cat']); } - if ( $allcard==0 && empty($aCard)) + if ( $allcard==0 && empty($afiche)) { $pdf->Cell(0,10, "Aucune fiche trouvée");//Save PDF to file $fDate=date('dmy-Hi'); diff --git a/include/impress_fiche.inc.php b/include/impress_fiche.inc.php index f102de064..ce165faaf 100644 --- a/include/impress_fiche.inc.php +++ b/include/impress_fiche.inc.php @@ -154,7 +154,7 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5 ) $fd=new Fiche_Def($cn,$_REQUEST['cat']); - if ( $allcard==1 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false ) + if ( $allcard==0 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false ) { echo alert("Cette catégorie n'ayant pas de poste comptable n'a pas de balance"); exit; @@ -172,10 +172,13 @@ if ( $_GET['histo'] == 4 || $_GET['histo']==5 ) for ($e=0;$eexec_sql("select f_id,ad_value from fiche join fiche_detail using(f_id) where fd_id=$1 and ad_id=1 order by 2 ",array($afiche[$e]['fd_id'])); - if ( $cn->count()==0) + if ( $cn->count()==0 ) { - echo "Aucune fiche trouvée"; - exit; + if ( $allcard==0) { + echo "Aucune fiche trouvée"; + exit; + } else + continue; } echo '

'.$cn->get_value("select fd_label from fiche_def where fd_id=$1",array($afiche[$e]['fd_id'])).'

'; echo '
'; diff --git a/include/operation_ods_new.inc.php b/include/operation_ods_new.inc.php index 346990fa8..3dd6fb0de 100644 --- a/include/operation_ods_new.inc.php +++ b/include/operation_ods_new.inc.php @@ -31,7 +31,8 @@ require_once 'class_iconcerned.php'; global $g_user; $cn=new Database(dossier::id()); -$id=(isset ($_REQUEST['p_jrn']))?$_REQUEST['p_jrn']:-1; +$id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1; +$id = (isset($_REQUEST['p_jrn_predef'])) ? $_REQUEST['p_jrn_predef'] : -1; $ledger=new Acc_Ledger($cn,$id); $first_ledger=$ledger->get_first('ODS'); $ledger->id=($ledger->id==-1)?$first_ledger['jrn_def_id']:$id; diff --git a/include/stock.inc.php b/include/stock.inc.php index b22590a7e..1bc1ecda6 100644 --- a/include/stock.inc.php +++ b/include/stock.inc.php @@ -41,17 +41,12 @@ global $g_user; $href=basename($_SERVER['PHP_SELF']); -// Get The priv on the selected folder -$g_user->can_request(STOLE,1); - - $action= ( isset ($_GET['action']))? $_GET['action']:""; include_once("stock_inc.php"); // Adjust the stock if ( isset ($_POST['sub_change'])) { - $g_user->can_request(STOWRITE,1); $change=$_POST['stock_change']; $sg_code=$_POST['sg_code']; $sg_date=$_POST['sg_date']; @@ -121,8 +116,6 @@ else // View details if ( $action == 'detail' ) { - // Check if User Can see the stock - $g_user->can_request(STOLE,1); $sg_code=(isset ($_GET['sg_code'] ))?$_GET['sg_code']:$_POST['sg_code']; $year=(isset($_GET['year']))?$_GET['year']:$_POST['year']; $a=ViewDetailStock($cn,$sg_code,$year);