Merge branch 'dev7109'

This commit is contained in:
Dany De Bontridder 2019-09-12 21:44:26 +02:00
commit f4d6c5c564
14 changed files with 172 additions and 49 deletions

View file

@ -31,7 +31,7 @@ PROJECT_NAME = noalyss
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = Version-7
PROJECT_NUMBER = Version-7.1
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@ -656,7 +656,7 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = ../../html/addon ../../include/tfpdf ../../unit-test ../../include/ext ../../include/config.inc.php
EXCLUDE = ../../html/addon ../../unit-test ../../include/ext ../../include/config.inc.php
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded

View file

@ -191,6 +191,8 @@ $path = array(
"ledger_show"=>"ajax_ledger_show",
//Show the available distribution keys for analytic
"anc_key_choice"=>"ajax_anc_key_choice" ,
//Clean the detail for analytic
"anc_key_clean"=>"ajax_anc_key_clean" ,
// Show the activities computed with the selected distribution key
"anc_key_compute"=>"ajax_anc_key_compute" ,
//From admin, revoke the access to a folder from an user

View file

@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
global $g_user,$cn,$g_parameter;
$http=new HttpInput();
$cn=Dossier::connect();
$g_user=new User($cn);
$g_user->check();
@ -42,7 +42,7 @@ $only_plugin=$g_user->check_dossier(dossier::id());
set_language();
$ext=new Extension($cn);
if ( $ext->search($_REQUEST['plugin_code']) != -1 )
if ( $ext->search($http->request("plugin_code")) != -1 )
{
/* security */
if ( !isset ($_SESSION['g_user']) || $ext->can_request($_SESSION['g_user']) == 0 )

View file

@ -491,6 +491,55 @@ function anc_key_choice(p_dossier, p_table, p_amount,p_ledger)
error_message(e.message);
}
}
/**
* reset all the details of a row
* @param p_dossier is the dossier
* @param p_table the table id of the target
* @param p_amount amount to distribute
* @param p_ledger ledger id
* @param p_jrnx_id jrnx.id
*/
function anc_key_clean(p_dossier, p_table, p_amount,p_ledger,p_jrnx_id,p_sequence)
{
waiting_box();
var op = 'op=anc_key_clean';
var queryString = op + "&gDossier=" + p_dossier + "&t=" + p_table + "&amount=" + p_amount+"&jrnx_id="+p_jrnx_id+'&p_seq='+p_sequence;
try {
queryString+='&led='+p_ledger;
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'get',
parameters: queryString,
onFailure: error_box,
onSuccess: function(req, json) {
try
{
var answer = req.responseXML;
remove_waiting_box();
var html = answer.getElementsByTagName('code');
if (html.length == 0) {
var rec = req.responseText;
alert_box('erreur :' + rec);
}
var code_html = getNodeText(html[0]); // Firefox ne prend que les 4096 car.
code_html = unescape_xml(code_html);
$(p_table+"t"+p_sequence).innerHTML=code_html;
} catch (e)
{
error_message(e.message);
}
}
}
);
} catch (e) {
error_message(e.message);
}
}
/**
* Add a row for distribution key.
* This function add a row in the table key distribution

View file

@ -0,0 +1,76 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* @file
* @brief show the available distribution keys for analytic activities. Expected
* parameter are
* - t for the table id
* - amount is the amount to distributed
*
*/
// Copyright (2014) Author Dany De Bontridder danydb@aevalys.eu
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
$http=new HttpInput();
try
{
$amount=$http->get("amount", "number");
$table_id=$http->get("t");
$ledger=$http->get('led',"number");
$jrnx_id=$http->get("jrnx_id","string","");
$sequence=$http->get("p_seq","number");
}
catch (Exception $exc)
{
error_log($exc->getTraceAsString());
return;
}
require_once 'class/anc_operation.class.php';
global $g_user;
if ($g_user->get_ledger_access($ledger)=='W')
{
ob_start();
$anc_op = new Anc_Operation($cn);
$anc_op->j_id = $jrnx_id;
$anc_op->in_div= $t ;
/* compute total price */
bcscale(2);
// echo $anc_op->display_table(1, $amount, $t);
echo $anc_op->display_form_plan(NULL,1,1,$sequence,$amount,$table_id,FALSE);
$response = ob_get_clean();
} else {
$response = _("Interdit");
}
$html = escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl></ctl>
<code>$html</code>
</data>
EOF;
?>

View file

@ -52,8 +52,11 @@ echo $texte->input();
echo '</span>';
echo dossier::hidden();
$hid=new IHidden();
echo $hid->input("c1",$_REQUEST['c1']);
echo $hid->input("c2",$_REQUEST['c2']);
$c1=$http->request('c1');
$c2=$http->request('c2');
echo $hid->input("c1",$c1);
echo $hid->input("c2",$c2);
echo $hid->input("go");
echo HtmlInput::submit("go",_("Recherche"));
echo '</form>';
@ -61,15 +64,15 @@ echo '</form>';
if ( isset($_REQUEST['go']))
{
$cn=Dossier::connect();
$plan=new Anc_Plan($cn,$_REQUEST['c2']);
$plan->pa_id=$_REQUEST['c2'];
$plan=new Anc_Plan($cn,$c2);
$plan->pa_id=$c2;
if ( $plan->exist()==false)
exit(_("Ce plan n'existe pas"));
$plabel=$http->request("plabel");
$sql="select po_name , po_description from poste_analytique ".
"where pa_id=$1 and ".
" (po_name ~* $2 or po_description ~* $3) order by po_name";
$array=$cn->get_array($sql,array($_REQUEST['c2'],$_REQUEST['plabel'],$_REQUEST['plabel']));
$array=$cn->get_array($sql,array($_c2,$plabel,$plabel));
if (empty($array) == true)
{
@ -81,7 +84,7 @@ if ( isset($_REQUEST['go']))
foreach ($array as $line)
{
$js=sprintf("onclick=\"$('%s').value='%s';removeDiv('%s')\"",
$_REQUEST['c1'],
$c1,
$line['po_name'],$ctl);
echo '<tr>'.

View file

@ -234,37 +234,7 @@ switch ($act)
$a_answer["content"]=$ex->getMessage();
}
break;
// case "add_per":
// $per=new Periode($cn, $periode_id);
// $per->load();
//
// $p_exercice=new ISelect('p_exercice');
// $p_exercice->value=$cn->make_array("select distinct p_exercice,p_exercice from parm_periode order by 1 desc");
// $title=_('Ajout période');
// $title_par="<p>"._('On ne peut ajouter une période que sur un exercice qui existe').
// "</p>";
//
// $p_start=new IDate('p_start');
// $p_end=new IDate('p_end');
//
// $html='';
// $html.=HtmlInput::title_box($title, 'mod_periode');
// $html.=$title_par;
// $html.='<form method="post">' ;
// $html.=HtmlInput::hidden("ac", $http->post("ac"));
// $html.=Dossier::hidden();
// $html.='<table>';
//
// $html.=tr(td(_(' Début période : ')).td($p_start->input()));
// $html.=tr(td(_(' Fin période : ')).td($p_end->input()));
// $html.=tr(td(_(' Exercice : ')).td($p_exercice->input()));
// $html.='</table>';
// $html.=HtmlInput::submit('add_per', _('sauver'));
// $html.=HtmlInput::button('close', _('fermer'),
// 'onclick="removeDiv(\'mod_periode\')"');
// $html.='</form>';
// $a_answer['content']=$html;
// break;
case 'insert_periode':
try
{

View file

@ -114,6 +114,7 @@ class Anc_Group_Operation
$wDescription->input()."</td></tr>";
$Plan=new Anc_Plan($this->db);
$aPlan=$Plan->get_list();
$this->a_operation=(empty($this->a_operation))?[]:$this->a_operation;
$max=(count($this->a_operation)<$this->nMaxRow)?$this->nMaxRow:count($this->a_operation);
$ret.='</table><table id="ago" style="width: 100%;">';
/* show 10 rows */

View file

@ -642,6 +642,22 @@ class Anc_Operation
$button_key->name="js".$p_id.$p_seq;
$button_key->label=_("Clef");
$result .= $button_key->input();
/**
* Add a button to clean the detail
*/
$button_clean=new IButton();
$button_clean->javascript=sprintf("anc_key_clean('%s','%s','%s','%s','%s','%s');",
$gDossier,
$p_id,
$p_amount,
$ledger,
$this->j_id,
$p_seq
);
$button_clean->name=uniqid();
$button_clean->label=_("Efface détail");
$result.=$button_clean->input();
}

View file

@ -949,6 +949,7 @@ class Document
/* if we do not use vat this var. is not set */
if ( !isset(${$tva}) ) return '';
if ( !isset (${'e_march'.$this->counter}) ) return "";
if ( !isset (${$tva}) ) return "";
// check that something is sold
if ( ${$price} == 0 || ${$qt} == 0
|| strlen(trim( $price )) ==0
@ -964,6 +965,7 @@ class Document
$price='e_march'.$this->counter.'_price' ;
$tva='e_march'.$this->counter.'_tva_id';
if ( !isset (${'e_march'.$this->counter}) ) return "";
if ( !isset (${$tva}) ) return "";
// check that something is sold
if ( ${$price} == 0 || ${$qt} == 0
|| strlen(trim( $price )) ==0
@ -981,6 +983,7 @@ class Document
$price='e_march'.$this->counter.'_price' ;
$tva='e_march'.$this->counter.'_tva_id';
if ( !isset (${'e_march'.$this->counter}) ) return "";
if ( !isset (${$tva}) ) return "";
// check that something is sold
if ( ${$price} == 0 || ${$qt} == 0
|| strlen(trim( $price )) ==0

View file

@ -73,7 +73,7 @@ class Periode_Ledger_Table
}
function get_resource_periode_ledger($p_ledger_id)
{
$ret=$this->cn->exec_sql($this->sql." where jrn_def_id = $1 order by p_start desc",[$p_ledger_id]);
$ret=$this->cn->exec_sql($this->sql." where jrn_def_id = $1 order by p_start asc",[$p_ledger_id]);
return $ret;
}
/**

View file

@ -25,6 +25,8 @@
*/
require_once NOALYSS_INCLUDE.'/class/acc_ledger_sold.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger_purchase.class.php';
require_once NOALYSS_INCLUDE.'/class/pdf_land.class.php';
class Print_Ledger_Detail_Item extends PDFLand
{
public function __construct (Database $p_cn,Acc_Ledger $p_jrn)

View file

@ -70,7 +70,7 @@
*/
abstract class Data_SQL
{
private $cn; //! Database connection
var $cn; //! Database connection
var $name; //! Array of logical and real name
var $primary_key; //! Column name of the primary key
var $type; //! Type of the data

View file

@ -81,16 +81,17 @@ $wSel->value=$sel_jrn;
$wSel->name='jrn_def_id';
$wSel->selected=$p_ledger_id;
echo _("Choisissez global ou uniquement le journal à fermer").$wSel->input();
echo HtmlInput::submit('choose', 'Valider');
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo "</form>";
echo HtmlInput::hidden('ac', $http->request('ac'));
// display a filter by exercice
echo _("Montrer l'exercice");
$max_exercice=$cn->get_value("select max(p_exercice) from parm_periode");
$p_exercice=$http->request("p_exercice","string",$max_exercice);
$p_exercice=$http->request("p_exercice_sel","string",$max_exercice);
Periode::filter_exercice($p_exercice);
$js_close_selected="jsper.close_selected()";
echo HtmlInput::submit('choose', 'Valider');
echo "</form>";
echo HtmlInput::button_action(_("Fermer les périodes sélectionnées"),
$js_close_selected);