Merge branch 'pre-stable' into stable

* pre-stable: (107 commits)
  cosmetic
  cosmetic
  cosmetic
  C0SEC : add a search for the table of users
  Widget : button zoom, cosmetic
  Widget : event fix date description , set interval to 14 days
  Task #2372 : Change AD
  set version 9.3
  upgrade199 : Correct SQL
  Database : correct the scripts for creating DB and adapt to postgreSQL 12
  set the search_path
  Fix : error when empty
  Limit search thanks user's preferences
  Typo
  Cosmetic
  Cosmetic : loading of widget
  PHPUnit : update test
  WIDGET : db upgrade 199
  WIDGET : ergonomy, show a number on the widget the dialog box to manage them appears
  Cosmetic and Documentation
  ...
This commit is contained in:
sparkyx 2024-08-31 23:45:07 +02:00
commit 2a297e0884
202 changed files with 17365 additions and 8159 deletions

1
.gitignore vendored
View file

@ -46,3 +46,4 @@ local/*
/include/ext/noalyss_document/.idea/
.idea/*
include/tfpdf/font/unifont/*
html/ads.html

2
README
View file

@ -1 +1 @@
Toute la documentation se trouve sur http://wiki.noalyss.eu
Toute la documentation se trouve sur https://gitlab.com/noalyss/noalyss-documentation

View file

@ -36,13 +36,19 @@
*
*/
if ( ! defined('ALLOWED')) define ('ALLOWED',1);
require_once '../include/constant.php';
require_once NOALYSS_INCLUDE."/lib/ac_common.php";
global $http;
$http=new HttpInput();
try {
$op= $http->request("op");
if ($op =='check_vatnumber') session_write_close();
} catch (\Exception $e) {
exit();
}
/* we ask a dg box for disconnecting */
if ($http->request('op',"string","") == 'disconnect') {
@ -60,24 +66,12 @@ if ( ! isset($_SESSION[SESSION_KEY."g_user"])) {
mb_internal_encoding("UTF-8");
$var = array( 'op');
$cont = 0;
/* check if mandatory parameters are given */
foreach ($var as $v)
{
if (!isset($_REQUEST [$v]))
{
echo "$v is not set ";
$cont = 1;
}
}
// If not connected to a folder
if ( ! isset($_REQUEST['gDossier'])) {
$gDossier=0;
}
if ($cont != 0) exit();
extract($_REQUEST, EXTR_SKIP );
@ -133,7 +127,7 @@ $html = var_export($_REQUEST, true);
set_language();
if ( LOGINPUT)
{
$file_loginput=fopen($_ENV['TMP'].'/scenario-'.$_SERVER['REQUEST_TIME'].'.php','a+');
$file_loginput=fopen($_ENV['TMP'].'/scenario-ajax-'.$_SERVER['REQUEST_TIME'].'.php','a+');
fwrite ($file_loginput,"<?php \n");
fwrite ($file_loginput,'//@description:'.$op."\n");
fwrite($file_loginput, '$_GET='.var_export($_GET,true));
@ -149,9 +143,19 @@ if ( LOGINPUT)
fwrite($file_loginput,"include '".basename(__FILE__)."';\n");
fclose($file_loginput);
}
/**
* for widget we call immediately a file outside the ajax folder
*/
if ($op == 'widget') {
session_write_close();
require_once NOALYSS_INCLUDE.'/widget/ajax.php';
return;
}
$path = array(
// search accounting , detail ...
"account"=>"ajax_poste",
"account"=>"ajax_account",
// display card detail :possible to update or add
"card"=>"ajax_card",
"ledger"=>"ajax_ledger",
@ -165,9 +169,9 @@ $path = array(
"user_sec_action"=>"ajax_user_security",
// Update in once all the ledgers
"ledger_access_all"=>"ajax_user_security",
// From the page CFGSEC,set the actions
// From the page C0SEC,set the actions
"action_access"=>"ajax_user_security",
// From the page CFGSEC,set all the actions
// From the page C0SEC,set all the actions
"action_access_all"=>"ajax_user_security",
"todo_list"=>"ajax_todo_list",
// Writing operation History for a card or an accounting
@ -254,7 +258,7 @@ $path = array(
"anc_accounting"=>"ajax_anc_accounting",
// Update name and description
"anc_updatedescription"=>"ajax_anc_plan",
// Update, insert or delete accounting frmo CFGPCMN
// Update, insert or delete accounting frmo C0PCMN
"accounting"=>"ajax_accounting",
// Show detail of an ANC operation
"anc_detail_op"=>"ajax_anc_detail_operation",
@ -352,7 +356,14 @@ $path = array(
'list_filter_followup'=>"ajax_follow_up",
//delete a filter for followup
'delete_filter_followup'=>"ajax_follow_up",
"check_vatnumber"=>"ajax_check_vatnumber"
// Check VAT NUMBER with VIES European VAT
"check_vatnumber"=>"ajax_check_vatnumber",
// Tax Detail
"tax_detail"=>"ajax_tax_detail"
// card category definition : from CCARD
,"category_card_definition"=>"ajax_category_card_definition"
// activate plugin for a profile
,'activate_plugin'=>'ajax_activate_plugin'
) ;
if (array_key_exists($op, $path)) {
@ -567,6 +578,8 @@ EOF;
}else {
$Res = $cn->exec_sql("select * from v_tva_rate
where
tva_purchase <> '#' and tva_sale <> '#'
order by tva_rate desc");
}
$Max = Database::num_row($Res);
@ -575,6 +588,7 @@ EOF;
$r.='<div >';
$r.=_('Cherche')." ".HtmlInput::filter_table("tva_select_table",'0,1,2,3' , 1);
$r.= '<TABLE class="sortable" style="width:100%" id="tva_select_table">';
$r.=th(_('id'));
$r.=th(_('code'));
$r.=th(_('Taux'),'class="sorttable_sorted_reverse"');
$r.=th(_('Symbole'));
@ -609,6 +623,7 @@ EOF;
$class=($i%2 == 0)?' class="odd" ':' class="even" ';
$r.='<tr'.$class. $script.' style="cursor : pointer">';
$r.=td($row['tva_id']);
$r.=td($row['tva_code']);
$r.=td($row['tva_rate']);
$r.=td($row['tva_label']);
$r.=td($row['tva_comment']);
@ -629,16 +644,15 @@ EOF;
EOF;
break;
case 'label_tva':
$code=$http->request('code','string','x');
$cn =Dossier::connect();
if (isNumber($id) == 0)
$tva=Acc_Tva::build($cn, $id);
if ($tva->tva_id == -1 )
$value = _('tva inconnue');
else
{
$Res = $cn->get_array("select * from tva_rate where tva_id = $1", array($id));
if (count($Res) == 0)
$value = _('tva inconnue');
else
$value = $Res[0]['tva_label'];
$value=htmlentities($tva->tva_label);
}
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF

View file

@ -40,18 +40,19 @@ require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
MaintenanceMode("block.html");
// Check if the needed field does exist
extract ($_GET, EXTR_SKIP );
foreach (array('t','c','p','q','n','gDossier') as $a)
{
if ( ! isset (${$a}) )
{
echo "error $a is not set ";
exit();
}
}
$http=new HttpInput();
// TVA id or TVA code
$t=$http->get("t");
// string qcode card
$c=$http->get("c");
// Price
$p=$http->get("p");
// quantity
$q=$http->get("q");
// row number (from 0) used to identify the row
$n=$http->get("n");
$tax_ac_id=$http->request("other_tax_id","number",-1);
// sometime number uses coma instead of dot for dec
$p=noalyss_str_replace(",",".",$p);
@ -63,10 +64,10 @@ $User->Check();
$User->check_dossier(Dossier::id());
// Retrieve the rate of vat, it $t == -1 it means no VAT
if ( $t != -1 && isNumber($t) == 1 )
if ( $t != -1 )
{
$tva_rate=new Acc_Tva($cn);
$tva_rate->set_parameter('id',$t);
$tva_rate=Acc_Tva::build($cn, $t);
/**
*if the tva_rate->load failed we don't compute tva
*/
@ -89,7 +90,7 @@ if ( $tax_ac_id !=-1) {
$other_tax=new Acc_Other_Tax_SQL($cn,$tax_ac_id);
$other_tax_amount=round(bcmul($amount,$other_tax->getp("ac_rate"),4)/100,2);
}
if ( $t != -1 && isNumber($t) == 1 )
if ( $t != -1 )
{
$total->set_parameter('amount_vat_rate',$tva_rate->get_parameter('rate'));
$total->compute_vat();

View file

@ -390,7 +390,7 @@ span.even {
display:block;
}
/* highlight table row */
tr.odd {
div.odd,tr.odd,li.odd {
background-color: #DCE7F5;
/*! opacity: 50%; */
}
@ -405,9 +405,7 @@ tr.odd > td,tr.even > td {
tr.highlight {
font-weight: bold;
}
tr.even {
/*! background-color: #F7F8FC; */
}
td.odd{
background-color:#DDE6FF;
}
@ -603,7 +601,22 @@ a.document:hover {
.input_text {
border:1px solid #4b4b91;
margin:1px;
border-radius: 2px;
border-radius: 5px;
}
@media (min-width: 576px) {
}
/* MeDium */
@media (min-width: 768px) {
border-radius: 5px;
padding: 2px;
}
/* LarGe */
@media (min-width: 992px) {
}
/* eXtraLarge */
@media (min-width: 1200px) {
}
.input_text:focus {
border:1px solid orange;
@ -615,6 +628,15 @@ h1.legend, legend {
font-style: italic;
font-size: 19.2px;
font-size: 1.2rem;
border: navy;
border-width: 1px;
border-style: solid;
padding: 1rem;
margin: 0.5rem 0rem 0.5rem 2rem;
width: 20rem;
border-radius: 5px;
}
fieldset fieldset legend {
color:#888;
@ -789,7 +811,7 @@ div.content div.pc_calendar tr{
}
@media only screen and (min-width: 640px) {
div.pc_calendar tr{
height:110px;
height:10%;
}
}
@media only screen and (max-width: 640px) {
@ -1425,6 +1447,12 @@ h2.title {
font-family: OpenSansRegular;
margin-bottom: 1px;
}
.box h2.title {
font-size: 1rem;
font-variant-caps: normal;
}
h3.title {
color: #0000FF;
margin-left: 30px;
@ -1764,9 +1792,9 @@ td.workday ol {
}
input.inum {
text-align:right;
border:1px solid #0000FF;
border:1px solid #4b4b91;
margin:2px;
border-radius: 2px;
border-radius: 5px;
}
div.box {
background-color:#e4e7ed;
@ -1778,9 +1806,6 @@ div.box {
font-size:0.90rem;
border-radius:5px;
width:97%;
margin:1% 1.5% 1% 1.5%;
margin-right:2px
}
/* SM */
@media (min-width: 576px) {
@ -1795,16 +1820,17 @@ div.box {
@media (min-width: 992px) {
div.box {
width: 46%;
margin: 1.5%;
height:40%;
}
}
/* XL */
@media (min-width: 1200px) {
div.box {
width: 32.8%;
margin: 0.2%;
width: 35rem;
max-height: 30%;
height: 45vh;
}
}
@ -1812,14 +1838,18 @@ div.box {
div.box table{
border-spacing:0px;
font-size: 96%;
width: 80%;
}
div.box tr.odd {
background-color: lightblue;
div.odd, div.box tr.odd {
background-color: #dce7f5;
border: 1px solid whitesmoke;
padding:2px;
}
div.box tr.even {
div.even ,div.box tr.even {
background-color: white;
border: 1px solid whitesmoke;
padding:2px;
}
#jrn_name_div h2{
font-size:38.4px;
@ -1830,6 +1860,7 @@ div.box tr.even {
}
fieldset {
border-width: 1px;
margin-left: 0.5rem;
}
#tva_select table {
border-spacing: 0px;
@ -3296,25 +3327,25 @@ li.li-active {
width: 1.5rem;
height: 1.5rem;
display: inline-block;
animation: turn-color 3.5s linear 0s infinite forwards;
animation: turn-color 6s linear 0s infinite forwards;
position: relative;
left: 0px;
top: 10px;
background: rgb(176, 173, 230);
box-shadow: #a7a7b3 1px 1px 40px;
border-radius: 5px;
/* border-radius: 5px;*/
}
.loading_msg:nth-child(2) {
background:blue;
animation: turn-color2 3.5s linear 0s infinite forwards;
animation: turn-color2 6s linear 0s infinite forwards;
}
.loading_msg:nth-child(3) {
background:red;
animation: turn-color3 3.5s linear 0s infinite forwards;
animation: turn-color3 6s linear 0s infinite forwards;
}
.loading_msg:nth-child(4) {
background:navy;
animation: turn-color2 3.5s linear 0s infinite forwards;
animation: turn-color2 6s linear 0s infinite forwards;
}
@keyframes turn-color{
@ -3433,4 +3464,138 @@ li.li-active {
padding: 0.5rem;
color:navy !important;
text-decoration: underline;
}
.hoverclass-drag {
background-color: white;
}
/**********************************************************************************************************************
* User's widget list
*
*********************************************************************************************************************/
#widget_box_id {
#widget_box_id {
width: 100%;
margin-left: 0px;
margin-right: 0px;
}
}
#contain_widget li {
padding : 0.75rem;
margin:2px;
border:navy solid 1px;
}
#widget_add li {
padding : 0.75rem;
margin:2px;
border:navy solid 1px;
}
@media (min-width: 576px) {
}
/* MeDium */
@media (min-width: 768px) {
#widget_box_id {
width: 100%;
margin-left: 0px;
margin-right: 0px;
}
}
/* LarGe */
@media (min-width: 992px) {
#widget_box_id {
width: 70%;
margin-left: 15%;
}
}
/* eXtraLarge */
@media (min-width: 1200px) {
}
span.widget-name {
font-size:105%;
font-family: bold;
font-stretch: extra-expanded;
margin-right: 2rem;
margin-top: -5px;
width: 5rem;
display: inline-block;
}
#dashboard_div_id {
margin-top:2vh;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
row-gap: 20px;
column-gap: 20px;
}
/*
* WIDGET
*/
#widget_box_select_id {
max-width: 70rem;
}
#widget_box_id {
max-width: 70rem;
}
.widget_param {
font-size: 105%;
font-weight: bold;
font-style: inherit;
border-width: 1px;
display: inline-block;
border-color: navy;
padding: 5px;
border-style: groove;
margin: 2px;
}
/**
* show the number in the widget
*/
.box_ident {
border-radius: 10px;
background: beige;
color: navy;
font-size: 3.4rem;
padding: 20px;
margin-left: 10px;
margin-top: 10px;
position:absolute;
}
/**
widget full size
*/
div.widget-full_size {
z-index: 1;
position: fixed;
top: 5px;
width: 96%;
height: 96%;
overflow: auto;
max-height: 100%;
margin: 2px;
}
@keyframes fill_up_loading {
30% {transform:rotateY(90deg);}
60% {transform:rotateY(-90deg);}
}

View file

@ -33,7 +33,7 @@ $http=new \HttpInput();
$g_user=new Noalyss_user($cn);
$g_user->Check();
$g_user->check_dossier($http->get('gDossier'));
$res=$cn->exec_sql("select distinct code,description from get_profile_menu($1) where code ~* $2 or description ~* $2 order by code limit 5 ",array($g_user->get_profile(),$http->post("acs")));
$res=$cn->exec_sql("select distinct code,coalesce(description,code) description from get_profile_menu($1) where code ~* $2 or description ~* $2 order by code limit 5 ",array($g_user->get_profile(),$http->post("acs")));
$nb=Database::num_row($res);
echo "<ul>";
set_language();

View file

@ -115,7 +115,7 @@ if ( isset($_SESSION[SESSION_KEY.'isValid']) && $_SESSION[SESSION_KEY.'isValid']
$filter_card=$d;
$filter_card=noalyss_str_replace('[sql]','',$d);
}
$sql="select vw_name,vw_first_name,vw_addr,vw_cp,vw_buy,vw_sell,tva_id
$sql="select vw_name,vw_first_name,vw_addr,vw_cp,vw_buy,vw_sell,tva_id,tva_code
from vw_fiche_attr
where quick_code=upper($1)". $filter_card;
@ -129,10 +129,11 @@ if ( isset($_SESSION[SESSION_KEY.'isValid']) && $_SESSION[SESSION_KEY.'isValid']
$name=$array[0]['vw_name'];
// use for followup
$sell=(isNumber($array[0]['vw_sell']) == 1) ? $array[0]['vw_sell'] : 0 ;
$buy=(isNumber($array[0]['vw_buy']) == 1) ?$array[0]['vw_buy']:0;
$tva_id=$array[0]['tva_id'];
$tva_id=(empty($array[0]['tva_id']))?$array[0]['tva_code']:$array[0]['tva_id'];
// Check null
$name=($name==null)?" ":noalyss_str_replace('"','',$name);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before After
Before After

View file

@ -232,6 +232,11 @@ if (isset($_REQUEST['reconnect'])&&isset($_REQUEST['backurl']))
<div class="mx-auto" id="login_div" style="margin-top:10%">
<h1 style="text-align: center;color:darkblue;font-weight: 800">NOALYSS</h1>
<?php
if ( file_exists("ads.html")) {
include "ads.html";
}
?>
<form id="login_frm" action="login.php" method="post" name="loginform" class="p-sm-3" >
<?php echo $goto; ?>

View file

@ -404,6 +404,8 @@ echo "<li>";
echo "</li>";
}
//---------------------------------------------------------------------------------------
// Check php modules
//---------------------------------------------------------------------------------------
@ -484,17 +486,20 @@ if ( (defined("MULTI") && MULTI==1)|| !defined("MULTI"))
?>
<h2><?php echo _('Base de données')?></h2>
<?php
// Verify Psql version
//--
//-------------------------------------------------------------------------------------------
// Verify Psql version
//
//-------------------------------------------------------------------------------------------
$sql="select setting from pg_settings where name='server_version'";
$version=$cn->get_value($sql);
echo _("Version base de données :"),$version;
$majeur=explode(".",$version);
if ( $majeur[0] < 10 )
if ( $majeur[0] < 12 )
{
?>
<p><?php echo $failed . _(" Vous devez absolument utiliser au minimum une version 10 de PostGresql, si votre distribution n'en
<p><?php echo $failed . _(" Vous devez utiliser au minimum une version 12 de PostGresql, si votre distribution n'en
offre pas, installez-en une en la compilant. Lisez attentivement la notice sur postgresql.org pour migrer
vos bases de données")?>
</p>
@ -594,19 +599,48 @@ if ($account == 0 ) {
echo "Creation of ".domaine."account_repository";
if ( DEBUGNOALYSS == 0 ) ob_start();
$cn->exec_sql("create database ".domaine."account_repository encoding='utf8'");
$cn=new Database();
$cn->start();
$cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/schema.sql");
$cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/data.sql");
$cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql");
$repo=new Database();
$sql_trigger_activate="
create or replace procedure public.trigger_activate(to_enable bool)
language plpgsql
as
$$
declare
rec1 record;
cmd text;
begin
for rec1 in (select relname,nspname
from pg_catalog.pg_class pc join pg_catalog.pg_namespace pn on (pn.oid=pc.relnamespace)
where pn.nspname in ('public','comptaproc') and relhastriggers is true) loop
if to_enable is false then
cmd=format('alter table %s.%s disable trigger all',rec1.nspname,rec1.relname);
else
cmd=format('alter table %s.%s enable trigger all',rec1.nspname,rec1.relname);
end if;
execute cmd;
raise notice '%',cmd;
end loop;
end
$$;
";
$repo->exec_sql($sql_trigger_activate);
$repo->start();
$repo->execute_script(NOALYSS_INCLUDE."/sql/account_repository/schema.sql");
$repo->exec_sql("call public.trigger_activate(false) ");
$repo->execute_script(NOALYSS_INCLUDE."/sql/account_repository/data.sql");
$repo->commit($cn);
/* update name administrator */
$cadmin=NOALYSS_ADMINISTRATOR;
$cpassword_admin=NOALYSS_ADMIN_PASSWORD;
$cn->exec_sql("update ac_users set use_login=$1,use_pass=md5($2),use_active=1 where use_id=1",
$repo->exec_sql("update public.ac_users set use_login=$1,use_pass=md5($2),use_active=1 where use_id=1",
array(strtolower($cadmin),$cpassword_admin));
$cn->commit($cn);
$repo->exec_sql("call public.trigger_activate(true) ");
$repo->exec_sql("drop procedure public.trigger_activate ");
if ( DEBUGNOALYSS == 0 )
{
ob_end_clean();
@ -620,27 +654,35 @@ if ($account == 0 ) {
$cn->exec_sql("create database ".domaine."mod1 encoding='utf8'");
$cn=new Database(1,'mod');
$cn->exec_sql($sql_trigger_activate);
$cn->start();
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/schema.sql');
$cn->exec_sql("call public.trigger_activate(false) ");
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/data.sql');
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/constraint.sql');
$cn->commit();
$cn->commit();
$cn->exec_sql("call public.trigger_activate(true) ");
$cn->exec_sql("drop procedure public.trigger_activate");
if ( DEBUGNOALYSS == 0 )
{
ob_end_clean();
}
echo _("Creation of Modele 2");
echo _("Creation of Modele 2");
$cn->exec_sql("create database ".domaine."mod2 encoding='utf8'");
$cn=new Database(2,'mod');
$cn->exec_sql($sql_trigger_activate);
$cn->start();
if ( DEBUGNOALYSS == 0 ) { ob_start(); }
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/schema.sql');
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod2/data.sql');
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/constraint.sql');
$cn->commit();
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod1/schema.sql');
$cn->exec_sql("call public.trigger_activate(false) ");
$cn->execute_script(NOALYSS_INCLUDE.'/sql/mod2/data.sql');
$cn->commit();
$cn->exec_sql("call public.trigger_activate(true) ");
$cn->exec_sql("drop procedure public.trigger_activate");
if ( DEBUGNOALYSS == 0 ) ob_end_clean();
echo '<h1>'._('Important').'</h1>';
echo '<p>'._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'</p>';
@ -725,7 +767,7 @@ define ('ALLOWED_ADMIN',1);
$rep=new Database();
if (defined("NOALYSS_ADMINISTRATOR") && defined ("NOALYSS_ADMIN_PASSWORD"))
{
$rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5($2)
$rep->exec_sql("update public.ac_users set use_login=$1 ,use_pass=md5($2)
where use_id=1",
array(strtolower(NOALYSS_ADMINISTRATOR),
NOALYSS_ADMIN_PASSWORD));

View file

@ -19,9 +19,9 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!
* \file
* \brief javascript script for the ledger in accountancy,
/**
* @file
* javascript script for the ledger in accountancy,
* compute the sum, add a row at the table..
*
*/
@ -1731,7 +1731,56 @@ function duplicate_operation(p_dossier, p_jr_id) {
}
);
}
/**
* Go to detail of Tax for a specific period , ledger id and tva_id
*/
function tax_detail_view (dossier_id,date_from,date_to,nLedger_id,nTva_id)
{
try
{
var dgbox="detail_tax_box";
waiting_box();
removeDiv(dgbox);
// For form , most of the parameters are in the FORM
// method is then POST
//var queryString=$(p_form_id).serialize(true);
var queryString = {
op: 'tax_detail',
act: "tax_detail_view",
gDossier: dossier_id,
boxid: dgbox,
date_from:date_from,
date_to:date_to,
ledger_id:nLedger_id,
tva_id:nTva_id
};
var action = new Ajax.Request(
"ajax_misc.php" ,
{
method:'GET',
parameters:queryString,
onFailure:ajax_misc_failure,
onSuccess:function(req){
remove_waiting_box();
if (req.responseText == 'NOCONX') {
reconnect();
return;
}
var y=calcy(15);
var div_style="position:absolute;"+";top:"+y+"px";
add_div({id:dgbox,cssclass:'inner_box',html:loading(),style:div_style,drag:true});
$(dgbox).update(req.responseText);
}
}
);
}catch( e)
{
alert_box(e.message);
}
}
/**
* For operation_exercice let update periode when changing folder
* @type {{update_periode: operation_exercice.update_periode}}
@ -1959,7 +2008,7 @@ var operation_exercice = {
return;
}
var answer=req.responseJSON;
console.debug(answer['content']);
$('operation_exercice_transfer_info').update(answer.content);

View file

@ -16,6 +16,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Revision$ */
/**
* @file
* manage accounting
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**

View file

@ -18,8 +18,8 @@
/* $Revision$ */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*
/**
* @file
* This file permit to use the AJAX function to fill up
* info from fiche
*
@ -266,11 +266,17 @@ category_card.add_attribut=function (p_dossier,p_fiche_def_ref,p_object_name) {
onSuccess:function(req) {
var answer=req.responseText.evalJSON();
if ( answer.status == 'OK') {
var newli=document.createElement("li")
newli.setAttribute("id",p_object_name+"_elt"+selected_attr);
newli.innerHTML=answer.content
$(p_object_name+"_list").append(newli);
var newli = document.createElement("li")
$(p_object_name + "_list").append(newli);
newli.replace(answer.content);
document.getElementById('attribut_order').value = Sortable.serialize(p_object_name + "_list");
select.remove(select.selectedIndex);
Sortable.create(p_object_name + '_list', {
onUpdate: function () {
document.getElementById('attribut_order').value = Sortable.serialize(p_object_name + "_list")
}
});
} else {
smoke.alert(answer.message);
}

View file

@ -19,9 +19,10 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*! \file
* \brief This file show a little online calculator, in the caller
* the span id result, listing, the id form calc_line and the
/**
* @file
* This file show a little online calculator, in the caller the span id result,
* listing, the id form calc_line and the
*
*
*/

View file

@ -19,8 +19,9 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/** \file
* \brief javascript for searching a card
/**
* @file
* javascript for searching a card
*/
var card_layer=1;
@ -88,7 +89,7 @@ function search_card(obj)
var amount_from_type=0;
if ( obj.amount_from_type) {
amount_from_type=obj.amount_from_type;
}
if ( jrn==undefined)
{
@ -116,10 +117,10 @@ function search_card(obj)
if ( $('search_card') ) {
removeDiv('search_card');
}
waiting_box();
var action=new Ajax.Request ( 'ajax_misc.php',
{
@ -235,7 +236,7 @@ function action_concerned_list(p_obj) {
/**
* Display form for searching cards to add to action-follow-up
*@see ajax_add_concerned_card.php
*@param {object} obj form object
*@param {object} obj form object
*@param obj.elements.ag_id id of the action (elements)
*@param obj.elements.gDossier folder id
*@param obj.elements.query
@ -250,16 +251,16 @@ function action_concerned_search_card(obj)
var search_in=-1;
var inactive_card=0;
var search_cat=-1;
if (obj.dossier) {
dossier = obj.dossier; /* From the button */
}
}
if (obj.ag_id) {
ag_id=obj.ag_id;
}
/* from the form */
if (obj.elements) {
if (obj.elements['gDossier'])
if (obj.elements['gDossier'])
{
dossier = obj.elements['gDossier'].value;
}
@ -399,12 +400,12 @@ function search_get_card(obj)
{
queryString+="&ctl="+obj.ctl;
}
if ( obj.elements['accvis'] )
if ( obj.elements['accvis'] )
{
queryString+="&accvis="+$F('accvis');
} else {
queryString+="&accvis=0";
}
}
if ( obj.elements['amount_from_type']) {
queryString+="&amount_from_type="+obj.elements['amount_from_type'].value;
}
@ -417,7 +418,7 @@ function search_get_card(obj)
queryString=encodeURI(queryString);
$('asearch').innerHTML=loading();
var action=new Ajax.Request ( 'ajax_misc.php',
{
method:'get',
@ -435,7 +436,7 @@ function result_card_search(req)
{
try
{
remove_waiting_box();
if ( req.responseText == 'NOCONX') { reconnect();return;}
var answer=req.responseXML;
@ -451,7 +452,7 @@ function result_card_search(req)
var nodeXml=html[0];
var code_html=getNodeText(nodeXml);
code_html=unescape_xml(code_html);
var sx=0;
if ( window.scrollY)
{
@ -464,9 +465,9 @@ function result_card_search(req)
var div_style="top:"+sx+"px;min-height:80%;height:auto";
add_div({id:'search_card',cssclass:'inner_box',html:"",style:div_style,drag:false,effect:'blinddown'});
$('search_card').innerHTML=code_html;
if ($('query')) { $('query').focus();}
}
catch (e)
@ -714,7 +715,7 @@ function select_card_type(obj)
waiting_box();
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':"",'drag':false};
var queryString='gDossier='+dossier;
queryString+='&ctl='+content;
@ -753,10 +754,10 @@ function select_card_type(obj)
method:'get',
parameters:queryString,
onFailure:errorFid,
onSuccess:function(req) {
onSuccess:function(req) {
if (req.responseText=='NOCONX') { reconnect(); return;}
add_div(popup);
// Get all the category,
// Get all the category,
var answer=req.responseXML.getElementsByTagName("fiche_cat_item");
if (answer.length == 0) {
removeDiv(content);
@ -805,7 +806,7 @@ function dis_blank_card(obj)
var str_style="top:"+nTop+"px;right:"+nLeft+"px;height:auto;width:45rem;";
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':false};
add_div(popup);
if ( obj.gDossier.value != undefined ) {
@ -830,8 +831,8 @@ function dis_blank_card(obj)
parameters:queryString,
onFailure:errorFid,
onSuccess: function (req,json) {
successFill_ipopcard(req,json);
}
}
@ -847,7 +848,7 @@ function form_blank_card(obj)
var str_style="top:"+nTop+"px;left:"+nLeft+"px;width:60em;height:auto";
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':true};
if ( $(content)) {removeDiv(content);}
if ( $(content)) {removeDiv(content);}
add_div(popup);
@ -912,12 +913,12 @@ function save_card(obj)
if ( after_savetag.length !=0 ) {
after_save=getNodeText(after_savetag[0]);
}
// if status == OK and after_save == 0
// if status == OK and after_save == 0
// then update the box
if ( status_value == 'OK' && after_save == 0) {
fill_box(req,json);
}
// if status == OK and after_save == 1
// then add a row to the table
if ( status_value == 'OK' && after_save == 1) {
@ -933,10 +934,10 @@ function save_card(obj)
row.addClassName("odd");
} else {
row.addClassName("even");
}
}
remove_waiting_box();
if ( elt.length != 0) {
var eltid=getNodeText(elt[0]);
@ -948,15 +949,15 @@ function save_card(obj)
}
}
if (status_value == "OK") {
Effect.SlideUp(content, { duration: 1.0 });
Effect.SlideUp(content, { duration: 1.0 });
}
if ( status_value == 'NOK') {
var xml_message=req.responseXML.getElementsByTagName("code");
var message=getNodeText(xml_message[0]);
smoke.alert(message);
}
}
}
);
@ -1125,7 +1126,7 @@ function action_save_concerned(p_form_id) {
removeDiv('search_card');
$('concerned_card_td').innerHTML = code_html;
} catch (e) {
}
}
}
@ -1157,9 +1158,9 @@ function action_remove_concerned(p_dossier,p_fiche_id,p_action_id)
code_html = unescape_xml(code_html);
$('concerned_card_td').innerHTML = code_html;
removeDiv('search_card');
$(namectl).remove();
} catch (e) {
if ( console) { console.log('Erreur ') + e.message;}
alert_box('action_remove_concerned '+e.message);
@ -1170,8 +1171,8 @@ function action_remove_concerned(p_dossier,p_fiche_id,p_action_id)
}
/**
* Remove a card after checking it is not used
* @param object obj {gDossier,op,op2:rm_card,ctl,f_id}
*/
* @param obj {json} = gDossier,op,op2:rm_card,ctl,f_id
*/
function delete_card(obj) {
smoke.confirm("Confirmez ? ", function (e) {
if (e) {
@ -1194,7 +1195,7 @@ function delete_card(obj) {
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
if ( code_html == "OK") {
Effect.Fade(obj['ctl'], { duration: 1.5 });
Effect.Fade(obj['ctl'], { duration: 1.5 });
} else {
smoke.alert(code_html);
}
@ -1226,16 +1227,16 @@ function modify_card(p_fiche_id)
var popup = {'id': content, 'cssclass': 'inner_box', 'style': str_style, 'html': loading(), 'drag': false};
add_div(popup);
/* dossier id */
if ( ! document.getElementById("card_gdossier")) {
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
var dossier = $('card_gdossier').value;
var action = new Ajax.Request('ajax_misc.php',
{
method: 'get',
@ -1257,7 +1258,7 @@ function delete_card_id(p_fiche_id)
{
var row="row_card"+p_fiche_id;
if ( ! document.getElementById("card_gdossier")) {
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
@ -1284,29 +1285,29 @@ function delete_card_id(p_fiche_id)
var nodeXml = html[0];
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
if ((code_html) == "OK") {
Effect.Fade(row, {duration: 0.1});
table_card.tBodies[0].removeChild($(row));
alternate_row_color("fiche_tb_id");
} else {
smoke.alert(code_html);
}
}
});
} else{
} else{
$(row).removeClassName("background-selected");
}
});
}
/**
* update a card in ajax , and update a row
*
*
*/
function card_update_row(obj)
{
@ -1334,16 +1335,16 @@ function card_update_row(obj)
var name_ctl = "row_card" + obj.f_id.value;
var code_html = getNodeText(html[0]); // Firefox ne prend que les 4096 car.
code_html = unescape_xml(code_html);
if ( document.getElementById(name_ctl)) {
// update the row
$(name_ctl).innerHTML = code_html;
new Effect.Highlight(name_ctl ,{startcolor: '#FAD4D4',endcolor: '#F78082' });
}
$(a[0].firstChild.nodeValue).remove();
} catch (e) {
alert_box(e.message);
if (console) {
@ -1360,8 +1361,8 @@ function card_update_row(obj)
}
alert_box(content[53] + "\n" + e.message);
}
}
}
);
@ -1391,7 +1392,7 @@ function linked_card_option(p_action_person_id,p_dossier) {
remove_waiting_box();
add_div({ "id":"d_linked_card_option",cssclass:"inner_box",style:"position:fixed;top:30%;min-width:20rem;width:auto;",drag:0});
$("d_linked_card_option").update(req.responseText);
}
});
} catch (e) {
@ -1399,8 +1400,8 @@ function linked_card_option(p_action_person_id,p_dossier) {
}
}
/**
* Save option for the contact
* @param {object} obj form
* Save option for the contact
* @param {object} obj form
* @see card_multiple_display_option.php
* @returns {undefined}
*/
@ -1418,4 +1419,149 @@ function save_linked_card_option(obj)
}
});
return false;
}
}
/**
* @class
* Manage adding, removing and ordering attributs of a card template (FICHE_DEF), used in the module CCARD
* @param dossier_id {int} Folder
* @param fiche_def_id {int} SQL : FICHE_DEF.FD_ID
*/
var CategoryCardDefinition = function (dossier_id, fiche_def_id) {
this.dossier_id = dossier_id;
this.fiche_def_id = fiche_def_id;
this.available_list = 'avail_attribut_id';
this.existing_list = 'attribut_card';
this.op = 'category_card_definition';
}
/**
* save the order + new attributes, remove old ones
*/
CategoryCardDefinition.prototype.save = function () {
try {
var here = this;
var aAttribut=Sortable.serialize(this.existing_list);
var queryString = {
gDossier: this.dossier_id,
fiche_def_id: this.fiche_def_id,
op: this.op,
op2: 'save',
attribut:aAttribut
};
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'POST',
parameters: queryString,
onFailure: ajax_misc_failure,
onSuccess: function (req) {
if (req.responseText == 'NOCONX') {
reconnect();
return;
}
if ( req.responseText == 'OK') {
smoke.signal('Sauvé',function(e){},{duration:500});
}
}
}
);
} catch (e) {
alert_box("CategoryCardDefinition.save" + e.message);
}
};
/**
* add an attribut from the DOM Element avail_attribut_id , do add an element in attribut_card and remove from avail_attribut_id
* @param attribut_id {int} attr_def.ad_id , ad_id of attribute
*/
CategoryCardDefinition.prototype.add_attribut = function (attribut_id) {
try {
var here = this;
var queryString = {
gDossier: this.dossier_id,
fiche_def_id: this.fiche_def_id,
op: this.op,
op2: 'add',
ad_id: attribut_id
};
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'GET',
parameters: queryString,
onFailure: ajax_misc_failure,
onSuccess: function (req) {
if (req.responseText == 'NOCONX') {
reconnect();
return;
}
// if successfull add id on existing_list and remove from available_list
// remove from available_list
$('avail_attr_' + attribut_id).remove();
var parser = new DOMParser();
var element = parser.parseFromString(req.responseText, 'text/html');
$(here.existing_list).appendChild(element.body.firstChild);
new Effect.Highlight('existing_attr_' + attribut_id, {
startcolor: '#FAD4D4',
endcolor: '#F78082'
});
Sortable.create('attribut_card', {tag: 'li'});
alternate_row_color_list(here.available_list);
}
}
);
} catch (e) {
alert_box("CategoryCardDefinition.add_attribut" + e.message);
}
};
/**
* remove an attribut from the DOM Element attribut_card , do add an element in avail_attribut_id and remove from attribut_card
* @param attribut_id {int} attr_def.ad_id , ad_id of attribute
*/
CategoryCardDefinition.prototype.remove_attribut = function (attribut_id) {
var here = this;
try {
var queryString = {
gDossier: this.dossier_id,
fiche_def_id: this.fiche_def_id,
op: this.op,
op2: 'remove',
ad_id: attribut_id
};
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'GET',
parameters: queryString,
onFailure: ajax_misc_failure,
onSuccess: function (req) {
if (req.responseText == 'NOCONX') {
reconnect();
return;
}
// if successfull add id on existing_list and remove from available_list
// remove from available_list
$('existing_attr_' + attribut_id).remove();
var parser = new DOMParser();
var element = parser.parseFromString(req.responseText, 'text/html');
$(here.available_list).appendChild(element.body.firstChild);
alternate_row_color_list(here.available_list);
Sortable.create('attribut_card', {tag: 'li', hoverclass: inner_box});
}
}
);
} catch (e) {
alert_box("CategoryCardDefinition.remove_attribut" + e.message);
}
};

View file

@ -15,8 +15,9 @@
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*!\file
*\brief common function for "Ecriture directe"
/**
* @file
*common function for "Ecriture directe"
*/
/**
* Compute the sum of the debit and credit of the operation in the input screen for misceallenous operation
@ -112,4 +113,4 @@ function controleBalance()
smoke.alert(content[58]);
return false;
}
}
}

View file

@ -19,8 +19,9 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
* \brief javascript scripts for the gestion
/**
* @file
* javascript scripts for the gestion
*
*/
@ -28,8 +29,8 @@
/**
* remove an attached document of an action
*@param dossier
*@param dt_id id of the document (pk document:d_id)
*@param {int} dossier
*@param {int} dt_id id of the document (pk document:d_id)
*/
function remove_document(p_dossier,p_id)
{
@ -281,7 +282,7 @@ function action_show(p_dossier)
parameters : {gDossier:p_dossier,'op':'action_show'},
onSuccess : function(p_xml, p_text) {
remove_waiting_box();
add_div({id: 'action_list_div', style:"top:1%;width:90%;left:5%" , cssclass: 'inner_box'});
add_div({id: 'action_list_div', style:"position:fixed;top:1%;width:90%;left:5%" , cssclass: 'inner_box'});
$('action_list_div').innerHTML=p_xml.responseText;
var table_followup=document.getElementById('event_followup');
if ( table_followup) { sorttable.makeSortable(table_followup); }
@ -460,4 +461,4 @@ function delete_filter_followup(p_dossier,filter_id)
}
}
);
}
}

View file

@ -15,13 +15,14 @@
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*!\file
* \brief create the infobulle, the internalization is not yet implemented
* \code
/**
* @file
* create the infobulle, the internalization is not yet implemented
* @code
// Example
echo JS_INFOBULLE;
echo Icon_Action::infobulle(x);
\endcode
@endcode
*/
var posX=0,posY=0,offsetX=10,offsetY=10;

View file

@ -16,44 +16,16 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**
*@class ManageTable Javascript object to manage ajax calls to
* @class
* Javascript object to manage ajax calls to
* save , input or delete data row.
* The callback must
respond with a XML file , the tag status for the result
and data the HTML code to display
*@param {string} p_table_name the data table on which we're working
in javascript , to create an object to manipulate the table
version.
Example of code
@code
// Version will manage the table "version"
var version=new ManageTable("version");
// the file ajax_my.php will be called
version.set_callback("ajax_my.php");
// Add supplemental parameter to this file
version.param_add ({"plugin_code":"OIC"};
// Set the id of dialog box , table and tr prefix
version.set_control("dialbox1");
@endcode
The answer from ajax must be like this template
@verbatim
<xml>
<ctl> id of the control to update for diag.box, row </ctl>
<status> OK , FAIL ...</status>
<html> Html to display</html>
</xml>
@endverbatim
List of function
====================
- set_control(p_ctl_name)
- set_callback (p_new_callback)
- param_add (json object)
@ -61,12 +33,11 @@
- save
- delete
- input
How to call a function AFTER save ?
You set a function afterSaveFct like in the example, it will be trigger after you submit the FORM
a function named afterSaveFct(r) where r is the row in HTML to display, with a attribute ctl_pk_id which is the primary key and id of the row
Example :
@code
@example
document_attach_obj.afterSaveFct=function(e) {
var ctl_pk_id=e.getAttribute("ctl_pk_id");
var formData = new FormData();
@ -76,12 +47,8 @@
xhr.open("POST", "ajax.php?p_id="+ctl_pk_id+"&do=upload_document", true);
xhr.send(formData);
}
</script>
@endcode
As a hidden parameter the Manage_Table:object_name must be set
Example :
@code
// the object_name is tbl6030ee4ee519e , in the table each row (TR) has an attribute ctl_pk_id which is the id (primary key)
// <tr ctl_pk_id="" ...> </tr>
tbl6030ee4ee519e.afterSaveFct=function(p_param) {
@ -89,9 +56,35 @@
console.log(this)
console.log(p_param.getAttribute(ctl_pk_id))
}
@endcode
*/
/**
* @constructor
* @param {string} p_table_name the data table on which we're working
in javascript , to create an object to manipulate the table
version.
@example
// Version will manage the table "version"
var version=new ManageTable("version");
// the file ajax_my.php will be called
version.set_callback("ajax_my.php");
// Add supplemental parameter to this file
version.param_add ({"plugin_code":"OIC"};
// Set the id of dialog box , table and tr prefix
version.set_control("dialbox1");
//The answer from ajax must be like this template
<xml>
<ctl> id of the control to update for diag.box, row </ctl>
<status> OK , FAIL ...</status>
<html> Html to display</html>
</xml>
*/
var ManageTable = function (p_table_name)
{
this.callback = "ajax.php"; //!< File to call

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,10 @@
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @class
*
*/
var TagGroup = function ()
{
this.callback = "ajax_misc.php";
@ -67,4 +70,4 @@ var TagGroup = function ()
}
});
};
};
};

View file

@ -53,7 +53,7 @@ function todo_list_show(p_id)
todo_div.style.top = (posY + offsetY) + 'px';
todo_div.style.left = (posX + offsetX - 200) + 'px';
todo_div.style.left = (posX + offsetX + 20) + 'px';
var answer = req.responseXML;
var tl_id = answer.getElementsByTagName('tl_id');
@ -185,11 +185,11 @@ function zoom_todo ()
waiting_box();
if ( ! todo_maximize)
{
var clonetodo=$('todo_listg_div').clone();
var clonetodo=$('todo_list').clone();
clonetodo.setAttribute('id','clone_todo_list')
clonetodo.setStyle({'z-index':1,'position':'absolute','width':'95%','height':'95%','top':'2%','right':'2%','left':'2%'})
clonetodo.innerHTML=$('todo_listg_div').innerHTML;
$('todo_listg_div').innerHTML="";
clonetodo.setStyle({'z-index':1,'position':'fixed','width':'95%','height':'95%','top':'2%','right':'2%','left':'2%'})
clonetodo.innerHTML=$('todo_list').innerHTML;
$('todo_list').innerHTML="";
clonetodo.addClassName('inner_box');
clonetodo.removeClassName('box');
document.body.appendChild(clonetodo);
@ -197,7 +197,7 @@ function zoom_todo ()
} else
{
todo_maximize=false;
$('todo_listg_div').innerHTML=$('clone_todo_list').innerHTML;
$('todo_list').innerHTML=$('clone_todo_list').innerHTML;
$('clone_todo_list').remove();
}

View file

@ -23,7 +23,7 @@ if (!defined('ALLOWED')) { die('Appel direct ne sont pas permis'); }
/**
* @file
* @brief CFGCURRENCY Manage the currency and the rate
* @brief C0DEV Manage the currency and the rate
* @example test_currency_mtable.php
*/

View file

@ -76,7 +76,7 @@ if ( $action=="user_mgt" )
//----------------------------------------------------------------------
require_once NOALYSS_INCLUDE."/user.inc.php";
}
// action=user_mgt
if ( $action=="dossier_mgt")
{
//-----------------------------------------------------------------------

View file

@ -37,7 +37,7 @@ try {
echo $e->getMessage();
return;
}
if ( $g_user->check_module("CFGPCMN") == 0) die();
if ( $g_user->check_module("C0PCMN") == 0) die();
$obj=new Acc_Plan_SQL($cn);

View file

@ -0,0 +1,58 @@
<?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
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu 9/08/24
/*!
* \file
* \brief activate a javascript for a PROFILE , receive mecode (menu_ref.me_code) , prid , (profile.p_id)
* and activate(true/false)
*/
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
global $g_user;
if ($g_user->check_module('C0PLG') == 0) die();
try {
$me_code = $http->get("mecode");
$pr_id = $http->get("prid", "number");
$activate = $http->get("activate");
$depend = $http->get("dep",'string','EXT');
$order = $http->get("ord",'number',0);
} catch (\Exception $e) {
echo $e->getMessage();
}
$extension=new \Extension($cn,$me_code);
if ( $activate=='true') {
// if depend does not exist then message error
try {
$extension->depend=$depend;
$extension->order=$order;
$extension->insert_profile_menu($pr_id);
echo 'OK';
} catch (\Exception $e) {
echo $e->getMessage();
}
} elseif ($activate=='false') {
$extension->remove_from_profile_menu($pr_id);
echo 'OK';
}

View file

@ -37,7 +37,7 @@ if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
// Security
if ($g_user->check_module('CFGPRO')==0)
if ($g_user->check_module('C0PROFL')==0)
die();
$http=new HttpInput();

View file

@ -414,7 +414,7 @@ if ($op=='upgradePlugin')
$progress->set_value(55);
$plugin->install();
$progress->set_value(100);
echo _("L'extension doit être activée dans le dossier avec CFGPLUGIN");
echo _("L'extension doit être activée dans le dossier avec C0PLG");
return;
}
//------------------------------------------------------------------------------------------------------------------

View file

@ -26,6 +26,7 @@
*
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
global $g_user;
$sql="
select distinct vw.f_id,vw_name,vw_first_name,vw_description,fd_label,quick_code,tva_num,(select ad_value from fiche_Detail where f_id=pc.f_id and ad_id=5) as poste
from vw_fiche_attr as vw
@ -35,12 +36,13 @@ $sql="
ad_value ~* $1
order by 2
";
$preference=$g_user->get_preference();
$array=$cn->get_array($sql,array($_GET['card']));
echo HtmlInput::title_box(_("Résultat recherche"), "boxsearch_card_div");
$max=(count($array)>MAX_CARD_SEARCH)?MAX_CARD_SEARCH:count($array);
$max=(count($array)> $preference['PAGESIZE'])? $preference['PAGESIZE']:count($array);
?>
<?php if (count($array)>MAX_CARD_SEARCH ): ?>
<h2 class="notice"><?php printf (_("Résultat limité à %d , %d nombre de fiches trouvées"), MAX_CARD_SEARCH,count($array))?> </h2>
<?php if (count($array)>$preference['PAGESIZE'] ): ?>
<h2 class="notice"><?php printf (_("Résultat limité à %d dans vos préférences, %d fiches trouvées"), $preference['PAGESIZE'],count($array))?> </h2>
<?php endif?>
<?php echo _('Cherche')?> <?php echo Icon_Action::infobulle(26);echo HtmlInput::filter_table("tb_fiche", "0,1,2,3,4,5", 1); ?> :

View file

@ -23,7 +23,7 @@
*/
if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
$http=new HttpInput();
$distype=$http->request('distype');
ob_start();
if ($notitle==0)
{

View file

@ -530,9 +530,11 @@ case 'fs':
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
$price,$amount);
}
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
$tvaid,$aFound[$i]['tva_id']);
$array[$i]['javascript'].="removeDiv('search_card');";
// if there is no TVA_ID in the view, it is possible we have a TVA_CODE
$tva_code=(empty($aFound[$i]['tva_id']))?$aFound[$i]['tva_code']:$aFound[$i]['tva_id'];
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
$tvaid,$tva_code);
$array[$i]['javascript'].="removeDiv('search_card');";
}//foreach

View file

@ -0,0 +1,77 @@
<?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
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu 7/08/24
/*!
* \file
* \brief ajax from CCARD : add , remove or sort attributes from CCARD
*/
if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
global $g_user;
if ($g_user->check_module('CCARD') == 0) return;
$http = new HttpInput();
try {
$fiche_def = $http->request('fiche_def_id', 'number');
$op2 = $http->request("op2");
} catch (\Exception $e) {
echo $e->getMessage();
return;
}
global $cn;
if ($op2 == 'add') {
$ad_id=$http->get("ad_id","number");
$row = $cn->get_row('select ad_id , ad_text from attr_def where ad_id=$1',[$ad_id]);
Fiche_Def::print_existing_attribut($row['ad_id'], $row['ad_text']);
} elseif ($op2 == 'remove') {
$ad_id=$http->get("ad_id","number");
$row = $cn->get_row('select ad_id , ad_text from attr_def where ad_id=$1',[$ad_id]);
Fiche_Def::print_available_attribut($row['ad_id'], $row['ad_text'],'');
} elseif ($op2 == 'save') {
$str_Attribut=$http->post("attribut");
parse_str($str_Attribut, $row);
$aAttribut=$row['attribut_card'];
$nb_attribut=count($aAttribut);
try {
$cn->start();
$cn->exec_sql("create temporary table xxattribut (x_order int, x_adid int, x_fdid int)");
$order = 10;
for( $i = 0;$i < $nb_attribut;$i++) {
$o=$order*($i+1);
$cn->exec_sql("insert into xxattribut values ($1,$2,$3)",[$o,$aAttribut[$i],$fiche_def]);
}
$cn->exec_sql("delete from jnt_fic_attr where fd_id=$1 and ad_id not in (select x_adid from xxattribut)",[$fiche_def]);
$cn->exec_sql("insert into jnt_fic_attr(ad_id,fd_id,jnt_order)
select x_adid,x_fdid,x_order
from xxattribut
on conflict do nothing ");
$cn->exec_sql('update jnt_fic_attr set jnt_order = x_order from xxattribut where ad_id=x_adid and fd_id=x_fdid');
$cn->commit();
echo 'OK';
} catch (\Exception $e) {
echo $e->getMessage();
$cn->rollback();
}
} else {
die("[$op2] action inconnue");
}

View file

@ -91,6 +91,7 @@ EOF;
} else {
$obj->status = 'NOK';
$obj->html=_('non valide');
}
echo json_response($obj);

View file

@ -45,9 +45,9 @@ catch (Exception $ex)
/* security check */
/**
* check if module CFGCURRENCY
* check if module C0DEV
*/
if ($g_user->check_module('CFGCURRENCY')==0)
if ($g_user->check_module('C0DEV')==0)
{
return;
}

View file

@ -21,7 +21,7 @@
/**
* @file
* @brief call from ajax : display submenu
* Security : only user with the menu CFGPRO
* Security : only user with the menu C0PROFL
* display the submenu of a menu or a module
* It expects 2 parameters = p_profile (profile.p_id) and the dep (menu_ref.me_code)
*/
@ -29,7 +29,7 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
// Security
if ( $g_user->check_module('CFGPRO') == 0 ) die();
if ( $g_user->check_module('C0PROFL') == 0 ) die();
$http=new HttpInput();

View file

@ -23,8 +23,8 @@ if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
global $g_user;
if ( $g_user->check_module('CFGDOCST') == 0 ) {
record_log("forbidden : CFGDOCST ".__FILE__);
if ( $g_user->check_module('C1DOC') == 0 ) {
record_log("forbidden : C1DOC ".__FILE__);
exit();
}

View file

@ -28,19 +28,11 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
global $g_user;
$g_user->can_request(FICCAT,0);
if ( $g_user->check_action(FICCAT) == 0 && $g_user->check_module("CCARD") == 0 )
return;
$http=new HttpInput();
$id=$http->get("id","number");
$fd=new Fiche_Def($cn,$id);
if ( $id > 0 )
{
echo $fd->input_detail();
echo HtmlInput::button("retour_b", _("Retour à la liste"), "onclick=\"$('detail_category_div').hide();$('list_cat_div').show()\"");
}
else
{
$fd->input_new();
}
$fd->input_new();
?>

View file

@ -73,9 +73,16 @@ if ($array[0]['p_type_display']!='P'):
</tr>
<?php endif;?>
</table>
<ul class="aligned-block">
<li>
<?php
echo HtmlInput::submit('modbt',_("Valider"));
echo '</form>';
?>
</li>
<li>
<?=HtmlInput::button_close('divdm'.$pm_id);?>
</li>
</ul>
</form>

View file

@ -29,7 +29,7 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
// Security
if ( $g_user->check_module('CFGPRO') == 0 ) die();
if ( $g_user->check_module('C0PROFL') == 0 ) die();
require_once NOALYSS_INCLUDE.'/database/profile_sql.class.php';
$http=new HttpInput();

View file

@ -384,8 +384,10 @@ switch ($action) {
}
$cn->exec_sql("update jrn set jr_comment=$1,jr_pj_number=$2,jr_date=to_date($4,'DD.MM.YYYY'),jr_optype=$5 where jr_id=$3",
array($http->post('lib'), $npj, $jr_id,$date, $http->post('jr_optype')));
$cn->exec_sql("update jrnx set j_date=to_date($1,'DD.MM.YYYY') where j_grpt in (select jr_grpt_id from jrn where jr_id=$2)",
array($date, $jr_id));
$find_periode = $cn->get_value("select comptaproc.find_periode($1)",[$date]);
$cn->exec_sql("update jrnx set j_date=to_date($1,'DD.MM.YYYY'),j_tech_per=$3 where j_grpt in (select jr_grpt_id from jrn where jr_id=$2)",
array($date, $jr_id,$find_periode));
$cn->exec_sql('update operation_analytique set oa_date=j_date from jrnx
where
operation_analytique.j_id=jrnx.j_id and

View file

@ -36,7 +36,7 @@ if (isset($_REQUEST['gDossier']) && $http->request("gDossier","number",0) != 0 )
$g_user->load_global_pref();
$msg = "";
$cn =Dossier::connect();
$g_user->cn = $cn;
$g_user->db = $cn;
$inside_dossier = true;
$local_pref=$g_user->get_preference();
}
@ -257,23 +257,6 @@ if ( $action == 'display_form' )
</fieldset>
<?php
if ($inside_dossier)
{
/* Pref for welcome page */
echo '<fieldset style="margin: 1%">';
echo '<legend>' . _('Options pour la page d\'accueil') . '</legend>';
echo _('Mini-Rapport : ');
$rapport = new Acc_Report($cn);
$aRapport = $rapport->make_array();
$aRapport[] = array("value" => 0, "label" => _('Aucun mini rapport'));
$wRapport = new ISelect();
$wRapport->name = "minirap";
$wRapport->selected = $g_user->get_mini_report();
$wRapport->value = $aRapport;
echo $wRapport->input();
echo '<span class="notice">' . _('Le mini rapport est un rapport qui s\'affiche sur votre page d\'accueil') . '</span>';
echo '</fieldset>';
}
echo '<fieldset style="margin: 1%">';
echo '<legend>' . _('Langue') . '</legend>';
@ -351,10 +334,8 @@ if ($action == 'save')
}
if ( $inside_dossier)
{
$minirap=$http->post("minirap","number","0");
$period=$http->post("period","number");
$g_user->set_periode($period);
$g_user->set_mini_report($minirap);
}
$g_user->save_global_preference('THEME', $style_user);
$g_user->save_global_preference('LANG', $lang);

View file

@ -28,7 +28,7 @@ if ( ! defined ('ALLOWED') ) die(_('Non autorisé'));
$http=new HttpInput();
// Security
if ($g_user->check_module('CFGPRO')==0)
if ($g_user->check_module('C0PROFL')==0)
die();
try
{

View file

@ -61,7 +61,9 @@ if ($op=='save_filter')
$new->setp("operation_filter", $http->post("operation_filter", 'string', NULL));
$new->setp("filter_name", h($http->post("filter_name", 'string')));
$new->setp("uf_currency_code", h($http->post("p_currency_code", 'number',-1)));
$new->setp("tva_id_search", h($http->post("tva_id_search", 'string',null)));
$acc_tva=Acc_Tva::build($cn, $http->post("tva_id_search", 'string',-1));
$tva_id=($acc_tva->tva_id===-1)?null:$acc_tva->tva_id;
$new->setp("tva_id_search",$tva_id);
$tag=$http->post("tag","string",'');
if (is_array($tag) )

View file

@ -22,7 +22,7 @@
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
if ( $g_user->check_module('CFGTAG') == 0 ) {
if ( $g_user->check_module('C0TAG') == 0 ) {
record_log("forbidden : AJT01 ".__FILE__);
exit();
}

View file

@ -12,7 +12,7 @@ $op=$http->request("op");
global $g_user;
$nDossier=Dossier::id();
///check security
if ( $g_user->check_module('CFGTAG')==0 && $g_user->check_action(TAGADD) == 0)
if ( $g_user->check_module('C0TAG')==0 && $g_user->check_action(TAGADD) == 0)
{
die(_("non permis"));
}

View file

@ -28,7 +28,7 @@ if (!defined('ALLOWED'))
* @brief
*/
global $g_user;
$g_user->can_request('CFGTAG');
$g_user->can_request('C0TAG');
/*
* Received parameter

View file

@ -0,0 +1,60 @@
<?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
*/
// Copyright Author Dany De Bontridder danydb@noalyss.eu 28/07/24
/*!
* \file
* \brief manage Tax_Detail
*/
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
$http=new HttpInput();
try {
$tax_detail=new Tax_Detail(
$http->get('tva_id')
,$http->get("date_from",'date')
,$http->get("date_to",'date')
,$http->get("ledger_id",'number')
);
$boxid=$http->get("boxid");
} catch (\Exception $e) {
echo $e->getMessage();
return;
}
echo \HtmlInput::title_box("Détail TVA", $boxid);
?>
<div>
<p class="text-muted">
Il peut y avoir des différences entre la TVA calculée et à récupérer à cause de TVA Non Déductible, reprise
à charge du gérant ou d'arrondi.
</p>
<?php
$tax_detail->html();
?>
</div>
<ul class="aligned-block">
<li>
<?=\HtmlInput::button_close($boxid)?>
</li>
<li>
<?=$tax_detail->button_export_csv()?>
</li>
</ul>

View file

@ -68,9 +68,13 @@ switch ($action)
$answer['message']="";
$js=sprintf("category_card.remove_attribut('%s','%s','%s',%d)",
Dossier::id(), $frd_id, $objname, $ad_id);
$answer['content']=$cn->get_value("select ad_text from attr_def where ad_id=$1",
[$ad_id]).
Icon_Action::trash(uniqid(), $js);
$label=$cn->get_value("select ad_text from attr_def where ad_id=$1",
[$ad_id]);
$content=sprintf('<li id="%s_elt%d" style="cursor:move;border:1px solid navy;padding : 0.5rem 0.2rem 0.5rem 0.2rem;margin-top:2px">%s', $objname
,$ad_id,$label);
$content.=Icon_Action::trash(uniqid(), $js);
$content.='</li>';
$answer['content']=$content;
}
catch (Exception $exc)
{

View file

@ -28,7 +28,7 @@ if (!defined('ALLOWED'))
* @param type $name Descriptionara
*/
if ( $g_user->check_module('CFGTVA') ==0 )
if ( $g_user->check_module('C0TVA') ==0 )
{
return;
}

View file

@ -26,11 +26,11 @@ if (!defined('ALLOWED'))
/**
* @file
* @brief Manage the security of a ledger , from CFGSEC module
* @brief Manage the security of a ledger , from C0SEC module
*
*/
global $g_user;
if ( $g_user->check_module("CFGSEC") == 0)
if ( $g_user->check_module("C0SEC") == 0)
throw new Exception(_("Non autorisé"));
$n_dossier_id=Dossier::id();

View file

@ -439,12 +439,12 @@ if ( isset($_GET['view'] ) )
echo td($view_history);
// label + warning if the saldo is incorrect
$label=$r['label'];
if (in_array($r['type'],array('CHA','ACT','PASINV','PROINV')) && $r['sum_deb']<$r['sum_cred'])
if (isset ($r['type']) && in_array($r['type'],array('CHA','ACT','PASINV','PROINV')) && $r['sum_deb']<$r['sum_cred'])
{
$label.=" ".Icon_Action::warnbulle(85);
}
if (in_array($r['type'],array('PRO','PAS','ACTINV','CHAINV')) && $r['sum_deb']>$r['sum_cred'])
if (isset ($r['type']) && in_array($r['type'],array('PRO','PAS','ACTINV','CHAINV')) && $r['sum_deb']>$r['sum_cred'])
{
$label.=" ".Icon_Action::warnbulle(86);

View file

@ -28,43 +28,6 @@ global $http;
$retour=HtmlInput::button_anchor("Retour à la liste", HtmlInput::get_to_string(array("gDossier","ac")));
$action=$http->post('action',"string", '');
/*******************************************************************************************/
// Add an attribut
/*******************************************************************************************/
if ( $action == 'add_line')
{
$fd_id=$http->request("fd_id","number");
$ad_id=$http->request("ad_id","number");
$fiche_def=new Fiche_Def($cn,$fd_id);
$fiche_def->InsertAttribut($ad_id);
echo $fiche_def->input_detail();
echo $retour;
return;
}
/*******************************************************************************************/
// Remove an attribut
/*******************************************************************************************/
if ( $action == 'remove_line' )
{
$fd_id=$http->request("fd_id","number");
$fiche_def=new Fiche_Def($cn,$fd_id);
try
{
$ck_remove=$http->request('chk_remove');
$fiche_def->RemoveAttribut($ck_remove);
}
catch (Exception $exc)
{
throw new Exception(_("Vous devez choisir au moins une ligne"));
}
finally
{
echo $fiche_def->input_detail();
echo $retour;
return;
}
}
/*******************************************************************************************/
// Try to remove a category
/*******************************************************************************************/
if ( $action == 'remove_cat' )
@ -82,45 +45,35 @@ if ( $action == 'remove_cat' )
'Les fiches non utilisées ont cependant été effacées'));
}
}
$fiche_def=new Fiche_def($cn);
$fiche_def->display();
return;
}
/*******************************************************************************************/
// Change some basis info
/*******************************************************************************************/
if ( isset ($_POST['change_name']))
{
if (isset ($_REQUEST['label']) )
{
$fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']);
$label=$http->request("label");
$fiche_def->SaveLabel($label);
if ( isset($_REQUEST['create']))
{
$fiche_def->set_autocreate(true);
}
else
{
$fiche_def->set_autocreate(false);
}
$fiche_def->save_class_base($http->request('class_base'));
$fiche_def->save_description($http->request('fd_description'));
$fiche_def=new Fiche_Def($cn,$http->request('fd_id','number'));
$label=$http->request("nom_mod");
$fiche_def->SaveLabel($label);
if ( isset($_REQUEST['create']))
{
$fiche_def->set_autocreate(true);
}
else
{
$fiche_def->set_autocreate(false);
}
$fiche_def->save_class_base($http->request('class_base'));
$fiche_def->save_description($http->request('fd_description'));
echo $fiche_def->input_detail();
echo $retour;
return;
}
/*******************************************************************************************/
// Save order of the attributes
/*******************************************************************************************/
if ( $action == 'save_line' )
{
$fd_id=$http->request("fd_id","number");
$fiche_def=new Fiche_Def($cn,$fd_id);
$fiche_def->save_order($_POST);
echo $fiche_def->input_detail();
echo $retour;
return;
}
/*******************************************************************************************/
// Save a new category of card
/*******************************************************************************************/
@ -152,8 +105,15 @@ if ( isset($_POST['add_modele']))
alert(_('Doublon'));
}
}
$fiche_def_id=$http->request("fd","number",0);
$fiche_def=new Fiche_def($cn);
if ( $fiche_def_id != 0 ){
$fiche_def->id=$fiche_def_id;
$fiche_def->load();
echo $fiche_def->input_detail();
} elseif ($fiche_def_id == 0)
{
$fiche_def->display();
$fiche_def->display();
$dossier=Dossier::id();
}
?>

View file

@ -26,7 +26,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
*/
global $cn;
global $http;
$dossier_id=Dossier::id();
/******************************************************************************
* Scan the plugin folder and file in each subfolder a property file and
* store them into an array a_plugin
@ -44,6 +44,13 @@ for ($e=0;$e<$nb_dirscan;$e++) {
for ($i=0;$i<count($extension);$i++)
{
$a_plugin[]=clone $extension[$i];
try {
$extension[$i]->save_plugin();
} catch (\Exception $e) {
echo_warning($e->getMessage());
}
}
}
@ -56,47 +63,7 @@ $nb_plugin=count($a_plugin);
*/
$a_profile=$cn->get_array('select p_id,p_name from profile where p_id > 0 order by p_name');
$nb_profile=count($a_profile);
/******************************************************************************
* save
******************************************************************************/
if ( isset ($_POST['save_plugin'])){
// retrieve array of plugin
$plugin=$http->post('plugin', "string",array());
// for each extension
for ($i=0;$i<$nb_plugin;$i++) {
$code=$a_plugin[$i]->me_code;
// for each profile
for ($e=0;$e<$nb_profile;$e++)
{
$profile=$a_profile[$e]['p_id'];
if ( isset ($plugin[$code][$profile])) {
// insert or update into db
$count = $cn->get_value("select count(*) from menu_ref where me_code=$1", array($code));
if ( $count == 0 ) {
$a_plugin[$i]->insert();
}
try
{
$a_plugin[$i]->insert_profile_menu($profile);
}
catch (Exception $exc)
{
record_log($exc->getMessage()." trace:".$exc->getTraceAsString());
$profile_name=$cn->get_value('select profile.p_name from profile where p_id=$1'
,array($profile));
echo '<p class="notice">';
echo "code $code"," profile $profile_name ",$exc->getMessage();
echo '</p>';
}
} else {
// delete
$a_plugin[$i]->remove_from_profile_menu ($profile);
}
}
}
}
/******************************************************************************
* Display the Plugin and for each profile were it is installed or not
******************************************************************************/
@ -105,7 +72,7 @@ if ( isset ($_POST['save_plugin'])){
?>
<div class="content">
<?php echo _('Nombre de plugins trouvés')." ".$nb_plugin; ?>
<form method="post">
<?php echo _('Filtre');echo " ";echo HtmlInput::filter_table("plugin_install_tb", '0,1,2,3', 1);?>
<table id="plugin_install_tb" class="result">
<tr>
@ -153,9 +120,18 @@ if ( isset ($_POST['save_plugin'])){
<span style="display:block">
<?php
$a=new ICheckBox('plugin['.$a_plugin[$e]->me_code.']['.$a_profile[$w]['p_id'].']');
if ($a_profile[$w]['cnt']>0) $a->selected=true;
echo $a->input();
// $a=new ICheckBox('plugin['.$a_plugin[$e]->me_code.']['.$a_profile[$w]['p_id'].']');
$name=uniqid($a_plugin[$e]->me_code);
$ckpl=new ICheckBox($name);
$ckpl->set_attribute("gDossier", $dossier_id);
$ckpl->set_attribute("me_code", $a_plugin[$e]->me_code);
$ckpl->set_attribute("pr_id", $a_profile[$w]['p_id']);
$ckpl->set_attribute("dep", $a_plugin[$e]->depend);
$ckpl->set_attribute("order", $a_plugin[$e]->order);
$ckpl->javascript=' onchange="activate_plugin(this)"';
if ($a_profile[$w]['cnt']>0) $ckpl->selected=true;
echo $ckpl->input();
echo $a_profile[$w]['p_name'];
?>
</span>
@ -167,7 +143,6 @@ if ( isset ($_POST['save_plugin'])){
<?php endfor; ?>
</table>
<?php echo HtmlInput::submit('save_plugin', _('Valider')); ?>
</form>
</div>

View file

@ -51,7 +51,7 @@
*/
#[AllowDynamicProperties]
class Acc_Compute
{
private static $variable=array( 'amount'=>'amount',
@ -78,6 +78,8 @@ class Acc_Compute
var $check; // activate the check of the
// order, valid value are
// false or true
function __construct ()
{
bcscale(4);

View file

@ -157,7 +157,7 @@ class Acc_Currency
and currency_id=$2";
$value=$this->cn->get_value($sql,[$p_date,$this->get_id()]);
if ($value == "") {
throw new Exception(_("Aucun taux à cette date , aller sur CFGCURRENCY"));
throw new Exception(_("Aucun taux à cette date , aller sur C0DEV"));
}
return $value;
}

View file

@ -223,6 +223,7 @@ class Acc_Ledger extends jrn_def_sql
function reverse($p_date,$p_label)
{
global $g_user;
global $g_parameter;
try
{
$this->db->start();
@ -282,6 +283,8 @@ class Acc_Ledger extends jrn_def_sql
//////////////////////////////////////////////////
$a_jid=$this->db->get_array("select j_id,j_debit from jrnx where j_grpt=$1",
array($this->jr_grpt_id));
$anc_group_id=0;
// for each item in JRNX
for ($l=0; $l<count($a_jid); $l++)
{
// jrnx.j_id to reverse
@ -350,9 +353,40 @@ class Acc_Ledger extends jrn_def_sql
select $j_id,pcm_val,ac_id from jrn_tax where j_id=$1 returning jt_id",
[$row]);
// if we use analytic , extourne also in operation_analytic
if ($g_parameter->MY_ANALYTIC != 'nu') {
// if there is the first operation_analytic to insert , compute the group_id (operation_analytic.oa_group)
if ($anc_group_id == 0 ) $anc_group_id=$this->db->get_next_seq('s_oa_group');
$this->db->exec_sql("
insert into operation_analytique (po_id,oa_amount
,oa_description
,oa_debit
,j_id
, oa_date
, oa_row
, oa_positive
, f_id
,oa_jrnx_id_source
,oa_group)
select po_id
,oa_amount
,oa_description
,case oa_debit when true then false else true end
, $j_id
, to_date($2,'DD.MM.YYYY')
, oa_row
, oa_positive
, f_id
,oa_jrnx_id_source
,$anc_group_id from operation_analytique
where
j_id=$1
",[$row, $p_date]);
}
}
} // end for each item in JRNX
$old_receipt=$this->db->get_row("select jr_pj_number,jr_def_id from jrn where jr_id=$1",[$this->jr_id]);
$sql="insert into jrn (
jr_id,
@ -405,7 +439,7 @@ class Acc_Ledger extends jrn_def_sql
// Add a "concerned operation to bound these op.together
//
$rec=new Acc_Reconciliation($this->db);
$rec=new Acc_Reconciliation($this->db);
$rec->set_jr_id($seq);
$rec->insert($this->jr_id);
@ -415,17 +449,19 @@ class Acc_Ledger extends jrn_def_sql
throw (new Exception(__FILE__.__LINE__."SQL ERROR [ $sql ]"));
}
// the table stock must updated
// also in the stock table
$sql="delete from stock_goods where sg_id = any ( select sg_id
from stock_goods natural join jrnx where j_grpt=".$this->jr_grpt_id.")";
$Res=$this->db->exec_sql($sql);
from stock_goods natural join jrnx where j_grpt=$1)";
$Res=$this->db->exec_sql($sql,array($this->jr_grpt_id));
if ($Res==false)
{
throw (new Exception(__FILE__.__LINE__."SQL ERROR [ $sql ]"));
}
/**
* reverse also in analytic account;
*/
$this->db->commit();
}
catch (Exception $e)
@ -544,7 +580,7 @@ class Acc_Ledger extends jrn_def_sql
* @brief Show a select list of the ledgers you can access in
* writing, reading or simply accessing.
* @param $p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS)
* @param $p_access =3 for READ and WRITE, 2 for write and 1 for readonly
* @param $p_access =3 for READ or WRITE, 2 for write and 1 for readonly
* @param Boolean TRUE all ledger are selected, or FALSE only enable
* \return object HtmlInput select
*
@ -1259,7 +1295,11 @@ class Acc_Ledger extends jrn_def_sql
if (isset(${'qc_'.$i})&&trim(${'qc_'.$i})!="")
{
$f=new Fiche($this->db);
$f->get_by_qcode(${'qc_'.$i});
$f->quick_code=${'qc_'.$i};
if ($f->get_f_enable() == '0')
throw new Exception(sprintf(_("La fiche %s n'est plus utilisée"),${'qc_'.$i}), 50);
if ($f->belong_ledger($p_jrn) < 1 )
throw new Exception("La fiche quick_code = ".
$f->quick_code." n'est pas dans ce journal", 4);
@ -2874,7 +2914,7 @@ class Acc_Ledger extends jrn_def_sql
}
/**
* display screen to enter a new ledger
* @brief display FORM to enter parameters to create a new ledger.
*/
function input_new()
{
@ -2987,7 +3027,7 @@ class Acc_Ledger extends jrn_def_sql
Array
(
[gDossier] => 25
[ac] => CFG/MACC/CFGLED
[ac] => CFG/MACC/C0JRN
[p_jrn] => -1
[p_action] => jrn
[sa] => add
@ -3118,9 +3158,11 @@ class Acc_Ledger extends jrn_def_sql
default:
throw new Exception('Ledger_type invalid : '.$p_ledger_type);
}
if ( ! in_array($sql_op ,array('>','<','=','>=','<='))) {
throw new \Exception ("AC3162 : invalid \$sql_op = [$sql_op]");
}
$sql="select jr_id, jr_internal, jr_date, jr_comment,jr_pj_number,jr_montant
$sql="select jr_id, jr_internal, jr_date, jr_comment,jr_pj_number,jr_montant,jr_ech
from jrn
join jrn_def on (jrn_def_id=jr_def_id)
where
@ -3128,6 +3170,7 @@ class Acc_Ledger extends jrn_def_sql
and jr_ech $sql_op to_date($1,'DD.MM.YYYY')
and coalesce (jr_rapt,'xx') <> 'paid'
and $filter
order by jr_date
";
$array=$this->db->get_array($sql, array($p_date));
return $array;

View file

@ -133,6 +133,11 @@ class Acc_Ledger_Fin extends Acc_Ledger
{
if (noalyss_strlentrim(${'e_other'.$i})==0)
continue;
/* check if all card has a ATTR_DEF_ACCOUNT */
$fiche=new Fiche($this->db);
$fiche->get_by_qcode(${'e_other'.$i});
if ($fiche->get_f_enable() == '0')
throw new Exception(sprintf(_("La fiche %s n'est plus utilisée"),${'e_other'.$i}), 50);
/* check if amount are numeric and */
if (isNumber(${'e_other'.$i.'_amount'})==0)
throw new Exception('La fiche '.${'e_other'.$i}.'a un montant invalide ['.${'e_other'.$i.'_amount'}.']',
@ -140,9 +145,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
/* compute the total */
$tot_amount+=round(${'e_other'.$i.'_amount'}, 2);
/* check if all card has a ATTR_DEF_ACCOUNT */
$fiche=new Fiche($this->db);
$fiche->get_by_qcode(${'e_other'.$i});
if ($fiche->empty_attribute(ATTR_DEF_ACCOUNT)==true)
throw new Exception('La fiche '.${'e_other'.$i}.'n\'a pas de poste comptable', 8);
@ -325,7 +328,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
if ($this->bank_id=="")
{
echo h2("Journal de banque non configuré ".$this->get_name(), ' class="error"');
echo '<span class="error"> vous devez donner à ce journal un compte en banque (fiche), modifiez dans CFGLED</span>';
echo '<span class="error"> vous devez donner à ce journal un compte en banque (fiche), modifiez dans C0JRN</span>';
alert("Journal de banque non configuré ".$this->get_name());
}

View file

@ -111,10 +111,14 @@ class Acc_Ledger_Purchase extends Acc_Ledger
/* check the account */
$fiche=new Fiche($this->db);
$fiche->get_by_qcode($e_client);
if ($fiche->get_f_enable() == '0')
throw new Exception(sprintf(_("La fiche %s n'est plus utilisée"),$e_client), 50);
if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ').$e_client._('n\'a pas de poste comptable'),8);
/* get the account and explode if necessary */
$sposte=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
// if 2 accounts, take only the credit one for supplier
@ -158,6 +162,13 @@ class Acc_Ledger_Purchase extends Acc_Ledger
for ($i=0;$i< $nb_item;$i++)
{
if ( noalyss_strlentrim(${'e_march'.$i})== 0) continue;
/* check if all card has a ATTR_DEF_ACCOUNT*/
$fiche=new Fiche($this->db);
$fiche->get_by_qcode(${'e_march'.$i});
if ($fiche->get_f_enable() == '0')
throw new Exception(sprintf(_("La fiche %s n'est plus utilisée"), ${'e_march' . $i}), 50);
/* check if amount are numeric and */
if ( isNumber(${'e_march'.$i.'_price'}) == 0 )
throw new Exception(_('La fiche ').${'e_march'.$i}._('a un montant invalide').' ['.${'e_march'.$i}.']',6);
@ -167,26 +178,21 @@ class Acc_Ledger_Purchase extends Acc_Ledger
// Check if the given tva id is valid
if ( $g_parameter->MY_TVA_USE=='Y')
{
if ( empty(${'e_march'.$i.'_tva_id'}) )
$tva_rate = Acc_Tva::build($this->db,${'e_march' . $i . '_tva_id'});
if ($tva_rate->tva_id == -1)
throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13);
$tva_rate=new Acc_Tva($this->db);
$tva_rate->set_parameter('id',${'e_march'.$i.'_tva_id'});
$tva_rate->load();
/*
* check if the accounting for VAT are valid
*/
$a_poste=explode(',',$tva_rate->tva_poste);
if ( $tva_rate->load() != 0 )
throw new Exception(_('La fiche ').${'e_march'.$i}._('a un code tva invalide').' ['.${'e_march'.$i.'_tva_id'}.']',13);
/*
* check if the accounting for VAT are valid
*/
$a_poste=explode(',',$tva_rate->tva_poste);
if (
$this->db->get_value('select count(*) from tmp_pcmn where pcm_val=$1',array($a_poste[0])) == 0 )
throw new Exception(_(" La TVA ".$tva_rate->tva_label." utilise des postes comptables inexistants"));
if (
$this->db->get_value('select count(*) from tmp_pcmn where pcm_val=$1',array($a_poste[0])) == 0 )
throw new Exception(_(" La TVA ".$tva_rate->tva_label." utilise des postes comptables inexistants"));
}
/* check if all card has a ATTR_DEF_ACCOUNT*/
$fiche=new Fiche($this->db);
$fiche->get_by_qcode(${'e_march'.$i});
if ( $fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ').${'e_march'.$i}._('n\'a pas de poste comptable'),8);
@ -317,7 +323,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}
/**
* Insert into JRNX the No Deductible amount and into Analytic Accountancy for the ND VAT
* @brief Insert into JRNX the No Deductible amount and into Analytic Accountancy for the ND VAT
* @param Acc_Compute $p_nd_amount content ND amount
* @param Fiche $p_fiche Card of the Service
* @param type $p_tva_both 0 if TVA is normal or 1 if on both side
@ -571,8 +577,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
{
$idx_tva=trim(${'e_march'.$i.'_tva_id'});
\Noalyss\Dbg::echo_var(1," idx_tva [$idx_tva]",);
$oTva=new Acc_Tva($this->db);
$oTva->set_parameter('id',$idx_tva);
$oTva=Acc_Tva::build($this->db,$idx_tva);
$oTva->load();
$tva_both=$oTva->get_parameter("both_side");
}
@ -846,8 +852,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
*/
foreach ($tva as $i => $value)
{
$oTva=new Acc_Tva($this->db);
$oTva->set_parameter('id',$i);
$oTva=Acc_Tva::build($this->db,$i);
$oTva->load();
$poste_vat=$oTva->get_side('d');
@ -1370,7 +1375,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$W1->label="";
$W1->name="e_march".$i;
$W1->value=$march;
$W1->table=1;
$W1->table=0;
$W1->set_dblclick("fill_ipopcard(this);");
$W1->set_attribute('ipopup','ipopcard');
@ -1675,8 +1680,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
if ( $g_parameter->MY_TVA_USE=='Y')
{
$idx_tva=${"e_march".$i."_tva_id"};
$oTva=new Acc_Tva($this->db);
$oTva->set_parameter('id',$idx_tva);
$oTva=Acc_Tva::build($this->db,$idx_tva);
$oTva->load();
$op=new Acc_Compute();
@ -1807,27 +1812,32 @@ class Acc_Ledger_Purchase extends Acc_Ledger
</td>
</tr>
EOF;
if ($p_currency_code !=0) {
$rate=_("Taux ");
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
</td>
<td class="num">
</td>
<td class="num">
{$rate} {$p_currency_rate}
</td>
<td class="num">
{$tot_eur} EUR
</td>
</tr>
EOF;
if ($p_currency_code !=0) {
$sql_currency=new Currency_SQL($this->cn,0);
$iso_code=$sql_currency->getp("cr_code_iso");
$rate=_("Taux ");
$r.=<<<EOF
<tr class="highlight">
{$decalage}
<td>
</td>
<td class="num">
</td>
<td class="num">
{$rate} {$p_currency_rate}
</td>
<td class="num">
{$tot_eur} {$iso_code}
</td>
</tr>
EOF;
} // if ($p_currency_code !=0
}else { // if $g_parameter->MY_TVA_USE=='Y'
}else // if $g_parameter->MY_TVA_USE=='Y'
{
$sql_currency=new Currency_SQL($this->cn,0);
$iso_code=$sql_currency->getp("cr_code_iso");
$r.=<<<EOF
<tr class="highlight">
{$decalage}
@ -1853,7 +1863,7 @@ EOF;
<td>
</td>
<td class="num">
{$tot_str} {$str_code}
{$tot_str} {$iso_code}
</td>
</tr>
EOF;
@ -1878,7 +1888,7 @@ EOF;
$r.='<tr><td>Total HTVA</td>';
$r.=td(hb($tot_amount ),'class="num"');
foreach ($tva as $i => $value) {
$oTva->set_parameter('id', $i);
$oTva=Acc_Tva::build($this->db,$i);
$oTva->load();
$r.='<tr><td> TVA ' . $oTva->get_parameter('label').'</td>';

View file

@ -45,7 +45,6 @@ class Acc_Ledger_Sale extends Acc_Ledger {
* \return String
* \throw Exception if an error occurs
*/
public function verify_operation($p_array) {
global $g_parameter, $g_user;
@ -109,9 +108,15 @@ class Acc_Ledger_Sale extends Acc_Ledger {
$fiche = new Fiche($this->db);
$fiche->get_by_qcode($e_client);
if ($fiche->get_f_enable() == '0')
throw new Exception(sprintf(_("La fiche %s n'est plus utilisée"),$e_client), 50);
if ($fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ') . $e_client . _('n\'a pas de poste comptable'), 8);
/* get the account and explode if necessary */
$sposte = $fiche->strAttribut(ATTR_DEF_ACCOUNT);
// if 2 accounts, take only the debit one for customer
@ -143,26 +148,30 @@ class Acc_Ledger_Sale extends Acc_Ledger {
for ($i = 0; $i < $nb_item; $i++) {
if (! isset (${'e_march' . $i}) || noalyss_strlentrim(${'e_march' . $i}) == 0)
continue;
/* check if all card has a ATTR_DEF_ACCOUNT */
$fiche = new Fiche($this->db);
$fiche->get_by_qcode(${'e_march' . $i});
if ($fiche->get_f_enable() == '0')
throw new Exception(sprintf(_("La fiche %s n'est plus utilisée"), ${'e_march' . $i}), 50);
/* check if amount are numeric and */
if (isNumber(${'e_march' . $i . '_price'}) == 0)
throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('a un montant invalide [') . ${'e_march' . $i} . ']', 6);
if (isNumber(${'e_quant' . $i}) == 0)
throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('a une quantité invalide [') . ${'e_quant' . $i} . ']', 7);
/* check if all card has a ATTR_DEF_ACCOUNT */
$fiche = new Fiche($this->db);
$fiche->get_by_qcode(${'e_march' . $i});
if ($fiche->empty_attribute(ATTR_DEF_ACCOUNT) == true)
throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('n\'a pas de poste comptable'), 8);
// Check if the given tva id is valid
if ($g_parameter->MY_TVA_USE == 'Y') {
if (isNumber(${'e_march' . $i . '_tva_id'}) == 0)
throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('a un code tva invalide') . ' [' . ${'e_march' . $i . '_tva_id'} . ']', 13);
$tva_rate = new Acc_Tva($this->db);
$tva_rate->set_parameter('id', ${'e_march' . $i . '_tva_id'});
if ($tva_rate->load() != 0)
$tva_rate = Acc_Tva::build($this->db,${'e_march' . $i . '_tva_id'});
$tva_rate->load();
if ($tva_rate->tva_id === -1 )
throw new Exception(_('La fiche ') . ${'e_march' . $i} . _('a un code tva invalide') . ' [' . ${'e_march' . $i . '_tva_id'} . ']', 13);
$tva_rate->load();
/*
* check if the accounting for VAT are valid
*/
@ -171,7 +180,7 @@ class Acc_Ledger_Sale extends Acc_Ledger {
if (
$this->db->get_value('select count(*) from tmp_pcmn where pcm_val=$1', array($a_poste[1])) == 0)
throw new Exception(_(" La TVA " . $tva_rate->tva_label . " utilise des postes comptables inexistants"));
throw new Exception(_(" La TVA " . $tva_rate->tva_label . " utilise des postes comptables inexistants"));
}
// if 2 accounts, take only the credit one
/* The account exists */
@ -357,15 +366,16 @@ class Acc_Ledger_Sale extends Acc_Ledger {
if ($g_parameter->MY_TVA_USE == 'Y') {
/* Compute sum vat */
$oTva = new Acc_Tva($this->db);
$idx_tva = trim(${'e_march' . $i . '_tva_id'});
$tva_item_currency = ${'e_march' . $i . '_tva_amount'};
$oTva->set_parameter("id", $idx_tva);
$oTva = Acc_Tva::build($this->db, trim(${'e_march' . $i . '_tva_id'}));
$oTva->load();
$idx_tva =$oTva->get_parameter("id");
$tva_item_currency = ${'e_march' . $i . '_tva_amount'};
/* if empty then we need to compute it */
if (trim($tva_item_currency) == '' || ${'e_march'.$i.'_tva_amount'} == 0) {
/* retrieve tva */
$l = new Acc_Tva($this->db, $idx_tva);
$l = Acc_Tva::build($this->db, $idx_tva);
$l->load();
$tva_item_currency = bcmul($amount, $l->get_parameter('rate'));
$tva_item=round($tva_item_currency,2);
@ -434,7 +444,7 @@ class Acc_Ledger_Sale extends Acc_Ledger {
${'e_quant' . $i}, /* 4 */
round($amount, 2), /* 5 */
$tva_item, /* 6 */
$idx_tva, /* 7 */
$oTva->get_parameter("id"), /* 7 */
$e_client, /* 8 */
$n_both, /* 9 */
$price_euro/* Price /unit */
@ -548,8 +558,8 @@ class Acc_Ledger_Sale extends Acc_Ledger {
var_dump($tva);
}
foreach ($tva as $i => $value) {
$oTva = new Acc_Tva($this->db);
$oTva->set_parameter('id', $i);
$oTva = Acc_Tva::build($this->db,$i);
$oTva->load();
$poste_vat = $oTva->get_side('c');
@ -948,10 +958,8 @@ class Acc_Ledger_Sale extends Acc_Ledger {
else
$fiche_name = $fiche->strAttribut(ATTR_DEF_NAME);
if ($g_parameter->MY_TVA_USE == 'Y') {
$oTva = new Acc_Tva($this->db);
$idx_tva = ${"e_march" . $i . "_tva_id"};
$oTva->set_parameter('id', $idx_tva);
$oTva = Acc_Tva::build($this->db,$idx_tva);
$oTva->load();
}
$op = new Acc_Compute();
@ -1067,9 +1075,9 @@ if ( $g_parameter->MY_TVA_USE=="Y") {
</td>
</tr>
EOF;
$sql_currency=new Currency_SQL($this->cn,$p_currency_code);
$iso_code=$sql_currency->getp("cr_code_iso");
if ($p_currency_code !=0) {
$sql_currency=new Currency_SQL($this->cn,0);
$iso_code=$sql_currency->getp("cr_code_iso");
$r.=<<<EOF
<tr class="highlight">
@ -1092,7 +1100,9 @@ EOF;
} else {
$sql_currency=new Currency_SQL($this->cn,$p_currency_code);
$iso_code=$sql_currency->getp("cr_code_iso");
$str_code=$sql_currency->getp("cr_code_iso");
$sql_currencydefault=new Currency_SQL($this->cn,0);
$iso_code=$sql_currencydefault->getp("cr_code_iso");
// without VAT
$r.=<<<EOF
<tr class="highlight">
@ -1107,7 +1117,7 @@ EOF;
</td>
<td class="num">
{$tot_str}
{$tot_str} {$str_code}
</td>
</tr>
<tr class="highlight">
@ -1144,7 +1154,7 @@ EOF;
$r.='<tr><td>Total HTVA</td>';
$r.=td(hb($tot_amount ),'class="num"');
foreach ($tva as $i => $value) {
$oTva->set_parameter('id', $i);
$oTva=Acc_Tva::build($this->cn, $i);
$oTva->load();
$r.='<tr><td> TVA ' . $oTva->get_parameter('label').'</td>';
@ -1490,7 +1500,7 @@ EOF;
$W1->label = "";
$W1->name = "e_march" . $i;
$W1->value = $march;
$W1->table = 1;
$W1->table = 0;
$W1->set_attribute('typecard', 'cred');
$W1->set_dblclick("fill_ipopcard(this);");
$W1->set_attribute('ipopup', 'ipopcard');

View file

@ -689,14 +689,18 @@ class Acc_Ledger_Search
// VAT Code
if ( isset($tva_id_search) && ! empty (trim($tva_id_search??"")))
{
$fil_vat = $and." jr_internal in
( select distinct qp_internal
from quant_purchase
where qp_vat_code=".sql_string($tva_id_search).
" union all
select distinct qs_internal
from quant_sold
where qs_vat_code=".sql_string($tva_id_search).")";
$acc_tva=Acc_Tva::build($this->cn, $tva_id_search);
if ($acc_tva->tva_id != -1 )
{
$fil_vat = $and." jr_internal in
( select distinct qp_internal
from quant_purchase
where qp_vat_code=".sql_string($acc_tva->tva_id ).
" union all
select distinct qs_internal
from quant_sold
where qs_vat_code=".sql_string($acc_tva->tva_id ).")";
}
}
$where=$fil_ledger.$fil_amount.$fil_date.$fil_desc.$fil_sec.
@ -1296,7 +1300,7 @@ class Acc_Ledger_Search
}
$class=($e%2==0)?' class="even" ':' class="odd" ';
echo '<tr '.$class.'>';
echo '<td style="white-space: nowrap">'.$r->input().$row['jrn_def_name'].'</td>';
echo '<td style="white-space: nowrap">'.$r->input().$row['jrn_def_name']."(".$row['jrn_def_code'].")".'</td>';
echo '<td >'.$row['jrn_def_description'].'</td>';
echo '<td >'.$row['jrn_def_type'].'</td>';
echo '</tr>';

View file

@ -53,6 +53,13 @@ class Acc_Operation
//!< internal code from jrn
var $jr_internal;
var $signature;
var $desc;
var $type;
var $jrnx_id;
var $echeance;
var $pj;
var $mt;
var $f_id;
/*!
* \brief constructor set automatically the attributes user and periode
* \param $p_cn the databse connection
@ -259,7 +266,8 @@ EOF;
return $sum;
}
/*!\brief set the pj of a operation in jrn. the jr_id must be set
/*!
*\brief set the pj of a operation in jrn. the jr_id must be set
*\note if the jr_id it fails
*/
function set_pj()
@ -387,7 +395,8 @@ EOF;
$this->jr_internal= $l_line['jr_internal'];
return $this->jr_internal;
}
/*!\brief search an operation thankx it internal code
/*!
* \brief search an operation thankx it internal code
* \param internal code
* \return 0 ok -1 nok
*/
@ -399,10 +408,11 @@ EOF;
$this->jr_id=Database::fetch_result($res,0,0);
return 0;
}
/*!\brief retrieve data from jrnx
*\note the data are filtered by the access of the current user
* \return an array or FALSE if nothing found
*/
/*!
* \brief retrieve data from jrnx
*\note the data are filtered by the access of the current user
* \return an array or FALSE if nothing found
*/
function get_jrnx_detail()
{
global $g_user;
@ -841,8 +851,6 @@ EOF;
}
static function test_me()
{
$_SESSION[SESSION_KEY.'g_user']=NOALYSS_ADMINISTRATOR;
$_SESSION[SESSION_KEY.'g_pass']='dany';
global $g_user;
$cn=Dossier::connect();
$g_user=new Noalyss_user($cn);
@ -874,7 +882,12 @@ EOF;
return $type_operation;
}
/**
* @brief create a form to recreate the operation and returns it, just like a correct
* @brief create a form to recreate the operation and returns it,
* it works the same as when you want to correct an operation instead of confirming
*
* @see compta_ach.inc.php
* @see compta_ven.inc.php
*
* @param $p_id string DOMID of the form
*/
function form_clone_operation($p_id) {
@ -896,12 +909,22 @@ EOF;
"ac"=>$a_code[0]['code'],"gDossier"=>Dossier::id()
]));
$r.=Dossier::hidden();
$default_currency=new Acc_Currency($this->db,0);
// select the menu where the operation will be duplicated
$r.="<p>";
$r.="<ul style=\"margin-left:2rem;padding-left:0;list-style:none;\">";
$r.=sprintf("<li>%s</li>",$operation->det->jr_pj_number);
$r.=sprintf("<li>%s</li>",$operation->det->jr_comment);
$r.=sprintf("<li>%s</li>",$operation->det->jr_montant);
$r.=sprintf("<li>%s %s</li>",_("Date"),$operation->det->jr_pj_number);
$r.=sprintf("<li>%s %s</li>",_("Libellé"),$operation->det->jr_comment);
$r.=sprintf("<li>%s %s %s</li>",_("Montant "),nbm($operation->det->jr_montant),$default_currency->get_code());
// Add info if the operation using a currency
if ( $operation->det->currency_id != 0 ) {
$currency=$this->db->get_value("select cr_code_iso from currency where id=$1",[$operation->det->currency_id]);
$r.=sprintf("<li>%s %s</li>",_('Devise'),$currency);
$r.=sprintf("<li>%s %s</li>",_("Taux"),$operation->det->currency_rate);
$array['p_currency_code']=$operation->det->currency_id;
$array['p_currency_rate']=$operation->det->currency_rate;
}
$r.="</ul>";
$r.="</p>";
if (count($a_code) == 1 ) {
@ -923,31 +946,57 @@ EOF;
$r.="</p>";
// For Misc Operation , if a card is given then there is no accounting
// modify amount with currency if not in default currency
if ( $operation->signature==="ODS") {
$nb_array = count($array);
for ($i = 0; $i < $nb_array; $i++) {
if (isset ($array["qc_" . $i]) && $array["qc_" . $i] != "") {
$array["poste" . $i] = "";
}
}
}
if ( $operation->signature==="ACH" || $operation->signature=="VEN") {
}
$idx=0;
foreach ($operation->det->array as $item) {
if ($operation->det->currency_id != 0) {
$array['amount'. $idx] = $item['oc_amount'];
$idx++;
}
}
}elseif ( $operation->signature==="ACH" || $operation->signature=="VEN") {
$idx=0;
foreach ($operation->det->array as $item) {
// currency replace amount
if ($operation->det->currency_id != 0 ) {
$array['e_march'.$idx.'_tva_amount']=$item['oc_vat_amount'];
$array['e_march'.$idx.'_tva_amount']=$item['oc_amount'];
$array['e_march'.$idx.'_price']=$item['oc_price_unit'];
}
if ( isset ($item['qs_vat_sided']) && $item['qs_vat_sided'] != 0 ) {
$array['e_march'.$idx.'_tva_amount']=0;
}elseif (isset ($item['qp_vat_sided']) && $item['qp_vat_sided'] != 0 ){
$array['e_march'.$idx.'_tva_amount']=0;
}
$idx++;
}
if ( DEBUGNOALYSS>1) {
echo \Noalyss\Dbg::hidden_info("operation->det_array", $operation->det->array);
echo \Noalyss\Dbg::hidden_info("array", $array);
}elseif ($operation->signature=='FIN') {
$idx=0;
foreach ($operation->det->array as $item) {
if ($operation->det->currency_id != 0) {
$array['e_other' . $idx . '_amount'] = $item['oc_amount'];
$idx++;
}
}
}
if ( DEBUGNOALYSS>1) {
echo \Noalyss\Dbg::hidden_info("operation->det_array", $operation->det->array);
echo \Noalyss\Dbg::hidden_info("operation->det", $operation->det);
echo \Noalyss\Dbg::hidden_info("array", $array);
}
// transform the operation into hidden element
$r.=HtmlInput::simple_array_to_hidden($array);
$r.=HtmlInput::hidden("e_comm",$operation->det->jr_comment);
@ -1011,7 +1060,7 @@ class Acc_Detail extends Acc_Operation
$array['e_ech']="";
$array['p_jrn']=$this->det->jr_def_id;
return $array;
}
}
/////////////////////////////////////////////////////////////////////////////
@ -1034,10 +1083,30 @@ class Acc_Misc extends Acc_Detail
function get()
{
parent::get();
$sql="SELECT j_id, j_date, j_montant, j_poste, j_grpt, j_rapt, j_jrn_def,
j_debit, j_text, j_centralized, j_internal, j_tech_user, j_tech_date,
j_tech_per, j_qcode,f_id
FROM jrnx where j_grpt = $1 order by j_debit desc,j_poste";
$sql="
SELECT jx1.j_id
,jx1.j_date
,jx1.j_montant
,jx1.j_poste
,jx1.j_grpt
,jx1.j_rapt
,jx1.j_jrn_def
,jx1.j_debit
,jx1.j_text
,jx1.j_centralized
,jx1.j_internal
,jx1.j_tech_user
,jx1.j_tech_date
,jx1.j_tech_per
,jx1.j_qcode
,jx1.f_id
,oc1.oc_amount
FROM jrnx jx1
left join operation_currency oc1 using(j_id)
where
jx1.j_grpt = $1
order by jx1.j_debit desc,jx1.j_poste
";
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
}
/***
@ -1083,13 +1152,33 @@ class Acc_Sold extends Acc_Detail
function get()
{
parent::get();
$sql="SELECT qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, qs_vat,
qs_vat_code, qs_client, qs_valid, j_id,j_text,qs_vat_sided , qs_unit , j_debit
FROM quant_sold join jrnx using(j_id) where j_grpt=$1 order by j_id";
$sql="
select qs_id, qs_internal
, jx1.j_id
, qs1.qs_fiche
, qs1.qs_quantite
, qs1.qs_price
, qs1.qs_vat
, qs1.qs_vat_code
, qs1.qs_client
, qs1.qs_valid
, jx1.j_text
, qs_vat_sided
, qs_unit
, jx1.j_debit
,oc1.oc_amount
,oc1.oc_vat_amount
,oc1.oc_price_unit
from quant_sold qs1
join jrnx jx1 using(j_id)
left join operation_currency oc1 using(j_id)
where jx1.j_grpt = $1
order by jx1.j_id;
";
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
}
/***
* Compute an array for using with Acc_Ledger::insert
* @brief Compute an array for using with Acc_Ledger::insert
*
*/
function compute_array()
@ -1138,14 +1227,39 @@ class Acc_Purchase extends Acc_Detail
function get()
{
parent::get();
$sql="SELECT qp_id, qp_internal, j_id, qp_fiche, qp_quantite, qp_price, qp_vat,
qp_vat_code, qp_nd_amount, qp_nd_tva, qp_nd_tva_recup, qp_supplier,
qp_valid, qp_dep_priv,j_text,qp_vat_sided,qp_unit , j_debit
FROM quant_purchase join jrnx using(j_id) where j_grpt=$1 order by j_id";
$sql="
select qp_id, qp_internal
, jx1.j_id
, qp1.qp_fiche
, qp1.qp_quantite
, qp1.qp_price
, qp1.qp_vat
, qp1.qp_vat_code
, qp1.qp_nd_amount
, qp1.qp_nd_tva
, qp1.qp_nd_tva_recup
, qp1.qp_supplier
, qp1.qp_valid
, qp1.qp_dep_priv
, jx1.j_text
, qp1.qp_vat_sided
, qp1.qp_unit
, jx1.j_debit
,oc1.oc_amount
,oc1.oc_vat_amount
,oc1.oc_price_unit
from quant_purchase qp1
join jrnx jx1 using(j_id)
left join operation_currency oc1 using(j_id)
where jx1.j_grpt = $1
order by jx1.j_id
";
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
}
/***
* Compute an array for using with Acc_Ledger::insert
* @brief Compute an array for using with Acc_Ledger::insert
*
*/
function compute_array()
@ -1168,9 +1282,11 @@ class Acc_Purchase extends Acc_Detail
$array["e_march".$i."_tva_id"]=$this->det->array[$i]['qp_vat_code'];
$array["e_march".$i."_tva_amount"]=$this->det->array[$i]['qp_vat'];
$array["e_quant".$i]=$this->det->array[$i]['qp_quantite'];
}
$array['correct']=1;
return $array;
return $array;
}
@ -1194,8 +1310,18 @@ class Acc_Fin extends Acc_Detail
function get()
{
parent::get();
$sql="SELECT qf_id, qf_bank, jr_id, qf_other, qf_amount,j_id
FROM quant_fin where jr_id = $1";
$sql="SELECT qf_id
,qf_bank
,jr_id
,qf_other
,qf_amount,j_id
,oc1.oc_amount
,oc1.oc_vat_amount
,oc1.oc_price_unit
FROM quant_fin
left join operation_currency oc1 using(j_id)
where
jr_id = $1";
$this->det->array=$this->db->get_array($sql,array($this->jr_id));
}
/***

View file

@ -33,9 +33,10 @@ require_once NOALYSS_INCLUDE.'/constant.php';
- mp_qcode ==> qcode (quick_code of the card)
*
*/
#[AllowDynamicProperties]
class Acc_Payment
{
private static $variable=array("id"=>"mp_id",
"lib"=>"mp_lib",
"qcode"=>"mp_qcode",
@ -43,13 +44,13 @@ class Acc_Payment
"ledger_source"=>"jrn_def_id",
"fiche_def"=>"mp_fd_id");
private $mp_id;
private $mp_lib;
private $mp_qcode;
private $mp_jrn_def_if;
private $jrn_def_id;
private $mp_fd_id;
private $cn; //!< Database connection
function __construct ($p_cn,$p_init=0)
{
$this->cn=$p_cn;

View file

@ -121,8 +121,9 @@ class Acc_Reconciliation
==0)
{
// Ok we can insert
$Res=$this->db->exec_sql("insert into jrn_rapt(jr_id,jra_concerned) values ".
"(".$this->jr_id.",$jr_id2)");
$Res=$this->db->exec_sql("insert into jrn_rapt(jr_id,jra_concerned) values ($1,$2)",
array($this->jr_id,$jr_id2)
);
// try to letter automatically same account from both operation
$this->auto_letter($jr_id2);

View file

@ -35,6 +35,8 @@ class Acc_Report
private $form_definition; /*!< form_definition_sql */
var $row;
var $nb;
var $id;
var $name;
/*!
\brief Constructor
*/

View file

@ -47,6 +47,7 @@ class Acc_Tva
$tva_comment,
$tva_poste,
$tva_both_side;
private $cn; //!< Database connection
private Tva_Rate_SQL $tva_rate_sql;
@ -60,6 +61,7 @@ class Acc_Tva
$this->tva_comment=&$this->tva_rate_sql->tva_comment;
$this->tva_poste=&$this->tva_rate_sql->tva_poste;
$this->tva_both_side=&$this->tva_rate_sql->tva_both_side;
$this->tva_code=&$this->tva_rate_sql->tva_code;
}
/**
@ -103,9 +105,10 @@ class Acc_Tva
}
/**
*Load the VAT,
*@brief Load the VAT, return 0 if the TVA_ID exists otherwise -1
*@note if the label is not found then we get an message error, so the best is probably
*to initialize the VAT object with default value
*
*/
public function load():int
{
@ -135,4 +138,26 @@ class Acc_Tva
throw (new Exception (__FILE__.':'.__LINE__." param est d ou c, on a recu [ $p_side ]"));
}
}
/**
* @brief retrieve TVA rate thanks the code that could be the tva_id or tva_code. Check first if p_code is a
* TVA_CODE and if not, check if it is a TVA_ID
* @param $db Database connection
* @param $p_code either tva_id or tva_code
* @return Acc_Tva or Acc_TVA with tva_id=-1
*/
static function build($db,$p_code):Acc_Tva {
if (empty($p_code)) return new Acc_Tva($db,-1);
$tva_id = $db->get_value("select tva_id from public.tva_rate where tva_code=upper(trim($1))",[$p_code]);
if ( $db->size() == 1) {
return new Acc_Tva($db,$tva_id);
}
if (isNumber($p_code) == 0) return new Acc_Tva($db,-1);
$exist = $db->get_value("select count(*) from public.tva_rate where tva_id=$1",[$p_code]);
if ( $exist == 1) {
return new Acc_Tva($db,$p_code);
}
return new Acc_Tva($db,-1);
}
}

View file

@ -313,8 +313,8 @@ class Calendar
return $ret;
}
/**
* Display the next events for 30 days
* todo list + action to remind
* @brief Display the next events for 30 days
* @todo todo list + action to remind
*/
function zoom_list($notitle)
{
@ -323,7 +323,8 @@ class Calendar
$profile=$g_user->get_profile();
// Get the event from now and before 30 before
// union the TODO list
$sql = "
select ag_id,ag_remind_date,to_char(ag_remind_date,'DD.MM.YY') as str_date,ag_title,ag_hour,
coalesce(name,'interne') as str_name,
@ -334,9 +335,8 @@ class Calendar
coalesce (ag_remind_date::date,current_date) - current_date as delta_days
from action_gestion
left join vw_fiche_name on (f_id=f_id_dest)
where
ag_dest in (select p_granted from user_sec_action_profile where p_id =$1)
and ag_state IN (2, 3)
where ag_dest in (select p_granted from user_sec_action_profile where p_id =$1)
and ag_state IN (2, 3)
and ag_remind_date is not null
order by ag_remind_date,ag_hour
";

View file

@ -631,7 +631,8 @@ class Card_Property
// Verify if the rate exists, if not then do not update
if (noalyss_strlentrim($value->av_text)!=0)
{
if ($p_fiche->cn->get_value("select count(*) from tva_rate where tva_id=$1",[$value->av_text])==0)
$acc_tva=Acc_Tva::build($p_fiche->cn,$value->av_text );
if ($acc_tva->tva_id==-1)
{
continue;
}

View file

@ -64,6 +64,7 @@ class Database extends DatabaseCore
parent::__construct($noalyss_user, $password, $l_dossier, $host, $port);
$this->exec_sql('set search_path to public,pg_catalog;');
if ($this->exist_schema('comptaproc')) {
$this->exec_sql('set search_path to public,comptaproc,pg_catalog;');
}

View file

@ -37,8 +37,9 @@ class Document
var $d_description; /*!< Description of the file */
var $d_number; /*!< $d_number number of the document */
var $md_id; /*!< $md_id document's template */
var $f_id; /*!< fiche.f_id */
private $counter; /*!< counter for the items ( goods ) */
var $d_name; /*!< document name */
/*!
* @brief Constructor
* \param $p_cn Database connection
@ -1152,7 +1153,7 @@ class Document
return '';
if ($p_array[$march_id]==0)
return '';
$tva=new Acc_Tva($this->db, $p_array[$id]);
$tva= Acc_Tva::build($this->db, $p_array[$id]);
if ($tva->load()==-1)
return "";
$r=$tva->get_parameter('label');

View file

@ -148,7 +148,7 @@ class Extension extends Menu_Ref_sql
throw new Exception(_('Profil inexistant'), 10);
}
// Menu exists
\Noalyss\Dbg::echo_var(1,__FILE__.__LINE__. "p_module to find $p_module");
$module=new Menu_Ref($cn, $p_module);
if ($module->me_code==null)
{
@ -162,7 +162,9 @@ class Extension extends Menu_Ref_sql
// throw an exception if there is no dependency
if (empty($dep_id))
{
throw new Exception(_('Pas de menu ').$p_module, 30);
$msg = sprintf(_("Le menu %s dont dépend %s doit être crée ou %s doit être ajouté depuis le menu C0PROFL"),
$p_module,$this->me_code,$this->me_code);
throw new Exception($msg, 30);
}
$nb_dep=count($dep_id);
@ -196,7 +198,20 @@ class Extension extends Menu_Ref_sql
}
/**
* Insert a plugin into the given profile, by default always insert into EXT
* @brief save a plugin into MENU_REF , calls insert_plugin or update_plugin if it already exists
* @return void
*/
function save_plugin()
{
if ( $this->cn->get_value("select count(*) from menu_ref where me_code=$1",[$this->me_code]) > 0) {
$this->update_plugin();
} else {
$this->insert_plugin();
}
}
/**
* @brief Insert a plugin into the given profile, by default always insert into EXT
*
* @param type $p_id profile.p_id
* @throws Exception if duplicate or error db

View file

@ -56,19 +56,7 @@ class Fiche_Def
*/
function input ()
{
$ref=$this->cn->get_array("select * from fiche_def_ref order by frd_text");
$iradio=new IRadio();
/* the accounting item */
$class_base=new IPoste('class_base');
$class_base->set_attribute('ipopup','ipop_account');
$class_base->set_attribute('account','class_base');
$class_base->set_attribute('label','acc_label');
$f_class_base=$class_base->input();
$fd_description=new ITextarea('fd_description');
$fd_description->width=80;
$fd_description->heigh=4;
$fd_description->style='class="itextarea" style="margin-left:0px;vertical-align:text-top"';
require_once NOALYSS_TEMPLATE.'/fiche_def_input.php';
return;
}
@ -131,7 +119,7 @@ class Fiche_Def
$this->label=$row['fd_label'];
$this->class_base=$row['fd_class_base'];
$this->fiche_def=$row['frd_id'];
$this->create_account=$row['fd_create_account'];
$this->create_account=($row['fd_create_account']=='f')?false:true;
$this->fd_description=$row['fd_description'];
}
/*!
@ -196,7 +184,7 @@ frd_text , fd_description FROM fiche_def join fiche_def_ref on (fiche_def.frd_id
$order
");
require_once NOALYSS_TEMPLATE.'/fiche_def_list.php';
require_once NOALYSS_TEMPLATE.'/fiche_def-display.php';
}
/*!
* \brief Add a fiche category thanks the element from the array
@ -220,7 +208,7 @@ $order
$http->set_array($array);
$p_nom_mod = $http->extract('nom_mod',"string","");
$p_fd_description = $http->extract('fd_description',"string", "");
$p_class_base=$http->extract('class_base',"string", "");
$p_fiche_def= $http->extract('FICHE_REF',"string", "");
$p_create= $http->extract('create',"string", "off");
@ -253,13 +241,19 @@ $order
alert (_('Catégorie existante'));
return 1;
}
$default_acc=$this->cn->get_value("select frd_class_base from fiche_def_ref where frd_id=$1",[$p_fiche_def]);
// if the account is empty, takes the account of the template from fiche_def_ref
$p_class_base=$http->extract('class_base',"string", "");
$p_class_base=(noalyss_trim($p_class_base)=='')?$default_acc:$p_class_base;
// Set the value of fiche_def.fd_create_account
// automatic creation for 'poste comptable'
if ( $p_create == "on" && noalyss_strlentrim($p_class_base) != 0)
$p_create='true';
else
$p_create='false';
$add_accounting=false;
// Class is valid ?
if ( sql_string($p_class_base) != null || ( $p_class_base !='' && strpos(',',$p_class_base) != 0 ))
{
@ -278,10 +272,11 @@ $order
// Get the fd_id
$fd_id=$this->cn->get_current_seq('s_fdef');
// update jnt_fic_attr
$sql=sprintf("insert into jnt_fic_attr(fd_id,ad_id,jnt_order)
values (%d,%d,10)",$fd_id,ATTR_DEF_ACCOUNT);
$Res=$this->cn->exec_sql($sql);
// // update jnt_fic_attr
// $sql=sprintf("insert into jnt_fic_attr(fd_id,ad_id,jnt_order)
// values (%d,%d,10)",$fd_id,ATTR_DEF_ACCOUNT);
// $Res=$this->cn->exec_sql($sql);
$add_accounting=true;
}
else
{
@ -301,24 +296,39 @@ $order
//if defaut attr not null
// build the sql insert for the table attr_def
$add_qcode=true;
if (sizeof($def_attr) != 0 )
{
// insert all the mandatory fields into jnt_fiche_attr
foreach ( $def_attr as $row)
{
$order=$row['ad_default_order'];
if ( $row['ad_id'] == ATTR_DEF_NAME )
$order=0;
$count=$this->cn->get_value("select count(*) from jnt_fic_attr where fd_id=$1 and ad_id=$2",array($fd_id,$row['ad_id']));
if ($count == 0)
{
$sql=sprintf("insert into jnt_fic_Attr(fd_id,ad_id,jnt_order)
values (%d,%s,%d)",
$fd_id,$row['ad_id'],$order);
$fd_id,$row['ad_id'],$row['ad_default_order']);
$this->cn->exec_sql($sql);
}
// if there is an accounting , then not needed to add one
if ( $row['ad_id']==ATTR_DEF_ACCOUNT) $add_accounting=FALSE;
if ( $row['ad_id']==ATTR_DEF_QUICKCODE) $add_qcode=FALSE;
}
}
// if there is an base accounting, and the accounting is not in ATTR_MIN,
// then it is needed to add it
if ( $add_accounting) {
$sql=sprintf("insert into jnt_fic_attr(fd_id,ad_id,jnt_order)
values (%d,%d,10)",$fd_id,ATTR_DEF_ACCOUNT);
$Res=$this->cn->exec_sql($sql);
}
// if there is no quick code in attr_min, it is added
if ( $add_qcode) {
$sql=sprintf("insert into jnt_fic_attr(fd_id,ad_id,jnt_order)
values (%d,%d,10000)",$fd_id,ATTR_DEF_QUICKCODE);
$Res=$this->cn->exec_sql($sql);
}
$this->id=$fd_id;
return 0;
@ -457,41 +467,7 @@ $order
echo $bar;
}
/*!\brief show input for the basic attribute : label, class_base, create_account
* use only when we want to update
*
*\return HTML string with the form
*/
function input_base()
{
$r="";
$r.=_('Label');
$label=new IText('label',$this->label);
$r.=$label->input();
$r.='<br>';
/* the accounting item */
$class_base=new IPoste('class_base',$this->class_base);
$class_base->set_attribute('ipopup','ipop_account');
$class_base->set_attribute('account','class_base');
$class_base->set_attribute('label','acc_label');
$fd_description=new ITextarea('fd_description',$this->fd_description);
$fd_description->width=80;
$fd_description->heigh=4;
$fd_description->style='class="itextarea" style="margin-left:0px;vertical-align:text-top"';
$r.=_('Poste Comptable de base').' : ';
$r.=$class_base->input();
$r.='<span id="acc_label"></span><br>';
$r.='<br/>';
$r.=" Description ".$fd_description->input();
/* auto Create */
$r.='<br/>';
$ck=new ICheckBox('create');
$ck->selected=($this->create_account=='f')?false:true;
$r.=_('Chaque fiche aura automatiquement son propre poste comptable : ');
$r.=$ck->input();
return $r;
}
/*!\brief Display all the attribut of the fiche_def
*\param $str give the action possible values are remove, empty
*/
@ -607,6 +583,7 @@ $order
$Res=$this->cn->exec_sql($sql,array($t,$this->id));
}
/*!\brief Save the class base
* \param $p_label label
@ -749,9 +726,10 @@ $order
{
// find the min attr for the fiche_def_ref
$Sql="select ad_id,ad_text ,ad_default_order
from attr_min natural join attr_def
natural join fiche_def_ref
$Sql="select ad_id,ad_text ,attr_min.ad_default_order
from attr_min
join attr_def using(ad_id)
join fiche_def_ref using(frd_id)
where
frd_id= $1 order by ad_default_order";
$Res=$this->cn->exec_sql($Sql,array($p_fiche_def_ref));
@ -770,7 +748,8 @@ $order
}
return $array;
}
/*!\brief count the number of fiche_def (category) which has the frd_id (type of category)
/*!
* \brief count the number of fiche_def (category) which has the frd_id (type of category)
*\param $p_frd_id is the frd_id in constant.php the FICHE_TYPE_
*\return the number of cat. of card of the given type
*\see constant.php
@ -780,6 +759,11 @@ $order
$ret=$this->cn->count_sql("select fd_id from fiche_def where frd_id=$1",array($p_frd_id));
return $ret;
}
/**
* @brief ask for detail
* @return string
*/
function input_detail()
{
$r = "";
@ -790,16 +774,37 @@ $order
$r.= '<H2 class="info">' . $this->id . " " . h($this->label) . '</H2>';
$r.='<fieldset><legend>'._('Données générales').'</legend>';
/* show the values label class_base and create account */
$r.='<form method="post">';
$r.=dossier::hidden();
$r.=HtmlInput::hidden("fd_id", $this->id);
$r.=HtmlInput::hidden("p_action", "fiche");
$r.= $this->input_base();
$r.='<hr>';
$r.=HtmlInput::submit('change_name', _('Sauver'));
$r.='</form>';
$nom_mod=$this->label;
/* the accounting item */
$class_base=new IPoste('class_base');
$class_base->set_attribute('ipopup','ipop_account');
$class_base->set_attribute('account','class_base');
$class_base->set_attribute('label','acc_label');
$class_base->value=$this->class_base;
$f_class_base=$class_base->input();
$fd_description=new ITextarea('fd_description');
$fd_description->width=80;
$fd_description->heigh=4;
$fd_description->style='class="itextarea form-control input_text" style="margin-left:0px;vertical-align:text-top"';
$fd_description->value=$this->fd_description;
$r.='<form method="post" style="display:inline">';
$r.=\HtmlInput::hidden('fd_id',$this->id);
ob_start();
require_once NOALYSS_TEMPLATE.'/fiche_def_input.php';
$r.=ob_get_contents();
ob_clean();
$r.=HtmlInput::submit('change_name', _('Sauver'));
$r.='</form>';
$r.='<form method="post" style="display:inline" id="catcard_remove" onsubmit="return confirm_box(this,\'Effacer?\')">';
$r.=HtmlInput::hidden("action", "remove_cat");
$r.=HtmlInput::hidden('fd_id',$this->id);
$r.=HtmlInput::submit('remove_cat', _('Effacer'));
$r.='</form>';
require NOALYSS_TEMPLATE.'/fiche_def-input_detail.php';
$r.='</fieldset>';
$r.='<hr>';
/* attributes */
$r.='<fieldset><legend>'._('Détails').'</legend>';
@ -807,33 +812,46 @@ $order
$r.=dossier::hidden();
$r.=HtmlInput::hidden("fd_id", $this->id);
$r.=HtmlInput::hidden("action", "");
$r.= $this->DisplayAttribut("remove");
$r.= HtmlInput::submit('add_line_bt', _('Ajoutez cet élément'),
'onclick="$(\'action\').value=\'add_line\'"');
$r.= HtmlInput::submit("save_line_bt", _("Sauvez"),
'onclick="$(\'action\').value=\'save_line\'"');
$r.=HtmlInput::submit('remove_cat_bt', _('Effacer cette catégorie'), 'onclick="$(\'action\').value=\'remove_cat\';return confirm_box(\'input_detail_frm\',\'' . _('Vous confirmez ?') . '\')"');
// if there is nothing to remove then hide the button
if (strpos($r, "chk_remove") != 0)
{
$r.=HtmlInput::submit('remove_line_bt', _("Enleve les éléments cochés"),
'onclick="$(\'action\').value=\'remove_line\';return confirm_box(\'input_detail_frm\',\'' . _('Vous confirmez ?') . '\')"');
}
// $r.= $this->DisplayAttribut("remove");
ob_start();
require NOALYSS_TEMPLATE."/fiche_def-input_detail-2.php";
$r.=ob_get_contents();
ob_clean();
$r.= "</form>";
$r.=" <p class=\"notice\"> " . _("Attention : il n'y aura pas de demande de confirmation pour enlever les
attributs sélectionnés. Il ne sera pas possible de revenir en arrière") . "</p>";
$r.='</fieldset>';
return $r;
}
/**
* @brief input for creating a new category
* @return void
*/
function input_new()
{
$single=new Single_Record("dup");
echo '<form method="post" style="display:inline">';
echo '<form method="post" style="display:inline" onsubmit="return check_new_category()">';
echo $single->hidden();
echo HtmlInput::hidden("p_action","fiche");
echo dossier::hidden();
echo $this->input(); // CreateCategory($cn,$search);
$ref=$this->cn->get_array("select * from fiche_def_ref order by frd_text");
$iradio=new IRadio();
$nom_mod="";
/* the accounting item */
$class_base=new IPoste('class_base');
$class_base->set_attribute('ipopup','ipop_account');
$class_base->set_attribute('account','class_base');
$class_base->set_attribute('label','acc_label');
$f_class_base=$class_base->input();
$fd_description=new ITextarea('fd_description');
$fd_description->width=80;
$fd_description->heigh=4;
$fd_description->style='class="itextarea form-control input_text" style="margin-left:0px;vertical-align:text-top"';
require_once NOALYSS_TEMPLATE.'/fiche_def_input.php';
require_once NOALYSS_TEMPLATE.'/fiche_def-input_new.php';
echo HtmlInput::submit("add_modele" ,_("Sauve"));
echo '</FORM>';
}
@ -883,5 +901,26 @@ $order
}
/**
* @brief display existing attribut
* @param $attribut_id int SQL attr_def.ad_id
* @param $attribut_text SQL attr_def.ad_text
* @return void
*/
public static function print_existing_attribut($attribut_id,$attribut_text)
{
include NOALYSS_TEMPLATE.'/fiche_def-print_existing_attribut.php';
}
/**
* @brief display available attribut
* @param $attribut_id int SQL attr_def.ad_id
* @param $attribut_text SQL attr_def.ad_text
* @return void
*/
public static function print_available_attribut($attribut_id,$attribut_text,$class)
{
include NOALYSS_TEMPLATE.'/fiche_def-print_available_attribut.php';
}
}
?>

View file

@ -44,6 +44,8 @@ require_once NOALYSS_INCLUDE.'/lib/user_common.php';
* </ul>
* The table document_type are the possible actions
*/
#[AllowDynamicProperties]
class Follow_Up
{
@ -51,6 +53,7 @@ class Follow_Up
var $ag_timestamp; /*!< $ag_timestamp document date (ag_gestion.ag_timestamp) */
var $dt_id; /*!< $dt_id type of the document (document_type.dt_id) */
var $ag_state; /*!< $ag_state stage of the document (printed, send to client...) */
var $ag_owner; /*!< $ag_owner of the followup */
var $d_number; /*!< $d_number number of the document */
var $d_filename; /*!< $d_filename filename's document */
var $d_mimetype; /*!< $d_mimetype document's filename */
@ -66,7 +69,9 @@ class Follow_Up
var $ag_id; //!< Follow_Up.ag_id
var $f_id_dest; /*!< followup action recipient */
var $aAction_detail; //!< Array of action details
var $ag_type; //!< type of document
var $d_id; //!< Document
var $state; //!< State of the document
/**
* @var integer $ag_description_id if greater than 0 , it is the id in action_comment
* of the description (1st comment)
@ -229,7 +234,9 @@ class Follow_Up
);
// List opération liées
$operation=$this->db->get_array("select ago_id,j.jr_id,j.jr_internal,j.jr_comment,to_char(j.jr_date,'DD.MM.YY') as str_date
$operation=$this->db->get_array("select ago_id,j.jr_id,j.jr_internal,j.jr_comment
,to_char(j.jr_date,'DD.MM.YY') as str_date
,jr_pj_number
from jrn as j join action_gestion_operation as ago on (j.jr_id=ago.jr_id)
where ag_id=$1 order by jr_date", array($this->ag_id));
$iconcerned=new IConcerned('operation');
@ -413,6 +420,7 @@ class Follow_Up
$iag_ref=new IText("ag_ref");
$iag_ref->value=$this->ag_ref;
$iag_ref->readOnly=false;
$iag_ref->css_size="100%";
$str_ag_ref=$iag_ref->input();
// Preparing the return string
$r="";
@ -691,6 +699,7 @@ class Follow_Up
{
// for the sort
$arg=HtmlInput::get_to_string(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag"),"");
$arg=($arg!="")?"&$arg":"";
$url=$p_base.$arg;
$table=new Sort_Table();
@ -712,7 +721,7 @@ class Follow_Up
//7
$table->add(_('Etat'), $url, 'order by s_value asc', 'order by s_value desc', 'ea', 'ed');
// 8
$table->add(_('Dernier comm.'), $url, 'order by last_comment_date nulls last', 'order by last_comment_date desc nulls last', 'dca', 'dcd');
$table->add(_('Dernier comm.'), $url, 'order by coalesce(last_comment_date, ag.ag_timestamp) asc', 'order by coalesce(last_comment_date, ag.ag_timestamp) desc', 'dca', 'dcd');
// 9
$table->add(_('Priorité'), $url, 'order by ag_priority ', 'order by ag_priority desc ', 'pra', 'prd');
$http=new HttpInput();

View file

@ -37,6 +37,7 @@
* - "ag_id"=>"ag_id" => foreign key to action_gestion
* - db is the database connection
*/
#[AllowDynamicProperties]
class Follow_Up_Detail
{
private static $variable=array(

View file

@ -161,20 +161,23 @@ class Lettering
return;
// already linked
if ($let1!=0&&$let2!=0&&$let1!=$let2)
/* if ($let1!=0&&$let2!=0&&$let1!=$let2)
return;
*/
// none is linked
if ($let1==0&&$let2==0)
{
$jl_id=$this->db->get_next_seq("jnt_letter_jl_id_seq");
$this->db->exec_sql('insert into jnt_letter(jl_id) values($1)', array($jl_id));
}
// one is linked but not the other
if ($let1==0&&$let2!=0)
} elseif ($let1==0&&$let2!=0)
{
// one is linked but not the other
$jl_id=$let2;
if ($let1!=0&&$let2==0)
}elseif ($let1!=0&&$let2==0) {
$jl_id=$let1;
} else {
throw new \Exception ("LET179 invalid");
}
/* insert */
if ($first=='t')

View file

@ -153,16 +153,25 @@ class Noalyss_Appearance
h2.title {
background-color: {$inner_box_title} ;
}
.nav-fill .nav-item {
background: {$menu1};
color: {$menu1_font};
.nav-fill .nav-item {
background: {$menu1} !important;
color: {$menu1_font} !important;
}
.nav-fill:hover {
color: {$menu1_font} !important;
}
.nav-level2 {
background-color: {$menu2};
color:{$menu2_font};
}
.nav-pills .nav-link.active {
background-color: {$menu1_selected} !important;
}
.nav-pills .nav-link {
color: {$menu1_font} !important;
}
.nav-link:hover {
background-color:{$menu1_selected};
}
table.sortable, table.table_large, table.result ,table.resultfooter {
color:{$font_table} !important;

View file

@ -215,9 +215,14 @@ EOF;
*/
function match_analytic($p_accounting)
{
$string="/^[".$this->MY_ANC_FILTER."]+/";
if ( preg_match($string,$p_accounting) == 0 ) return FALSE;
return TRUE;
$a_filter=explode(",",$this->MY_ANC_FILTER??"");
if (empty($a_filter)) return false;
foreach ($a_filter as $filter ) {
$string="/^".$filter.".*/";
if ( preg_match($string,$p_accounting) != 0 ) return TRUE;
}
return FALSE;
}
}

View file

@ -48,7 +48,14 @@ class Noalyss_User
var $access_mode; //!< MOBILE or PC depending if when connecting $login contains @mobile
var $lang ; //!< user's language
var $theme ; //!< user's CSS Theme
/**
* @brief Create an user , load an existing one or if p_id == -1 search for the connected user. To have an empty
* user, give a p_id smaller than -1 or zero.
*
* @param $p_cn DatabaseCore connection
* @param $p_id if -1 then load the current user, > 0 load the user , = 0 (or < -1 ) means an empty user
*/
function __construct($p_cn, $p_id=-1)
{
$this->db=$p_cn;
@ -609,7 +616,7 @@ class Noalyss_User
break;
}
$sql="select jrn_def_id,jrn_def_type,
$sql="select jrn_def_id,jrn_def_type,jrn_def_code,
jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
jrn_deb_max_line,jrn_cred_max_line,jrn_def_description,jrn_enable
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
@ -622,7 +629,7 @@ class Noalyss_User
else
{
$sql_type=($p_type=='ALL')?' '.$sql_enable:"where jrn_def_type=upper('".sql_string($p_type)."') ".$sql_enable;
$sql="select jrn_def_id,jrn_def_type,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
$sql="select jrn_def_id,jrn_def_type,jrn_def_code,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_deb_max_line,jrn_cred_max_line,
jrn_type_id,jrn_desc,'W' as uj_priv,jrn_def_description,jrn_enable
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
$sql_type
@ -657,7 +664,7 @@ class Noalyss_User
}
/**
* synomym for isAdmin,
* @brief synomym for isAdmin,
* @deprecated
*/
function Admin():int
@ -745,40 +752,9 @@ class Noalyss_User
return $array['PERIODE'];
}
/**
*
* \brief return the mini rapport to display on the welcome page
* \return 0 if nothing if found or the report to display (form_definition.fr_id)
*/
function get_mini_report()
{
$array=$this->get_preference();
$fr_id=(isset($array['MINIREPORT']))?$array['MINIREPORT']:0;
return $fr_id;
}
/**
* \brief set the mini rapport to display on the welcome page
*/
function set_mini_report($p_id)
{
$count=$this->db->get_value("select count(*) from user_local_pref where user_id=$1 and parameter_type=$2",
array($this->id, 'MINIREPORT'));
if ($count==1)
{
$sql="update user_local_pref set parameter_value=$1 where user_id=$2 and parameter_type='MINIREPORT'";
$Res=$this->db->exec_sql($sql, array($p_id, $this->id));
}
else
{
$sql="insert into user_local_pref (user_id,parameter_type,parameter_value)".
"values($1,'MINIREPORT',$2)";
$Res=$this->db->exec_sql($sql, array($this->id, $p_id));
}
}
/**
* Save the preference , the scope is global, the settings are saved
* @brief Save the preference , the scope is global, the settings are saved
* into account_repository
* @param $key THEME, LANG , PAGESIZE
* @param $value value of the key
@ -1021,7 +997,8 @@ class Noalyss_User
}
//end function
/* * \brief Return the year of current Periode
/**
* \brief Return the year of current Periode
* it is the parm_periode.p_exercice col
* if an error occurs return 0
*/
@ -1039,7 +1016,8 @@ class Noalyss_User
return 0;
}
/* * \brief Check if the user can access
/**
* \brief Check if the user can access
* otherwise warn and exit
* \param $p_action requested action
* \param $p_js = 1 javascript, or 0 just a text or 2 to log it silently
@ -1089,7 +1067,8 @@ class Noalyss_User
return $res;
}
/* * \brief Check if the user can print (in menu_ref p_type_display=p)
/**
* \brief Check if the user can print (in menu_ref p_type_display=p)
* otherwise warn and exit
* \param $p_action requested action
* \return nothing the program exits automatically
@ -1517,6 +1496,7 @@ class Noalyss_User
*/
function can_add_action($p_profile)
{
$r=$this->db->get_value(' select count(*)
from user_sec_action_profile
where p_granted=$2
@ -1529,7 +1509,7 @@ class Noalyss_User
}
/**
* Check if the profile of the user can write for this profile
* @brief Check if the profile of the user can write for this profile
* @param $dtoc action_gestion.ag_id
* @return true if he can write otherwise false
*/
@ -1548,7 +1528,7 @@ class Noalyss_User
}
/**
* Check if the profile of the user can write AND delete for this profile
* @brief Check if the profile of the user can write AND delete for this profile
* @param $dtoc action_gestion.ag_id
* @return true if he can write otherwise false
*/
@ -1567,7 +1547,7 @@ class Noalyss_User
}
/**
* Check if the profile of the user can write for this profile
* @brief Check if the profile of the user can write for this profile
* @param $dtoc action_gestion.ag_id
* @return true if he can write otherwise false
*/
@ -1585,7 +1565,7 @@ class Noalyss_User
}
/**
* Check if the profile of the user can write for this repository
* @brief Check if the profile of the user can write for this repository
* @param $p_repo stock_repository.r_id
* @return true if he can write otherwise false
*/
@ -1606,7 +1586,7 @@ class Noalyss_User
}
/**
* Check if the profile of the user can read for this repository
* @brief Check if the profile of the user can read for this repository
* @param $p_repo stock_repository.r_id
* @return true if he read write otherwise false
*/
@ -1658,7 +1638,7 @@ class Noalyss_User
}
/**
* Save the password from PREFERENCE MODULE
* @brief Save the password from PREFERENCE MODULE
* @param type $p_email
*/
function save_email($p_email)
@ -1669,7 +1649,7 @@ class Noalyss_User
}
/**
* Remove a user and all his privileges
*@brief Remove a user and all his privileges
* So it cannot connect anymore and all his privileges are removed from
* the dossier
*
@ -1695,7 +1675,7 @@ class Noalyss_User
}
/**
* Grant access to folder, grant administrator profile , all the ledgers and all the action
* @brief Grant access to folder, grant administrator profile , all the ledgers and all the action
*
*/
static function grant_admin_access($p_login, $p_dossier)
@ -1767,7 +1747,7 @@ class Noalyss_User
}
/**
* Check the security on ledger for the user , it returns 1 if the security
* @brief Check the security on ledger for the user , it returns 1 if the security
* on ledgers is enabled, otherwise 0
*/
function get_status_security_ledger()
@ -1780,7 +1760,7 @@ class Noalyss_User
}
/**
* Set the flag in the table user_active_security
* @brief Set the flag in the table user_active_security
* @param int $p_value 1==enable , 0 = disable
* @exceptions invalid value
*/

View file

@ -63,12 +63,39 @@ class Package_Template extends Package_Noalyss
$cn->exec_sql($sql);
$newdb=new Database($seq, 'mod');
$sql_trigger_activate="
create or replace procedure public.trigger_activate(to_enable bool)
language plpgsql
as
$$
declare
rec1 record;
cmd text;
begin
for rec1 in (select relname,nspname
from pg_catalog.pg_class pc join pg_catalog.pg_namespace pn on (pn.oid=pc.relnamespace)
where pn.nspname in ('public','comptaproc') and relhastriggers is true) loop
if to_enable is false then
cmd=format('alter table %s.%s disable trigger all',rec1.nspname,rec1.relname);
else
cmd=format('alter table %s.%s enable trigger all',rec1.nspname,rec1.relname);
end if;
execute cmd;
raise notice '%',cmd;
end loop;
end
$$;
";
$newdb->exec_sql($sql_trigger_activate);
// Execute SQL Script
$newdb->execute_script($tmpdir.'/schema.sql');
$newdb->exec_sql("call public.trigger_activate(false) ");
$newdb->execute_script($tmpdir.'/data.sql');
$newdb->execute_script($tmpdir.'/constraint.sql');
$newdb->exec_sql("call public.trigger_activate(true) ");
$newdb->exec_sql("drop procedure public.trigger_activate ");
// Register into account_repository, we add the seq number for avoiding duplicate
$description = sprintf(_("Installé le %s"),date("d-m-Y h:i:s"));
$cn->exec_sql(" insert into modeledef (mod_id,mod_name,mod_desc) values ($1,$2,$3)",

View file

@ -29,6 +29,7 @@
* @class PDFLand
* @brief PDF in landscape mode
*/
#[\AllowDynamicProperties]
class PDFLand extends PDF
{

View file

@ -363,9 +363,9 @@ class PDF_Operation extends PDF {
$width=25;
$this->pdf->SetFillColor(220,221,255);
for ($i = 0; $i<$nb; $i++) {
$this->pdf->write_cell($width,8,$pa_plan[$i]['pa_name'],1,"C",1);
$this->pdf->write_cell($width,8,$pa_plan[$i]['pa_name']);
}
$this->pdf->write_cell($width,8,_('Montant'),1,"C",1);
$this->pdf->write_cell($width,8,_('Montant'),0,0,'R');
$this->pdf->SetFillColor(0,0,0);
$this->pdf->line_new(8);
}
@ -411,10 +411,10 @@ class PDF_Operation extends PDF {
if ($old_row['oa_row']!=$current_row['oa_row']) {
if($idx_plan!=0) {
for ($e = $idx_plan; $e<$cnt_plan; $e++)
$this->pdf->write_cell($width, 8, "", 1, "C", 0);
$this->pdf->write_cell($width, 8, "", 1,0, "c", 0);
}
// print last column
$this->pdf->write_cell($width, 8, nbm($old_row["signed_amount"],2), 1, "R", 0);
$this->pdf->write_cell($width, 8, nbm($old_row["signed_amount"],2), 1,0, "R", 0);
// Add to total
$tot_anc= bcadd($tot_anc, $old_row["signed_amount"]);
// we start a new line
@ -423,17 +423,17 @@ class PDF_Operation extends PDF {
$idx_plan = 0;
}
if ($current_row['pa_id']==$pa_plan[$idx_plan]['pa_id']) {
$this->pdf->write_cell($width, 8, $current_row['po_name'], 1, "L", 0);
$this->pdf->write_cell($width, 8, $current_row['po_name'], 1,0, "L", 0);
} else {
// print the post code in the right column
for ($e = $idx_plan; $e<$cnt_plan; $e++) {
if ($current_row['pa_id']==$pa_plan[$e]['pa_id']) {
$this->pdf->write_cell($width, 8, $current_row['po_name'], 1, "L", 0);
$this->pdf->write_cell($width, 8, $current_row['po_name'], 1, 0,"L", 0);
$idx_plan=$e;
// $idx_plan--;
break;
} else {
$this->pdf->write_cell($width, 8, "", 1, "C", 0);
$this->pdf->write_cell($width, 8, "", 1,0, "c", 0);
}
}
}
@ -444,9 +444,9 @@ class PDF_Operation extends PDF {
// End
// print last column
if($idx_plan!=0) {
$this->pdf->write_cell($width, 8, "", 1, "C", 0);
$this->pdf->write_cell($width, 8, "", 1,0, "C", 0);
}
$this->pdf->write_cell($width, 8,nbm($old_row["signed_amount"],2), 1, "R", 0);
$this->pdf->write_cell($width, 8,nbm($old_row["signed_amount"],2), 1, 0,"R", 0);
$this->pdf->line_new(8);
// Add to total
@ -454,14 +454,14 @@ class PDF_Operation extends PDF {
// Total
$this->pdf->write_cell(40, 6,_("Comptabilité"));
$this->pdf->write_cell(40, 6,nbm($row_jrnx["j_montant"],2),"","R",0);
$this->pdf->write_cell(40, 6,nbm($row_jrnx["j_montant"],2),0,0,"r",0);
$this->pdf->line_new();
$this->pdf->write_cell(40, 6,_("Analytique"));
$this->pdf->write_cell(40, 6,nbm($tot_anc,2),"","R",0);
$this->pdf->write_cell(40, 6,nbm($tot_anc,2),0,0,"r",0);
$this->pdf->line_new();
$this->pdf->write_cell(40, 6,_("Diff"));
$this->pdf->write_cell(40, 6,nbm( bcsub($row_jrnx['j_montant'], $tot_anc),2),0,"R",0);
$this->pdf->write_cell(40, 6,nbm( bcsub($row_jrnx['j_montant'], $tot_anc),2),0,0,"R",0);
$this->pdf->line_new();
}

View file

@ -27,6 +27,7 @@
* and op_def_detail
*
*/
#[AllowDynamicProperties]
class Pre_operation
{
private $db; /*!< $db database connection */
@ -516,12 +517,17 @@ class Pre_operation
}
}
/*!\brief mother of the pre_op_XXX, it contains only one data : an
/*!
@class
@brief mother of the pre_op_XXX, it contains only one data : an
* object Pre_Operation. The child class contains an array of
* Pre_Operation object
*
*/
#[AllowDynamicProperties]
class Pre_operation_detail
{
protected $db;
function __construct($p_cn)
{
$this->db=$p_cn;

View file

@ -50,7 +50,7 @@ class Tag
}
/**
* Show the list of available tag
* @brief Show the list of available tag
* @return HTML
*/
function show_list()
@ -61,7 +61,7 @@ class Tag
}
/**
* Display a inner window with the detail of a tag
* @brief Display a inner window with the detail of a tag
*/
function form_add()
{
@ -93,7 +93,7 @@ class Tag
$this->data->delete();
}
/***
* query the active tag and returns the database handler
*@brief query the active tags and returns the database handler
*/
function query_active_tag()
{
@ -104,6 +104,19 @@ class Tag
select tg_id,tg_name ,'G','g' ,1 from tag_group order by 2");
return $ret;
}
/**
* @brief return the HTML string display the tag
* @returns HTML string
*/
function display()
{
$data=$this->get_data();
$ret="";
$ret.=sprintf ('<span id="tagdis_%s" class="tagcell tagcell-color%s">',$data->t_id,$data->t_color);
$ret.= h($data->t_tag);
$ret.= '</span>';
return $ret;
}
}
?>

View file

@ -40,7 +40,7 @@ class Tag_Action extends Tag
}
/**
* let select a tag to add
* @brief let select a tag to add
*/
function select($p_prefix="")
{
@ -49,7 +49,7 @@ class Tag_Action extends Tag
}
/**
* Show a button to select tag for Search
* @brief Show a button to select tag for Search
* @return HTML
*/
static function select_tag_search($p_prefix)
@ -61,7 +61,7 @@ class Tag_Action extends Tag
}
/**
* clear the search cell
* @brief clear the search cell
*/
static function add_clear_button($p_prefix)
{
@ -71,7 +71,7 @@ class Tag_Action extends Tag
}
/**
* In the screen search add this data to the cell
*@brief In the screen search add this data to the cell
*/
function update_search_cell($p_prefix)
{
@ -85,7 +85,7 @@ class Tag_Action extends Tag
}
/**
* let select a tag to add to the search
* @brief let select a tag to add to the search
*/
function select_search($p_prefix,$title=true)
{

View file

@ -0,0 +1,185 @@
<?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
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu 26/07/24
/*!
* \file
* \brief detail of TVA_CODE for a specific ledger and periode
*/
class Tax_Detail
{
protected $from; //!< Start date
protected $to; //!< end date
protected $tva_code; //!< tva_code
protected $ledger_id; //!< ledger_id (jrn_def.jrn_def_id) -1, means all ledger Sale + Purchase
function __construct($tva_code,$from,$to,$ledger_id) {
$this->tva_code=$tva_code;
$this->from=$from;
$this->to=$to;
$this->ledger_id=$ledger_id;
}
/**
* @brief display a form for giving tva_code and dates
* @return void
*/
static function display_form()
{
require_once NOALYSS_TEMPLATE."/tax_detail-display_form.php";
}
/**
* @brief get data
*/
function get_data()
{
global $g_user,$cn;
$filter_ledger=" where ";
// Security
if ($g_user->get_status_security_ledger()==1 && $g_user->isAdmin()==0) {
$sSecurity=$g_user->get_ledger_sql('ALL')." and ";
$sSecurity=str_replace('jrn_def_id','v1.jr_def_id',$sSecurity);
$filter_ledger.=$sSecurity;
}
// filter on the date
$filter_ledger.=" jr_date >= to_date ($1,'DD.MM.YYYY') and jr_date <= to_date($2,'DD.MM.YYYY')";
// SQL index of array for array used in DatabaseCore::get_array
$param_idx=3;
$aParameter=array($this->from,$this->to);
// filter on vat_code
if ( !empty($this->tva_code ) )
{
$acc_tva=Acc_Tva::build($cn, $this->tva_code);
$filter_ledger.=" and tva_opid = \$$param_idx ";
$aParameter[]=$acc_tva->tva_id;
$param_idx++;
}
// filter on the ledger
if ( $this->ledger_id <> -1 ) {
$filter_ledger.= " and jr_def_id = \$$param_idx";
$param_idx++;
$aParameter[]=$this->ledger_id;
}
$sql="
with v_amount_tva as (select
f_id
,j_qcode
,case when j_debit is true then 0-j_montant else j_montant end j_montant
, qp_vat_code tva_opid
, 0-qp_nd_tva qp_nd_tva
, 0-qp_nd_tva_recup qp_nd_tva_recup
, 0-qp_dep_priv qp_dep_priv
, qp_vat_sided
, j_poste
, j_debit
, j_text
, jr2.jr_id
, jr2.jr_pj_number
, jr2.jr_internal
,jr2.jr_date
,to_char(jr2.jr_date,'DD.MM.YY') str_date
,jr_def_id
,0-qp_vat vat_amount
from jrnx jr1
join jrn jr2 on (jr1.j_grpt = jr2.jr_grpt_id)
join quant_purchase q1 using (j_id)
union all
select f_id
,j_qcode
,case when j_debit is true then 0-j_montant else j_montant end
, qs_vat_code
, 0
, 0
, 0
, 0
, j_poste
, j_debit
, j_text
, jr4.jr_id
, jr4.jr_pj_number
, jr4.jr_internal
,jr4.jr_date
,to_char(jr4.jr_date,'DD.MM.YY')
,jr_def_id
,qs_vat
from jrnx jr3
join jrn jr4 on (jr3.j_grpt = jr4.jr_grpt_id)
join quant_sold qs using (j_id)
)
select *, tva_label,format ('%s (%s)',t1.tva_code ,t1.tva_label) tva_code,tva_rate
from v_amount_tva v1
join tva_rate t1 on (v1.tva_opid=t1.tva_id)
$filter_ledger
order by jr_date,j_debit
";
$data=$cn->get_array($sql,$aParameter);
return $data;
}
/**
* @brief display the result in HTML
* @return void
*/
function html() {
global $data;
$data=$this->get_data();
require NOALYSS_TEMPLATE."/tax_detail-html.php";
}
function button_export_csv()
{
require NOALYSS_TEMPLATE."/tax_detail-button_export_csv.php";
}
/**
* @brief export the result in a CSV file
*/
function csv() {
$noalyss_csv=new Noalyss_Csv(sprintf("tax_detail-{$this->tva_code}-{$this->from}-{$this->to}"));
$data=$this->get_data();
$header=["date",'piece',"fiche","poste","base","privé","code tva","taux","montant tva","non deductible","recup"];
$noalyss_csv->send_header();
$noalyss_csv->write_header($header );
foreach ($data as $item) {
$noalyss_csv->add($item['str_date']);
$noalyss_csv->add($item['jr_pj_number']);
$noalyss_csv->add($item['jr_internal']);
$noalyss_csv->add($item['j_qcode']);
$noalyss_csv->add($item['j_poste']);
$noalyss_csv->add(nb($item['j_montant'],2),"number");
$noalyss_csv->add(nb($item['qp_dep_priv'],2),"number");
$noalyss_csv->add($item['tva_code']);
$noalyss_csv->add(nb($item['tva_rate'],2),"number");
$noalyss_csv->add(nb($item['vat_amount'],2),"number");
$noalyss_csv->add(nb($item['qp_nd_tva'],2),"number");
$noalyss_csv->add(nb($item['qp_nd_tva_recup'],2),"number");
$noalyss_csv->write();
}
}
}

View file

@ -67,7 +67,6 @@ class Tax_Summary
public function get_db()
{
return $this->db;
return $this;
}
/**
@ -85,7 +84,6 @@ class Tax_Summary
public function get_date_start()
{
return $this->date_start;
return $this;
}
/**
@ -105,7 +103,7 @@ class Tax_Summary
public function get_date_end()
{
return $this->date_end;
return $this;
}
/**
@ -240,9 +238,9 @@ class Tax_Summary
return $sql;
}
/**
* Build the SQL for sale vat
* @brief Build the SQL for sale vat
*
* @param group by ledger
* @param $p_group_ledger bool true group by ledgers
*
* @return string
*
@ -322,19 +320,20 @@ class Tax_Summary
$sql=$this->build_sql_sale(TRUE);
$sql.="
select jrn_def_name,
tva_label ,
tva_code ||' ('||tva_rate.tva_label||')' tva_label,
qs_vat_code,
tva_rate,
tva_both_side,
amount_vat,
amount_wovat,
amount_sided,
tva_payment_sale as tva_type
tva_payment_sale as tva_type,
jrn_def.jrn_def_id
from
detail_tva
join tva_rate on (tva_rate.tva_id=qs_vat_code)
join jrn_def on (jrn_def.jrn_def_id=j_jrn_def)
order by jrn_def_name,tva_label";
order by jrn_def.jrn_def_id,jrn_def_name, tva_code ||' ('||tva_rate.tva_label||')'";
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
return $array;
@ -348,7 +347,7 @@ class Tax_Summary
{
$sql=$this->build_sql_purchase(TRUE)."
select jrn_def_name,
tva_label ,
tva_code ||' ('||tva_rate.tva_label||')' tva_label,
tva_rate,
tva_both_side,
qp_vat_code,
@ -358,12 +357,13 @@ class Tax_Summary
amount_noded_amount,
amount_noded_tax,
amount_noded_return,
amount_private
amount_private,
jrn_def.jrn_def_id
from
detail_tva
join tva_rate on (tva_rate.tva_id=qp_vat_code)
join jrn_def on (jrn_def.jrn_def_id=j_jrn_def)
order by jrn_def_name,tva_label";
order by jrn_def.jrn_def_id,jrn_def_name, tva_code ||' ('||tva_rate.tva_label||')'";
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
return $array;
}
@ -375,7 +375,7 @@ class Tax_Summary
{
$sql=$this->build_sql_sale(FALSE);
$sql.="select
tva_label ,
tva_code ||' ('||tva_rate.tva_label||')' tva_label,
qs_vat_code,
tva_rate,
tva_both_side,
@ -386,20 +386,20 @@ class Tax_Summary
from
detail_tva
join tva_rate on (tva_rate.tva_id=qs_vat_code)
order by tva_label";
order by tva_code ||' ('||tva_rate.tva_label||')'";
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
return $array;
}
/**
* Summary for all purchase ledger
* @brief Summary for all purchase ledgers
*/
function get_summary_purchase()
{
$sql=$this->build_sql_purchase(FALSE)."
select
tva_label ,
tva_code ||' ('||tva_rate.tva_label||')' tva_label,
tva_rate,
tva_both_side,
qp_vat_code,
@ -413,7 +413,7 @@ class Tax_Summary
from
detail_tva
join tva_rate on (tva_rate.tva_id=qp_vat_code)
order by tva_label";
order by tva_code ||' ('||tva_rate.tva_label||')'";
$array=$this->db->get_array($sql, [$this->date_start, $this->date_end]);
return $array;
@ -464,4 +464,24 @@ class Tax_Summary
echo '</form>';
}
/**
* @brief Build a link to show the detail of a VAT ID
* @param $dateStart date from format 'DD.MM.YYYY'
* @param $DateeEd date to format 'DD.MM.YYYY'
* @param $nLedger_id integer JRN_DEF.JRN_DEF_ID
* @param $nVAT_id integer TVA_RATE.TVA_ID
* @return javascript string
*/
function build_link_detail($dossier_id,$dateStart,$DateeEd,$nLedger_id,$nVAT_id)
{
$js=sprintf("tax_detail_view('%s','%s','%s','%s','%s')",
$dossier_id,$this->date_start,$this->date_end,$nLedger_id,$nVAT_id);
return $js;
}
}

View file

@ -148,19 +148,20 @@ EOF;
$cn=Dossier::connect();
$dossier_id=Dossier::id();
$objname=$this->get_object_name();
$a_attribut=$cn->get_array("select ad_id,ad_text,ad_type from attr_min join attr_def using (ad_id) where frd_id=$1 order by 2",
$a_attribut=$cn->get_array("select ad_id,ad_text,ad_type,a1.ad_default_order from attr_min a1 join attr_def using (ad_id) where frd_id=$1 order by a1.ad_default_order",
[$this->table->frd_id]);
$nb_attribut=count($a_attribut);
printf('<ul id="%s_list"> ', $objname);
printf('<ul class="list-unstyled" style="width: 60%%;margin-left: 21%%" id="%s_list"> ', $objname);
$used=$cn->get_value("select count(*) from jnt_fic_attr join fiche_def using (fd_id) where frd_id=$1",
[$this->table->frd_id]);
if ($used!=0)
{
echo _("Catégorie utilisée, les attributs ne peuvent pas être modifiés");
echo_warning( _("Catégorie utilisée, les attributs de base ne peuvent pas être modifiés"));
}
echo _("Vous pouvez modifier l'ordre des attributs avec la souris");
for ($i=0; $i<$nb_attribut; $i++)
{
printf('<li id="%s_elt%d">', $objname
printf('<li id="%s_elt%d" style="cursor:move;border:1px solid navy;padding : 0.5rem 0.2rem 0.5rem 0.2rem;margin-top:2px">', $objname
, $a_attribut[$i]['ad_id']);
echo $a_attribut[$i]['ad_text'];
// cannot delete NAME and QUICKCODE + attribute used in a
@ -193,22 +194,51 @@ EOF;
$dossier_id, $this->table->frd_id, $objname);
echo Icon_Action::icon_add(uniqid(), $js_script);
}
echo \HtmlInput::hidden("attribut_order", "");
echo create_script("Sortable.create('{$objname}_list',{
onUpdate:function(){document.getElementById('attribut_order').value=Sortable.serialize('{$objname}_list')}})");
}
}
/**
* When adding a template of category of card, the minimum is the name
* @brief When adding a template of category of card, the minimum is the name
* and the quickcode, which must be added into attr_min
*/
function add_mandatory_attr()
{
$cn=Dossier::connect();
$frd_id=$this->get_table()->getp("frd_id");
$cn->exec_sql("insert into attr_min (frd_id,ad_id,ad_default_order) values ($1,$2)",
[$frd_id, ATTR_DEF_NAME],1);
$cn->exec_sql("insert into attr_min (frd_id,ad_id) values ($1,$2)",
[$frd_id, ATTR_DEF_NAME]);
$cn->exec_sql("insert into attr_min (frd_id,ad_id) values ($1,$2)",
[$frd_id, ATTR_DEF_QUICKCODE]);
[$frd_id, ATTR_DEF_QUICKCODE,10000]);
}
/**
* @brief save also the order
* @return void
*/
function save()
{
parent::save();
$cn=$this->get_table()->get_cn();
$table_sql=$this->get_table();
$http=new HttpInput();
$ctl=$http->request("ctl")."_list";
$attribut_order=$http->post('attribut_order','string','');
if ($attribut_order=='') return;
parse_str($attribut_order,$aOrder);
if ( isset($aOrder[$ctl])) {
$order = 10;
foreach( $aOrder[$ctl] as $item) {
$ad_id = str_replace('elt','',$item);
$cn->exec_sql("update attr_min set ad_default_order = $1 where ad_id=$2 and frd_id=$3",
[$order,$ad_id,$table_sql->get('frd_id')]);
$order+=10;
}
}
}
}

View file

@ -47,12 +47,15 @@ class Tva_Rate_MTable extends Manage_Table_SQL
{
parent::__construct($p_table);
$this->set_col_label("tva_id", _("id"));
$this->set_col_label("tva_code", _("Code"));
$this->set_col_label("tva_label", _("label"));
$this->set_col_label("tva_rate", _("taux"));
$this->set_col_label("tva_comment", _("Description"));
$this->set_col_label("tva_both_side", _("Autoliquidation"));
$this->set_col_label("tva_sale", _("TVA Vente (C)"));
$this->set_col_label("tva_purchase", _("TVA Achat (D)"));
$this->set_col_type("tva_both_side", "select",
array(
["value"=>0, "label"=>_("Non")],
@ -152,7 +155,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
$text->set_attribute('jrn', 0);
$text->set_attribute('account', 'tva_purchase');
echo $text->input();
$url="do.php?".http_build_query(array("gDossier"=>Dossier::id(),"ac"=>'CFGPCMN','p_start'=>4));
$url="do.php?".http_build_query(array("gDossier"=>Dossier::id(),"ac"=>'C0PCMN','p_start'=>4));
echo HtmlInput::anchor(_("Configuration poste comptable"),$url,"",'target="_blank"');
}
elseif ($key=='tva_sale')
@ -201,7 +204,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
*/
function save()
{
if ( $this->previous_id == null ) {
if ( $this->previous_id === null ) {
throw new \Exception ("TVA184: no previous TVA id");
}
$cn=Dossier::connect();
@ -223,6 +226,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
$tva_rate=new Tva_rate_SQL($cn);
$tva_rate->setp("tva_id",$new_tva_id);
$tva_rate->setp("tva_rate", $this->table->tva_rate);
$tva_rate->setp("tva_code", $this->table->tva_code);
$tva_rate->setp("tva_label", $this->table->tva_label);
$tva_rate->setp("tva_comment", $this->table->tva_comment);
$tva_rate->setp("tva_both_side", $this->table->tva_both_side);
@ -254,11 +258,11 @@ class Tva_Rate_MTable extends Manage_Table_SQL
function check()
{
$cn=Dossier::connect();
if ( $this->previous_id == null ) {
if ( $this->previous_id === null ) {
throw new \Exception ("TVA184: no previous TVA id");
}
// both accounting can not be empty
if (trim($this->table->tva_purchase)==""&&trim($this->table->tva_sale)=="")
if (trim($this->table->tva_purchase??"")==""&&trim($this->table->tva_sale??"")=="")
{
$this->set_error("tva_purchase",
_("Les 2 postes comptables ne peuvent être nuls"));
@ -267,7 +271,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
}
// Check the tva rate
if (trim($this->table->tva_rate)==""||isNumber($this->table->tva_rate)==0||$this->table->tva_rate>1)
if (trim($this->table->tva_rate??"")==""||isNumber($this->table->tva_rate)==0||$this->table->tva_rate>1)
{
$this->set_error("tva_rate", _("Taux de TVA invalide"));
}
@ -281,7 +285,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
}
// Check accounting exists for purchase
if (trim($this->table->tva_purchase)!=""&&$this->table->tva_purchase!="#")
if (trim($this->table->tva_purchase??"")!=""&&$this->table->tva_purchase!="#")
{
$count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1",
[$this->table->tva_purchase]);
@ -291,7 +295,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
}
}
// Check accounting exists for sale
if (trim($this->table->tva_sale)!=""&&$this->table->tva_sale!="#")
if (trim($this->table->tva_sale??"")!=""&&$this->table->tva_sale!="#")
{
$count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1",
[$this->table->tva_sale]);
@ -307,6 +311,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
$this->set_error("tva_both_side", _("Choix incorrect"));
}
$flag = true;
// Check that tva_id is a integer not a float (TVA_ID is an integer)
if ( isNumber($this->table->tva_id) == 0 || $this->table->tva_id != round($this->table->tva_id) )
{
$this->set_error("tva_id",_("Valeur invalide"));
@ -317,8 +322,24 @@ class Tva_Rate_MTable extends Manage_Table_SQL
{
$this->set_error("tva_id",_("Code TVA déjà utilisé"));
}
// Check that tva_id is a integer not a float
// Check that tva code is unique and remove not letter
$this->table->tva_code=strtoupper(trim( $this->table->tva_code));
$tva_code=$this->table->tva_code;
$tva_code=strtoupper($tva_code);
$tva_code=preg_replace("/[A-Z]/", "", $tva_code);
$tva_code=preg_replace("/[0-9]/", "", $tva_code);
if (strlen($tva_code)>0){
$this->set_error("tva_code", _("code tva : Uniquement des chiffres et des lettres"));
}
if (strlen($this->table->tva_code)>5){
$this->set_error("tva_code", _("code tva : Maximum 5 caractères"));
}
if (isNumber($this->table->tva_code) == 1){
$this->set_error("tva_code", _("code tva : doit aussi contenir des lettres"));
}
if ($this->count_error()!=0)
return false;
return true;

View file

@ -151,8 +151,9 @@ if (isset($_POST['record']))
}
catch (Exception $e)
{
echo '<p class="notice">'.
echo '<p class="error">'.
_('Opération non extournée').
" ".
$e->getMessage().
'</p>';
}

View file

@ -25,10 +25,10 @@
global $version_noalyss;
// version
define('NOALYSS_VERSION', 9206 );
define('NOALYSS_VERSION', 9300 );
// Database schema version
define("DBVERSION", 196);
define("DBVERSION", 200);
// version for MONO_DATABASE
define("MONO_DATABASE", 25);
@ -100,6 +100,8 @@ $g_failed = "<span style=\"font-size:18px;color:red\">&#x2716;</span>";
$g_succeed = "<span style=\"font-size:18px;color:green\">&#x2713;</span>";
define('SMALLX', '#xe816;');
define('BUTTONADD', "&#10010;");
define('ICON_SEARCH', '&#x1F50E;');
define('ICON_CLEAN', '&#x2715;');
// If noalyss_version is not defined it is likely directly taken from
// git and so this variable is not set, this cause some issue
@ -404,7 +406,8 @@ function noalyss_class_autoloader($class)
"htmlinput" => "lib/html_input.class.php",
'noalyss\dbg'=>"lib/dbg.php",
'noalyss\file_cache'=>"lib/file_cache.class.php",
"pdfland"=>"class/pdf_land.class.php"
"pdfland"=>"class/pdf_land.class.php",
"noalyss\widget\widget"=>"widget/widget.php"
);
if (isset ($aClass[$class])) {
require_once NOALYSS_INCLUDE . "/" . $aClass[$class];

View file

@ -41,7 +41,7 @@ catch (Exception $ex)
$cn=Dossier::connect();
echo '<p class="info">'.
'<a href="https://wiki.noalyss.eu/doku.php?id=menu:cfgaction" target="_blank">'.
_("Aide : voir CFGACTION").
_("Aide : voir C0ACT").
'</a>'.
'</p>';
// document_option id from document_option where do_code='contact_multiple' and document_type_id=p_id

View file

@ -4,21 +4,13 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
*@file
*@brief Dashboard
*/
require_once NOALYSS_INCLUDE.'/constant.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/user_menu.php';
echo '<div class="content">';
global $g_user;
/* others report */
$cal=new Calendar();
$cal->get_preference();
$obj=sprintf("{gDossier:%d,invalue:'%s',outdiv:'%s','distype':'%s'}",
dossier::id(),'per','calendar_zoom_div','cal');
require_once NOALYSS_TEMPLATE.'/dashboard.php';
echo \HtmlInput::button_action(_('Personnaliser le tableau de bord'), "widget.manage()");
?>
<script>
var widget=new Widget('<?=\Dossier::id()?>')
</script>

View file

@ -50,6 +50,7 @@ class Tva_Rate_SQL extends Table_Data_SQL
, "tva_both_side"=>"tva_both_side"
,"tva_payment_purchase"=>"tva_payment_purchase"
,"tva_payment_sale"=>"tva_payment_sale"
,"tva_code"=>"tva_code"
);
/*
* Type of columns
@ -63,7 +64,7 @@ class Tva_Rate_SQL extends Table_Data_SQL
, "tva_both_side"=>"numeric"
,"tva_payment_purchase"=>"text"
,"tva_payment_sale"=>"text"
,"tva_code"=>"text"
);

View file

@ -42,6 +42,7 @@ class V_Tva_Rate_SQL extends Table_Data_SQL
*/
$this->name=array(
"tva_id"=>"tva_id"
,'tva_code'=>"tva_code"
, "tva_label"=>"tva_label"
, "tva_rate"=>"tva_rate"
, "tva_comment"=>"tva_comment"
@ -50,13 +51,14 @@ class V_Tva_Rate_SQL extends Table_Data_SQL
, "tva_both_side"=>"tva_both_side"
,'tva_payment_purchase'=>'tva_payment_purchase'
,'tva_payment_sale'=>'tva_payment_sale'
);
/*
* Type of columns
*/
$this->type=array(
"tva_id"=>"numeric"
,'tva_code'=>'text'
, "tva_label"=>"text"
, "tva_rate"=>"numeric"
, "tva_comment"=>"text"

View file

@ -23,7 +23,7 @@
*/
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
if ( $g_user->check_module("CFGDOC") == 0 ) exit();
if ( $g_user->check_module("C0DOC") == 0 ) exit();
// retrieve the document
$r=$cn->exec_sql("select md_id,md_lob,md_filename,md_mimetype
from document_modele where md_id=$1",array($_REQUEST['md_id']));

View file

@ -57,7 +57,7 @@ if ($histo == 4 || $histo==5)
$fd=new Fiche_Def($cn,$http->request('cat'));
if ($allcard==1 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false )
{
$pdf->write_cell(0,10, "Cette catégorie n'ayant pas de poste comptable n'a pas de balance");
$pdf->write_cell(0,10, _("Cette catégorie n'a pas de poste comptable"));
//Save PDF to file
$fDate=date('dmy-Hi');
$pdf->Output("category-$fDate.pdf", 'D');
@ -86,7 +86,7 @@ if ($histo == 4 || $histo==5)
$name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',array($afiche[$e]['fd_id']));
$pdf->SetFont('DejaVu','BI',14);
$pdf->write_cell(0,8,$name,0,1,'C');
$pdf->line_new();
$pdf->SetFont('DejaVuCond','',7);
$pdf->LongLine(30,7,'Quick Code',0,'L',0);
$pdf->LongLine(80,7,'Libellé',0,'L',0);

View file

@ -40,7 +40,7 @@ $cn=Dossier::connect();
$ret="";
$pdf= new PDF($cn);
$pdf->setDossierInfo(" Periode : ".$from_periode." - ".$to_periode);
$pdf->setDossierInfo(" Periode : ".$from_periode." - ".$to_periode);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetAuthor('NOALYSS');
@ -50,7 +50,7 @@ $pdf->setTitle(_("Détail fiche"),true);
$Fiche=new Fiche($cn,$f_id);
$operation=new Acc_Operation($cn);
list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date($from_periode,$to_periode,$_GET['ople']);
list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date($from_periode,$to_periode,$http->get('ople'));
// don't print empty account
if ( count($array) == 0 )
{

View file

@ -0,0 +1,40 @@
<?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
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu 27/07/24
/*!
* \file
* \brief export in CSV detail of tax
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
$http=new \HttpInput();
try {
$tax_detail=new Tax_Detail(
$http->get("vat_code"),
$http->get("from"),
$http->get("to"),
$http->get("p_jrn")
);
} catch (\Exception $e) {
echo $e->getMessage();
return;
}
$tax_detail->csv();

View file

@ -24,7 +24,7 @@
* \file
*
*
* \brief
* \brief display history of accountant , and let search into
*
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');

View file

@ -46,9 +46,9 @@ if ( ! isset ($_GET['verif']))
/*
* Let you change the exercice
*/
echo '<fieldset><legend>'._('Exercice').'</legend>';;
echo '<fieldset>';;
echo '<form method="GET" onsubmit="return waiting_box()">';
echo _('Choisissez un autre exercice');
echo _('Choisissez un exercice');
$ex=new Exercice($cn);
$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"');
echo $wex->input();

Some files were not shown because too many files have changed in this diff Show more