Merge branch 'unstable' into pre-stable

* unstable: (63 commits)
  Mantis #2451: Ajouter QCode des clients et fournisseurs dans objets du tableau de bord
  Cannot save bookmark
  Cosmetic : readonly background and section payment means
  Border-color Cosmetic
  Cosmetic : readonly background and section payment means
  Border-color Cosmetic
  logfile only if SYSINFO_DISPLAY is true
  Version 10.1
  Fix cosmetic
  Cosmetic : use an icon before warning
  remove direct access to $_GET
  Postgresql 12 compatibility
  Security tigh
  New : allow to see and download logfile
  Fix Bug chrome : cannot save operation details
  FOLLOW-UP: improve appearance
  FREC : upload file properly and cancel operation if it fails
  UBL21: check invalid PEPPOL ID
  Fix :  issue when using unicode with substr
  Cosmetic message1 and fix nav-item typo
  ...
This commit is contained in:
sparkyx 2026-03-06 08:50:45 +01:00
commit 8d14ed801d
59 changed files with 812 additions and 266 deletions

View file

@ -72,13 +72,17 @@ BODY {
--bg-inner-box:#DCE1EF;
--underline-menu:#d7e8ee;
--bg-slide:#c5d5e8;
--end-level1:#eb7c7e;
--border-color:#b7b7b7;
--bg-white:white;
--bg-readonly:#f9f9f9;
}
input{
font-family: 'OpenSansRegular';
padding : 2px;
margin:2px;
border:1px solid var(--input-color);
border:1px solid var(--border-color);
background-color:var(--bg-white);
color:var(--input-color);
}
@ -111,6 +115,7 @@ p.notice,span.notice {
margin-left: 5ch;
border:1px solid transparent;
border-radius: 5px;
text-align: center;
}
.valid {
color:green;
@ -805,12 +810,12 @@ a.document:hover {
}
.input_text_ro {
border:1px solid #0000FF;
background:#EDEDED;
color:#0000FF;
background-color:var(--bg-readonly);
border-radius: 5px;
margin:1px;
}
.input_text {
border:1px solid var(--input-color);
border:1px solid var(--border-color);
margin:1px;
border-radius: 5px;
}
@ -854,9 +859,9 @@ fieldset fieldset legend {
color:#888;
}
select {
border: 1px solid #0000FF;
border: 1px solid var(--border-color);
margin:2px;
background-color:#FFFFFF;
background-color:var(--bg-white);
border-radius: 3px;
padding: 3px;
}
@ -2051,9 +2056,9 @@ td.workday ol {
}
input.inum {
text-align:right;
border:1px solid var(--input-color);
margin:2px;
border-radius: 5px;
border:1px solid var(--border-color);
}
div.box {
background-color:#e4e7ed;
@ -2089,7 +2094,7 @@ div.box {
div.box {
width: 35rem;
max-height: 30%;
height: 45vh;
height: 40rem;
}
}
@ -2186,7 +2191,7 @@ margin-left: 0px;
.inner_box li.tabs:hover ,li.tabs:hover {
display:inline;
background-color: lightblue;
color:wheat;
color:var(--bg-white);
margin-left: 2px;
padding: 5px;
border-top-left-radius: 10px;
@ -2211,7 +2216,7 @@ margin-left: 2px;
.inner_box li.tabs:hover ,li.tabs:hover {
display:inline;
background-color: lightblue;
color:wheat;
color:var(--bg-white);
margin-left: 2px;
padding: 15px 7px 10px 10px;
border-top-left-radius: 5px;
@ -2336,21 +2341,21 @@ hr {
******************************************************************************/
li.highlight,tr.highlight{
font-weight: bolder;
font-size:90%;
background-color: #8A8787;
color:whitesmoke !important;
font-size:100%;
font-size:1rem;
background-color: lightsteelblue;
color:var(--bg-white) !important;
border-width: 2px;
border-style: solid;
/*! border-color: blue; */
}
li.highlight a,tr.highlight a{
color:whitesmoke !important;
color:var(--bg-white) !important;
}
*|*:link {
color: inherit;
}
/*****************************************************************************
* Table of one column to present menu
* as in CFGLED, FORECAST, REPORT
@ -2500,6 +2505,8 @@ ul.aligned-block li {
padding: 2rem;
border:1px solid navy;
margin-right:1rem;
width: 20rem;
}
/***************************************************************************
* column in the dashboard
@ -2513,6 +2520,7 @@ td.cut {
}
td.box {
border-left: #9999ff solid 1px;
border-radius: 10px 0px;
}
/****************************************************************************
@ -2700,7 +2708,7 @@ td.selectedmenu {
.field_follow_up
{
margin-top:1px;
border:1px solid blue;
border:1px solid var(--border-color);
min-height: 5rem;
}
@ -2988,6 +2996,11 @@ div.progressbar {
/**
* Warning
*/
span.warning::before {
content: '\e806';
font-family: "fontello" !important;
font-weight:normal;
}
span.warning {
color:white;
font-style: normal;
@ -2999,6 +3012,7 @@ span.warning {
animation-duration: 4s;
animation-iteration-count: infinite;
display: block;
border-radius: 10px;
}
/**********************************************************************************************************************/
/* LI as list
@ -3062,7 +3076,7 @@ span.warning {
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;
color:var(--bg-white);
margin-left: 2px;
padding: 5px;
border-top-left-radius: 10px;
@ -3085,7 +3099,7 @@ margin-left: 2px;
li.tab_row:hover {
display:block;
background-color: lightblue;
color:wheat;
color:var(--bg-white);
margin-left: 2px;
padding: 20px 15px 15px 20px;
margin: 20px 15px 15px 15px;
@ -3781,7 +3795,7 @@ margin:1px;
div.concerned_action {
height: 11rem;
overflow: auto;
background-color: white;
background-color: var(--bg-white);
border:navy 1px solid;
width: 100%;
scroll-padding-right: 20px;
@ -3957,7 +3971,8 @@ h2.h-section {
content:'';
left:0;
bottom:0;
right:0;3 position:absolute;
right:0.3;
position:absolute;
height:var(--border-size);
background-color:red;
transform:scaleX(0);
@ -3973,8 +3988,7 @@ h2.h-section {
.nav-item.li-active.nav-item-underline::before {
transform: scale(1);
background-color: #d03100;
background-image: linear-gradient(to right,#cc0000 0%,red 20%) ;
background-image: linear-gradient(to right,darkred 0%,red 10%,red 90%,darkred);
background-image: linear-gradient(to right,var(--end-level1) 0%,red 10%,red 90%,var(--end-level1));
}
/**
@ -4171,7 +4185,7 @@ h2.h-section {
}
.topmenu .nav-item.nav-item-underline:hover::before,.topmenu .nav-item.nav-item-underline:focus::before {
transform: scaleX(1) scaleY(1);
background-image: linear-gradient(to right,darkred,red);
background-image: linear-gradient(to right,var(--end-level1),red);
}
@ -4182,7 +4196,7 @@ h2.h-section {
.topmenu .nav-item.nav-item-underline:hover::before,.topmenu .nav-item.nav-item-underline:focus::before {
transform: scaleX(1) scaleY(1);
background-image: linear-gradient(to right,darkred 0%,red 30%);
background-image: linear-gradient(to right,var(--end-level1) 0%,red 30%);
}
/*.topmenu .nav-item.nav-item-underline::before {
@ -4258,6 +4272,8 @@ span.nb-round {
.bt-center {
margin-bottom: 2rem;
float:inherit;
clear:both;
}
@ -4288,3 +4304,34 @@ span.nb-round {
#module_setting .selectedcell {
background-color:beige;
}
#facturation_div_id{
height:auto;
float:left
}
#ag_title {
width:80%;
}
#message1 {
text-align: center;
padding: 10px;
}
.inner_box div.fu_comment_div {
padding-left: 1rem;
padding-right: 1rem;
}
.field_follow_up {
padding: 1rem;
border-radius: 10px;
}
.field_follow_up {
background-color: var(--bg-white);
}

View file

@ -12,7 +12,7 @@
* 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
@ -39,7 +39,7 @@ if ( ! $g_user->is_double_identified()) {
exit();
}
$g_user->check_dossier($http->get('gDossier'));
$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")));
$res=$cn->exec_sql("select distinct code,coalesce(description,code) as 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

@ -73,6 +73,8 @@ if ( ! $cn->exist_table('version')) {
echo '</p>';
return;
}
global $level;
$level=0;
/**
* if access_mode is MOBILE than force it to mobile.php
@ -93,6 +95,7 @@ if ( DEBUGNOALYSS > 1 ) {
\Noalyss\Dbg::display_size();
\Noalyss\Dbg::display_request();
\Noalyss\Dbg::display_global();
echo "encoding";echo mb_internal_encoding();
} //<--- if DEBUG
$g_parameter=new Noalyss_Parameter_Folder($cn);
@ -322,6 +325,7 @@ else
$_GET['ac']=$default;
$_POST['ac']=$default;
$_REQUEST['ac']=$default;
show_module($menu_id);
$all[0] = $default;
show_menu($menu_id);

View file

@ -33,6 +33,7 @@ global $g_user,$cn,$g_parameter;
require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
mb_internal_encoding("UTF-8");
//
// for loading javascripts or style-sheet, it is needed to know the user
@ -49,12 +50,47 @@ if (isset ($_REQUEST['loadjs']) && $_REQUEST['loadjs']=='message')
include_once NOALYSS_INCLUDE."/lib/message_javascript.php";
return;
}
//------------------------------------------------
// Export File from ADMINISTRATION MENU
//------------------------------------------------
$hi=new HttpInput();
if ($hi->request("admin","string",0)==1 ) {
$g_user=new Noalyss_user(new Database());
if ($g_user->admin != 1)
{
$g_user->audit('FAIL', "ADMIN: export admin".var_export($_REQUEST,true));
echo_warning(_("Accès interdit"));
exit();
}
if ( $hi->get("action")=="logfile") {
$directory=dir( NOALYSS_BASE.DIRECTORY_SEPARATOR."log");
$a_file=[];
while ( $file = $directory->read()) {
if (preg_match("/noalyss.*log/", $file)) {
$a_file[]=$file;
}
}
$file=$hi->get("file");
if (! in_array($file,$a_file ) )
{
echo_warning(sprintf("%s non trouvé",$file));
return;
}
header('Content-Type: application/x-download');
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
echo file_get_contents(NOALYSS_BASE.DIRECTORY_SEPARATOR."/log/{$file}");
}
return;
}
//------------------------------------------------
// Connect the user to the current folder and export file
//------------------------------------------------
$cn=Dossier::connect();
$g_user=new Noalyss_user($cn);
$gDossier=dossier::id();
$g_parameter=new Noalyss_Parameter_Folder($cn);
mb_internal_encoding("UTF-8");
$g_user->Check();
/**
* check if 2FA is completed
@ -62,9 +98,10 @@ $g_user->Check();
if ( ! $g_user->is_double_identified()) {
exit();
}
$gDossier=dossier::id();
$g_parameter=new Noalyss_Parameter_Folder($cn);
$action=$g_user->check_dossier($gDossier);
$hi=new HttpInput();
$action=$hi->get("act");
if ( $action=='X' || $g_user->check_print($action)==0 )

View file

@ -1297,14 +1297,12 @@ function search_letter(obj) {
*/
function op_save(obj) {
try {
var queryString = id$(obj).serialize(true);
queryString ["gDossier"] = obj.gDossier.value;
var rapt2 = "rapt" + obj.whatdiv.value;
queryString ["rapt"] = id$(rapt2).value;
queryString ["jr_id"] = obj.jr_id.value;
var jr_id = obj.jr_id.value;
queryString ["div"] = obj.whatdiv.value;
var divid = obj.whatdiv.value;
var queryString = Form.serialize(obj,true);
var divid = queryString['whatdiv'];
queryString["div"] = queryString['whatdiv'];
queryString["rapt"] = id$("rapt"+divid).value;
var jr_id = queryString['jr_id'];
queryString ["act"] = "save";
queryString ["op"] = "ledger";
queryString ["jr_note"]=encodeURI(tinyMCE.get("jrn_note"+divid).getContent());
@ -1346,7 +1344,7 @@ function op_save(obj) {
}
new Ajax.Request('ajax_misc.php', {
parameters: {
'gDossier': obj.gDossier.value,
'gDossier': queryString ["gDossier"],
'act': 'de',
'op': 'ledger',
'jr_id': jr_id,
@ -1359,7 +1357,7 @@ function op_save(obj) {
id$(divid).innerHTML = unescape(getNodeText(html[0]));
id$(divid).innerHTML.evalScripts();
remove_waiting_box();
noalyss.refresh_note(jr_id,obj.gDossier.value);
noalyss.refresh_note(jr_id,queryString ["gDossier"]);
} catch (e) {
console.error("D1. op_save")
alert_box("1038" + e.message)
@ -1539,7 +1537,9 @@ function save_filter(p_div, p_dossier) {
// Get all elt from the form
for (var i = 0; i < elt.length; i++) {
var idx = elt[i];
eltValue[idx] = id$(p_div + elt[i]).value;
eltValue[idx] = null;
if ( document.getElementById(p_div+elt[i]) )
eltValue[idx]=id$(p_div + elt[i]).value;
}
if (eltValue['amount_min'] == "") eltValue["amount_min"] = 0;
@ -1602,7 +1602,9 @@ function load_filter(p_div, p_dossier, p_filter_id) {
, 'p_currency_code', 'tva_id_search'];
for (var i = 0; i < elt.length; i++) {
var idx = elt[i];
id$(p_div + idx).value = answer[elt[i]];
if ( document.getElementById(p_div + idx))
id$(p_div + idx).value = answer[elt[i]];
}
// fillup the r_jrn array
var eltLedgerId = id$("ledger_id" + p_div);

View file

@ -273,7 +273,7 @@ function search_account_card(p_obj)
onSuccess: function (req){
var pos=calcy(50);
var obj={id:"search_account_div",cssclass:"inner_box",style:"top:"+pos+"px",
var obj={id:"search_account_div",cssclass:"inner_box",style:"top:"+pos+"px;z-index:"+get_next_layer(),
html:req.responseText};
add_div(obj);
remove_waiting_box();

View file

@ -1215,7 +1215,7 @@ function modify_card(p_fiche_id)
nTop = 170;
}
var str_top = fixed_position(250, nTop)
var str_style = str_top + ";width:45em;height:auto;position:absolute";
var str_style = str_top + ";width:45em;height:auto;position:absolute"+"; z-index:"+get_next_layer();
var popup = {'id': content, 'cssclass': 'inner_box', 'style': str_style, 'html': loading(), 'drag': false};
@ -1383,7 +1383,7 @@ function linked_card_option(p_action_person_id,p_dossier) {
},
onSuccess:function(req) {
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});
add_div({ "id":"d_linked_card_option",cssclass:"inner_box",style:"position:fixed;top:30%;min-width:20rem;width:auto;z-index:"+get_next_layer(),drag:0});
id$("d_linked_card_option").update(req.responseText);
}

View file

@ -282,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:"position:fixed;top:1%;width:90%;left:5%" , cssclass: 'inner_box'});
add_div({id: 'action_list_div', style:"position:fixed;top:1%;width:90%;left:5%;z-index:"+get_next_layer() , cssclass: 'inner_box'});
$('action_list_div').innerHTML=p_xml.responseText;
var table_followup=document.getElementById('event_followup');
if ( table_followup) { sorttable.makeSortable(table_followup); }
@ -312,7 +312,7 @@ function action_add(p_dossier) {
onSuccess : function(p_xml, p_text) {
if (p_xml.responseText === 'NOCONX') { reconnect();return;}
remove_waiting_box();
add_div({id: 'action_add_div',style:'top:25px',
add_div({id: 'action_add_div',style:'top:25px;z-index:'+get_next_layer(),
cssclass: 'inner_box'});
$('action_add_div').innerHTML=p_xml.responseText;
p_xml.responseText.evalScripts();

View file

@ -25,7 +25,7 @@ function modifyModeleDocument(p_value,dossier)
id='det'+layer;
var pos_y=posY+offsetY-20;
var pos_x=posX+offsetX+40;
var style="position:absolute;top:"+pos_y+"px;left:10%;width:80%";
var style="position:absolute;top:"+pos_y+"px;left:10%;width:80%;z-index:"+get_next_layer();
var popup={'id':'mod_doc',
'cssclass':'inner_box',
'html': loading(),

View file

@ -579,7 +579,7 @@ function cat_doc_change(p_dt_id, p_dossier) {
var queryString = "gDossier=" + p_dossier + "&op=mod_cat_doc" + "&dt_id=" + p_dt_id;
var nTop = calcy(posY);
var nLeft = "200px";
var str_style = "top:" + nTop + "px;left:" + nLeft + ";width:50em;height:auto";
var str_style = "top:" + nTop + "px;left:" + nLeft + ";width:50em;height:auto"+"; z-index:"+get_next_layer();
removeDiv('change_doc_div');
waiting_box();
@ -1170,7 +1170,7 @@ function display_periode(p_dossier, p_id) {
'id': 'mod_periode',
'cssclass': 'inner_box',
'html': loading(),
'style': 'width:30em',
'style': 'width:30em'+"; z-index:"+get_next_layer(),
'drag': true
};
if (!document.getElementById('mod_periode')) {
@ -1295,7 +1295,7 @@ function fill_box(req) {
function mod_predf_op(dossier_id, od_id, p_ledger) {
var target = "mod_predf_op";
removeDiv(target);
var str_style = "top:10%;left:2%;width:96%";
var str_style = "top:10%;left:2%;width:96%;"+"; z-index:"+get_next_layer();
var div = {id: target, cssclass: 'inner_box', style: str_style, html: loading(), drag: 1};
@ -1582,7 +1582,7 @@ function mod_menu(gdossier, pm_id) {
waiting_box();
removeDiv('divdm' + pm_id);
var qs = "op=det_menu&gDossier=" + gdossier + "&pm_id=" + pm_id + "&ctl=divdm" + pm_id;
var pos = fixed_position(50, 250);
var pos = fixed_position(50, 250)+"; z-index:"+get_next_layer();
var action = new Ajax.Request('ajax_misc.php',
{
method: 'get',
@ -1690,7 +1690,7 @@ function add_menu(obj) {
waiting_box();
removeDiv('divdm' + p_id);
var pos = fixed_position(250, 150) + ";width:50%;";
var pos = fixed_position(250, 150) + ";width:50%;"+"; z-index:"+get_next_layer();
var action = new Ajax.Request('ajax_misc.php',
{
method: 'get',
@ -1736,7 +1736,7 @@ function add_plugin(p_dossier) {
onSuccess: function (req) {
try {
remove_waiting_box();
var pos = fixed_position(250, 150) + ";width:30%";
var pos = fixed_position(250, 150) + ";width:30%"+"; z-index:"+get_next_layer();
add_div({id: "divplugin", drag: 1, cssclass: "inner_box", style: pos});
id$('divplugin').innerHTML = req.responseText;
} catch (e) {
@ -1766,7 +1766,7 @@ function mod_plugin(p_dossier, me_code) {
onSuccess: function (req) {
try {
remove_waiting_box();
var pos = fixed_position(250, 150) + ";width:30%";
var pos = fixed_position(250, 150) + ";width:30%"+"; z-index:"+get_next_layer();
add_div({id: "divplugin", drag: 1, cssclass: "inner_box", style: pos});
id$('divplugin').innerHTML = req.responseText;
@ -1791,7 +1791,7 @@ function create_menu(p_dossier) {
onSuccess: function (req) {
try {
remove_waiting_box();
var pos = fixed_position(250, 150) + ";width:30%";
var pos = fixed_position(250, 150) + ";width:30%"+"; z-index:"+get_next_layer();
add_div({
id: "divmenu",
drag: 1,
@ -1820,7 +1820,7 @@ function modify_menu(p_dossier, me_code) {
onSuccess: function (req) {
try {
remove_waiting_box();
var pos = fixed_position(250, 150) + ";width:30%";
var pos = fixed_position(250, 150) + ";width:30%"+"; z-index:"+get_next_layer();
add_div({
id: "divmenu",
drag: 1,
@ -2603,7 +2603,7 @@ function show_tag(p_dossier, p_ac, p_tag_id, p_post) {
code_html = unescape_xml(code_html);
remove_waiting_box();
var posy = calcy(250);
add_div({id: 'tag_div', cssclass: 'inner_box', drag: 0, style: "position:fixed;top:15%;"});
add_div({id: 'tag_div', cssclass: 'inner_box', drag: 0, style: "position:fixed;top:15%; z-index:"+get_next_layer()});
id$('tag_div').innerHTML = code_html;
try {
code_html.evalScripts();
@ -2670,7 +2670,7 @@ function action_tag_select(p_dossier, ag_id) {
}
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
var pos = fixed_position(35, 229);
var pos = fixed_position(35, 229)+"; z-index:"+get_next_layer();
add_div({id: 'tag_div', style: pos, cssclass: 'inner_box tag', drag: 0});
remove_waiting_box();
@ -2806,7 +2806,7 @@ function search_display_tag(p_dossier, p_prefix, p_object) {
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
remove_waiting_box();
add_div({id: p_prefix + 'tag_div', style: 'left:10%;width:70%', cssclass: 'inner_box', drag: 1});
add_div({id: p_prefix + 'tag_div', style: 'left:10%;width:70%;z-index:'+get_next_layer(), cssclass: 'inner_box', drag: 1});
id$(p_prefix + 'tag_div').style.top = calcy(200) + "px"
id$(p_prefix + 'tag_div').style.left = 20 + "%";
remove_waiting_box();
@ -2966,7 +2966,7 @@ function calendar_zoom(obj) {
obj.outdiv = 'calendar_zoom_div';
}
if (id$(obj.outdiv) == undefined) {
var str_style = 'top:10%;min-height:60rem';
var str_style = 'top:10%;min-height:60rem'+"; z-index:"+get_next_layer();
// var str_style = fixed_position(0, 120);
add_div({
id: obj.outdiv,
@ -3464,7 +3464,7 @@ var Periode = function (p_ledger) {
var y = 100;
add_div({
"id": "mod_periode",
"style": "position:fixed;top:" + y + "px;width:50%",
"style": "position:fixed;top:" + y + "px;width:50%"+"; z-index:"+get_next_layer(),
"cssclass": "inner_box",
'html': "wait"
});
@ -4026,7 +4026,7 @@ var operation_tag = function (p_div) {
}
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
var pos = fixed_position(35, 229);
var pos = fixed_position(35, 229)+"; z-index:"+get_next_layer();
add_div({id: 'tag_div', style: pos, cssclass: 'inner_box tag', drag: 0});
remove_waiting_box();

View file

@ -162,18 +162,10 @@ class InvoiceUBL21 extends XMLInvoice {
$a_error[]=$value;
}
}
if ( $this->data['customer']["endpoint_id"] != "")
// check if peppol id has the form 9999:9999...
if (preg_match('/[0-9]+:[[:alnum:]]+/',$this->data['customer']["endpoint_id"]) == 0)
{
// check if peppol id has the form 9999:9999...
list($scheme_id,$peppol)=explode(":", $this->data['customer'][$value]);
if (preg_replace('/[0-9]/', '', $scheme_id) != "")
{
$a_error[]='endpoint_id';
}elseif(\noalyss_trim($peppol) =="")
{
$a_error[]='endpoint_id';
}
}
if ( $this->data['customer']["customer_vat_id"] != "" && preg_match('/[a-z]{2}/i',$this->data['customer']["customer_vat_id"] ) == false)
{
@ -235,7 +227,7 @@ class InvoiceUBL21 extends XMLInvoice {
// LegalEntity
$ple=$this->createElement('cac:PartyLegalEntity');
///@todo customer = name doit être fiche
$ple->appendChild($this->createElement("cbc:RegistrationName", $this->data['customer']['name']??"ERROR"));
$ple->appendChild($this->createElement("cbc:RegistrationName", htmlspecialchars($this->data['customer']['name'],ENT_XML1,'UTF-8')));
///@todo customer_vat_id = numéro de TVA doit être dans fiche
$ple->appendChild($this->createElement("cbc:CompanyID", $this->data['customer']['customer_vat_id']??"ERROR"));
@ -245,6 +237,31 @@ class InvoiceUBL21 extends XMLInvoice {
$customer->appendChild($customer_party);
return $customer;
}
/**
* @brief Delivery Date is mandatory for INTRACOMM , so by default
* we set the invoice date
<cac:Delivery>
<cbc:ActualDeliveryDate>
2026-01-06
</cbc:ActualDeliveryDate>
</cac:Delivery>
*/
function build_deliveryDate()
{
$delivery=$this->createElement("cac:Delivery");
$delivery->appendChild($this->createElement("cbc:ActualDeliveryDate",$this->data['issue_date']));
//(cac:Delivery/cac:DeliveryLocation/cac:Address/cac:Country/cbc:IdentificationCode//
$loc= $this->createElement("cac:DeliveryLocation");
$addr=$this->createElement('cac:Address');
$country=$this->createElement("cac:Country");
$country->appendChild($this->createElement("cbc:IdentificationCode", $this->data['customer']['country']));
$addr->appendChild($country);
$loc->appendChild($addr);
$delivery->appendChild($loc);
return $delivery;
}
/**
/**
* @brief Build XML Block for payment
* @code
@ -450,6 +467,7 @@ class InvoiceUBL21 extends XMLInvoice {
$result->appendChild($this->createElement("cbc:ID", $i));
$amount=sprintf("%.2f",$row['price']);
if ( $row['quantity'] > 0 && $amount < 0 ) $row['quantity'] =bcsub(0,$row['quantity'] ,4);
$result->appendChild(
$this->createElement("cbc:InvoicedQuantity", sprintf("%.2f",$row['quantity'])))
->setAttribute("unitCode", $row["code_quantity"]);
@ -659,6 +677,9 @@ class InvoiceUBL21 extends XMLInvoice {
// add the customer
$root->appendChild($this->build_customer());
// add delivery date
$root->appendChild($this->build_deliveryDate());
// add the payment if there is a bank account
if ( $company['COMPANY_BANK_IBAN'] != "")
$root->appendChild($this->build_paymentInfo());

View file

@ -25,6 +25,10 @@ namespace Noalyss\XMLDocument;
* @file
* @brief answer to an inplace object
*/
/**
\pure
\brief Abstract class
*/
abstract class XML_Reader
{
@ -229,6 +233,9 @@ abstract class XML_Reader
$result = [];
$result['ID'] = $this->get_node_value("//cac:AccountingCustomerParty[1]/cac:Party[1]/cbc:EndpointID[1]");
$result['name'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PartyName[1]/cbc:Name[1]');
if ($result['name'] == '') {
$result['name'] = $this->get_node_value("//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PartyLegalEntity[1]/cbc:RegistrationName[1]");
}
$result['street'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:StreetName[1]');
$result['city'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:CityName[1]');
$result['postcode'] = $this->get_node_value('//cac:AccountingCustomerParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:PostalZone[1]');
@ -247,12 +254,28 @@ abstract class XML_Reader
$result = [];
$result['ID'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cbc:EndpointID[1]");
$result['name'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyName[1]/cbc:Name[1]");
if ($result['name'] == '') {
$result['name'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyLegalEntity[1]/cbc:RegistrationName[1]");
}
$result['street'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:StreetName[1]");
$result['city'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:CityName[1]");
$result['postcode'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cbc:PostalZone[1]");
$result['country_code'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PostalAddress[1]/cac:Country[1]/cbc:IdentificationCode[1]");
$result['company_id'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyTaxScheme[1]/cbc:CompanyID[1]");
if ($result['company_id'] == "" ) {
$result['company_id'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:PartyLegalEntity[1]/cbc:CompanyID[1]");
}
$result['scheme'] = $this->get_node("//cac:AccountingSupplierParty[1]/cac:Party[1]/cbc:EndpointID[1]")[0]->getAttribute("schemeID");
/**
* get contact
<cac:Contact>
<cbc:Name>Facturation NOALYSS</cbc:Name>
<cbc:ElectronicMail>invoice@noalyss</cbc:ElectronicMail>
</cac:Contact>
*/
$result['contact_name'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:Contact[1]/cbc:Name[1]");
$result['contact_mail'] = $this->get_node_value("//cac:AccountingSupplierParty[1]/cac:Party[1]/cac:Contact[1]/cbc:ElectronicMail");
return $result;
}
@ -378,8 +401,6 @@ abstract class XML_Reader
/**
*
* @return array
* @TODODNY
* Implémenter les allowances
*/
function get_info(): array
{
@ -390,6 +411,7 @@ abstract class XML_Reader
$result['InvoiceTypeCode'] =$this->get_document_type_code();
$result['DocumentCurrencyCode'] = $this->get_node_value('cbc:DocumentCurrencyCode');
$result['BuyerReference'] = $this->get_node_value('cbc:BuyerReference');
$result['OrderReference'] = $this->get_node_value('//cac:OrderReference[1]/cbc:ID[1]');
$result['ActualDeliveryDate'] = $this->get_node_value('//cac:Delivery[1]/cbc:ActualDeliveryDate[1]');
$result['info']=array();
@ -410,6 +432,7 @@ abstract class XML_Reader
public function to_pdf(): PDF
{
//$pdf = new PDF($cn);
$pdf = new PDF();
$result = $this->get_info();
$info=$result;
@ -419,97 +442,133 @@ abstract class XML_Reader
$pdf->AddPage();
// 180 mm large
$pdf->setFont("DejaVu", "B", 16);
$pdf->write_cell(20, 10, "");
$pdf->write_cell(170, 10, _("Résumé facture"),1,0,'C');
$pdf->line_new(10);
$pdf->line_new(2);
$pdf->SetTextColor(0,0,127);
$pdf->write_cell(10, 10, "");
$pdf->write_cell(170, 10, _("Résumé document"),1,0,'C');
$pdf->line_new(20);
$pdf->Image(NOALYSS_HOME.'/image/logo10000.png', 10, 10, 20, 0, 'PNG');
$pdf->setFont("DejaVu", "", 7);
$pdf->SetTextColor(0,0,0);
$pdf->write(4, sprintf(_("Document ID %s"), $result['id']));
$pdf->ln();
$pdf->write(4, sprintf(_("Date facture %s"), $result['IssueDate']));
$pdf->ln();
$pdf->write(4, sprintf(_("Date échéance %s"), $result['DueDate']));
$pdf->ln();
$pdf->setFont("DejaVu", "B", 8);
$pdf->write_cell(20,4,_('Date'));
$pdf->print_row();
$pdf->setFont("DejaVuCond", "", 7);
$pdf->write_multi(38,4, sprintf(_(" Facture %s"), $result['IssueDate']));
$pdf->write_multi(38,4, sprintf(_("Echéance %s"), $result['DueDate']));
$pdf->write_multi(38,4, sprintf(_("Livraison %s"), $result['ActualDeliveryDate']));
$pdf->line_new();
$pdf->write(4, sprintf(_("Type et code document %s"), $result['InvoiceTypeCode']));
$pdf->ln();
$pdf->write(4, sprintf(_("Devise document %s"), $result['DocumentCurrencyCode']));
$pdf->ln();
$pdf->write(4, sprintf(_("Référence client %s"), $result['BuyerReference']));
$pdf->ln();
$pdf->write(4, sprintf(_("Date Livraison %s"), $result['ActualDeliveryDate']));
$pdf->write(4, sprintf(_("Référence commande %s"), $result['OrderReference']));
$pdf->ln(10);
$pdf->setFont("DejaVu", "B", 12);
$pdf->SetTextColor(0,0,127);
$pdf->write_cell(60, 4, _("Fournisseur"));
$pdf->line_new(12);
$pdf->line_new(6);
$supplier = $this->get_supplier();
$pdf->setFont("DejaVu", "", 7);
$pdf->write_cell(60, 4, $supplier['name']);
$pdf->write_cell(60, 4, $supplier['company_id']);
$pdf->write_cell(60, 4,$supplier['scheme'].":". $supplier['ID']);
$pdf->setFont("DejaVu", "B", 8);
$pdf->write_multi(10, 4, "");
$pdf->write_multi(150, 4, $supplier['name']);
$pdf->line_new();
$pdf->write_cell(60, 4, $supplier['street']);
$pdf->write_cell(30, 4, $supplier['postcode']);
$pdf->write_cell(60, 4, $supplier['city']);
$pdf->write_cell(20, 4, $supplier['country_code']);
$pdf->line_new(10);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVuCond", "", 7);
$pdf->write_multi(70, 4, $supplier['street']);
$pdf->write_multi(30, 4, $supplier['postcode']);
$pdf->write_multi(50, 4, $supplier['city']);
$pdf->write_cell(10, 4, $supplier['country_code']);
$pdf->line_new();
$pdf->write_cell(50, 4, $supplier['company_id']);
$pdf->write_cell(50, 4,'PEPPOL ID:'.$supplier['scheme'].":". $supplier['ID']);
$pdf->line_new();
if ( $supplier['contact_name'] != '' || $supplier['contact_mail'] != '') {
$pdf->write_multi(100, 4, "contact: ".$supplier['contact_name']." ". $supplier['contact_mail']);
$pdf->line_new();
}
$pdf->line_new(4);
$customer = $this->get_customer();
$pdf->setFont("DejaVu", "B", 12);
$pdf->SetTextColor(0,0,127);
$pdf->write_cell(60, 4, _("Client"));
$pdf->line_new(10);
$pdf->setFont("DejaVu", "", 7);
$pdf->write_cell(60, 4, $customer['name']);
$pdf->write_cell(60, 4, $customer['company_id']);
$pdf->write_cell(60, 4, $customer['scheme'].":".$customer['ID']);
$pdf->line_new(6);
$pdf->setFont("DejaVu", "B", 8);
$pdf->write_multi(10, 4, "");
$pdf->write_multi(150, 4, $customer['name']);
$pdf->line_new();
$pdf->write_cell(60, 4, $customer['street']);
$pdf->write_cell(40, 4, $customer['postcode']);
$pdf->write_cell(60, 4, $customer['city']);
$pdf->write_cell(20, 4, $customer['country_code']);
$pdf->line_new(10);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$pdf->write_multi(70, 4, $customer['street']);
$pdf->write_multi(30, 4, $customer['postcode']);
$pdf->write_multi(50, 4, $customer['city']);
$pdf->write_multi(10, 4, $customer['country_code']);
$pdf->line_new();
$pdf->write_cell(50, 4, $customer['company_id']);
$pdf->write_cell(50, 4, 'PEPPOL ID:'.$customer['scheme'].":".$customer['ID']);
$pdf->line_new(6);
/**
* note invoice
*/
if ( $info['info']['note'] != "")
{
$pdf->SetTextColor(0,0,127);
$pdf->setFont("DejaVu", "B", 12);
$pdf->write_cell(60, 4, _("Notes"));
$pdf->line_new(10);
$pdf->line_new(6);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$pdf->write_multi(50, 4,$info['info']['note']);
$pdf->write_multi(130, 8,$info['info']['note']);
$pdf->line_new(10);
}
/**
* ITEM
*/
$pdf->setFont("DejaVu", "B", 12);
$pdf->SetTextColor(0,0,127);
$pdf->write_cell(60, 4, _("Articles"));
$pdf->line_new(10);
$pdf->line_new(6);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$result = $this->get_invoiceLine();
$pdf->write_cell(50, 4, _("Code"), border: 'B');
$pdf->write_cell(50, 4, _("Description"), border: 'B');
$pdf->write_cell(30, 4, _("TVA"), border: 'B', align: 'R');
$pdf->write_cell(25, 4, _("Quantité"), border: 'B', align: 'R');
$pdf->write_cell(25, 4, _("Montant HT"), border: 'B', align: 'R');
$pdf->write_cell(60, 4, _("Description"), border: 'B');
$pdf->write_cell(20, 4, _("TVA"), border: 'B', align: 'R');
$pdf->write_cell(20, 4, _("Prix unitaire"), border: 'B', align: 'R');
$pdf->write_cell(20, 4, _("Quantité"), border: 'B', align: 'R');
$pdf->write_cell(20, 4, _("Montant HT"), border: 'B', align: 'R');
$pdf->line_new();
$nb_inline = count($result);
for ($i = 0; $i < $nb_inline; $i++)
{
$pdf->write_cell(50, 4, $result[$i]['name']);
$pdf->write_cell(50, 4, $result[$i]['description']);
$pdf->write_cell(25, 4, $result[$i]['tva_percent'], align: 'R');
$pdf->write_cell(5, 4, $result[$i]['tva_id']);
$pdf->write_cell(25, 4, $result[$i]['quantity'], align: 'R');
$pdf->write_cell(25, 4, nbm($result[$i]['amount']), align: 'R');
if ( $result[$i]['description'] == '') {
$pdf->write_multi(110, 4, $result[$i]['name']);
}else {
$pdf->write_multi(50, 4, $result[$i]['name']);
$pdf->write_multi(60, 4, $result[$i]['description']);
}
$pdf->write_cell(20, 4, $result[$i]['tva_percent'], align: 'R');
//$pdf->write_cell(5, 4, $result[$i]['tva_id']);
$pdf->write_cell(20, 4, $result[$i]['unit_price'], align: 'R');
$pdf->write_cell(20, 4, $result[$i]['quantity'], align: 'R');
$pdf->write_cell(20, 4, nbm($result[$i]['amount']), align: 'R');
$pdf->line_new();
}
$pdf->line_new(10);
$pdf->SetTextColor(0,0,127);
$pdf->setFont("DejaVu", "B", 12);
$pdf->write_cell(60, 4, _("Totaux"));
$pdf->line_new(10);
$pdf->line_new(6);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$result = $this->get_amount_summary();
// @TODO DNY : Qu'est-ce que LineExtension Amount ??
@ -535,9 +594,11 @@ abstract class XML_Reader
$nb_inline = count($result);
if ( !empty ($result ))
{
$pdf->SetTextColor(0,0,127);
$pdf->setFont("DejaVu", "B", 12);
$pdf->write_cell(60, 4, _("Charge et déduction"));
$pdf->line_new(10);
$pdf->line_new(6);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$pdf->write_cell(20, 4, _("code"), align: 'L', border: '1');
$pdf->write_cell(20, 4, _("Type"), border: '1');
@ -564,13 +625,15 @@ abstract class XML_Reader
$pdf->line_new();
}
}
$pdf->SetTextColor(0,0,127);
$pdf->setFont("DejaVu", "B", 12);
$pdf->write_cell(60, 4, _("TVA"));
$pdf->line_new(10);
$pdf->line_new(6);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$result = $this->get_taxes();
$pdf->write_cell(25, 4, _("% Taxe"), align: 'R', border: 'B');
$pdf->write_cell(5, 4, _("Code taxe"), border: 'B');
$pdf->write_cell(30, 4, _("Code taxe"), border: 'B');
$pdf->write_cell(50, 4, _("Base"), align: 'R', border: 'B');
$pdf->write_cell(50, 4, _("Taxe"), align: 'R', border: 'B');
$pdf->line_new();
@ -579,7 +642,7 @@ abstract class XML_Reader
{
$pdf->write_cell(25, 4, $result[$i]['tax_percent'], align: 'R');
$pdf->write_cell(5, 4, $result[$i]['tax_id']);
$pdf->write_cell(25, 4, $result[$i]['vatex']);
$pdf->write_multi(25, 4, $result[$i]['vatex']);
$pdf->write_cell(50, 4, nbm($result[$i]['taxable_amount']), align: 'R');
$pdf->write_cell(50, 4, nbm($result[$i]['tax']), align: 'R');
@ -589,8 +652,11 @@ abstract class XML_Reader
$pdf->setFont("DejaVu", "B", 12);
$pdf->SetTextColor(0,0,127);
$pdf->write_cell(60, 4, _("Paiement"));
$pdf->line_new(10);
$pdf->line_new(6);
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$result = $this->get_payment_mean();
$pdf->write_cell(50, 4, _("Code"));
@ -612,6 +678,7 @@ abstract class XML_Reader
$pdf->write_multi(140, 4, str_replace(["\n", "\r", "\t"], " ", $result['note'][$i]));
$pdf->line_new();
}
$pdf->line_new(6);
/**
* display name of embedded from files
* @var $result(array of Document_Reference)
@ -619,17 +686,19 @@ abstract class XML_Reader
$result=$this->get_embedded_document();
if ( count($result) > 0)
{
$pdf->SetTextColor(0,0,127);
$pdf->setFont("DejaVu", "B", 12);
$pdf->write_cell(60,4,_('Documents inclus'));
$pdf->line_new();
$pdf->SetTextColor(0,0,0);
$pdf->setFont("DejaVu", "", 7);
$nb_result=count($result);
for ($i=0;$i< $nb_result;$i++)
{
$binary=$result[$i]->getBinary_object();
$pdf->write_cell(50,4,$result[$i]->getId());
$pdf->write_cell(50,4,$binary->filename);
$pdf->write_cell(50,4,$result[$i]->getDescription());
$pdf->write_multi(50,4,$result[$i]->getId());
$pdf->write_multi(50,4,$binary->filename);
$pdf->write_multi(50,4,$result[$i]->getDescription());
$pdf->line_new();
}

View file

@ -143,15 +143,14 @@ class XMLCreditNote_Reader extends XML_Reader
for ($e = 0; $e < $node->length; $e++)
{
$row = [];
$xml = simplexml_import_dom($node->item($e));
$row ['quantity'] = $this->get_node_value("//cbc:CreditedQuantity", $e);
$row ['amount'] = $this->get_node_value("//cbc:LineExtensionAmount", $e);
$row ['description'] = $this->get_node_value("//cac:Item/cbc:Description", $e);
$row ['name'] = $this->get_node_value("//cac:CreditNoteLine/cac:Item/cbc:Name", $e);
$row ['unit_price'] = $this->get_node_value("//cac:CreditNoteLine/cac:Price/cbc:PriceAmount", $e);
$row ['tva_id'] = $this->get_node_value("//cac:CreditNoteLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID", $e);
$row ['tva_percent'] = $this->get_node_value("//cac:CreditNoteLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent", $e);
$row ['quantity'] = $node->item($e)->getElementsByTagName("CreditedQuantity")->item(0)->textContent;
$row ['code_quantity'] = $node->item($e)->getElementsByTagName("CreditedQuantity")->item(0)->getAttribute('unitCode');
$row ['amount'] = $node->item($e)->getElementsByTagName("LineExtensionAmount")->item(0)->textContent;
$row ['description'] = $node->item($e)->getElementsByTagName("Description")->item(0)?->textContent;
$row ['name'] = $node->item($e)->getElementsByTagName("Name")->item(0)->textContent;
$row ['unit_price'] = $node->item($e)->getElementsByTagName("PriceAmount")->item(0)->textContent;
$row ['tva_id'] = $node->item($e)->getElementsByTagName("ID")->item(0)->textContent;
$row ['tva_percent'] = $node->item($e)->getElementsByTagName("Percent")->item(0)?->textContent;
$result[] = $row;
}
return $result;

View file

@ -208,8 +208,16 @@ abstract class XMLInvoice extends \DOMDocument
$card=new \Fiche($this->cn,$operation->det->array[$i]['qs_fiche']);
$result['operation'][$i]['qcode']=$card->get_attribute(ATTR_DEF_QUICKCODE);
$result['operation'][$i]['name']=$card->get_attribute(ATTR_DEF_NAME);
$result['operation'][$i]['description']=($operation->det->array[$i]['j_text']=="")?$card->get_attribute(9):$operation->det->array[$i]['j_text'];
$result['operation'][$i]['description']=$operation->det->array[$i]['j_text'];
if ($operation->det->array[$i]['j_text'] == "")
{
$a=$card->get_attribute(9);
if ( $a != "") {
$result['operation'][$i]['description']=$a;
}else {
$result['operation'][$i]['description']=$result['operation'][$i]['name'];
}
}
// get the type of unity, if not found then it will be EA
$x= $card->get_attribute(ATTR_DEF_QUANTITY_TYPE,0);
$result['operation'][$i]['code_quantity']=($x===false||$x=="")?"EA":$x;
@ -257,7 +265,7 @@ abstract class XMLInvoice extends \DOMDocument
}
}
$result['info']['communication']=($result['info']['communication']=="")?$result['id']:"";
$result['info']['communication']=($result['info']['communication']=="")?$result['id']:$result['info']['communication'];
$result['document']=$this->fill_document($jr_id);
/**
@ -292,7 +300,10 @@ abstract class XMLInvoice extends \DOMDocument
$VAT_SubTotal[$idx_subtotal]=array();
$VAT_SubTotal[$idx_subtotal]['idx']=$idx;
$VAT_SubTotal[$idx_subtotal]['vat_code']=$result['operation'][$i]['vat_code'] ;
$VAT_SubTotal[$idx_subtotal]['percent']=$percent;
if ( $acc_tva->tva_both_side == 1 )
$VAT_SubTotal[$idx_subtotal]['percent']=0;
else
$VAT_SubTotal[$idx_subtotal]['percent']=$percent;
$VAT_SubTotal[$idx_subtotal]['vatex']=$acc_tva->vx_code;
$VAT_SubTotal[$idx_subtotal]['amount']=$VAT_SubTotal[$idx_subtotal]['vat']=0;
@ -302,12 +313,19 @@ abstract class XMLInvoice extends \DOMDocument
* @todo Pour les intracomm , quel taux utilisé ? 0 ou 21%
*/
$VAT_SubTotal[$n]['amount']=bcadd($VAT_SubTotal[$n]['amount'],$result['operation'][$i]['price']);
$VAT_SubTotal[$n]['vat']=bcadd($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat']);
$VAT_SubTotal[$n]['vat']=bcsub($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat_reversed']);
if ( $acc_tva->tva_both_side == 0 )
$VAT_SubTotal[$n]['vat']=bcadd($VAT_SubTotal[$n]['vat'],$result['operation'][$i]['vat']);
$result['TaxableAmount']=bcadd( $result['TaxableAmount'],$result['operation'][$i]['price']);
$result['TaxAmount']=bcadd( $result['TaxAmount'],$result['operation'][$i]['vat']);
$result['TaxAmount']=bcsub( $result['TaxAmount'],$result['operation'][$i]['vat_reversed']);
// $result['TaxAmount']=bcsub( $result['TaxAmount'],$result['operation'][$i]['vat_reversed']);
$result['operation'][$i]['vat_percent']=$percent;
if ( $acc_tva->tva_both_side == 1 )
{
$result['operation'][$i]['vat_percent']=0;
}else {
$result['TaxAmount']=bcadd( $result['TaxAmount'],$result['operation'][$i]['vat']);
}
}
$result['subTotalVAT']=$VAT_SubTotal;
$result['LineExtensionAmount']= $result['TaxableAmount'];

View file

@ -109,17 +109,17 @@ class XMLInvoice_Reader extends XML_Reader
for ($e = 0; $e < $node->length; $e++)
{
$row = [];
$row ['quantity'] = $this->get_node_value("//cbc:InvoicedQuantity", $e);
$row ['amount'] = $this->get_node_value("//cbc:LineExtensionAmount", $e);
$row ['description'] = $this->get_node_value("//cac:Item/cbc:Description", $e);
$row ['name'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cbc:Name", $e);
$row ['unit_price'] = $this->get_node_value("//cac:InvoiceLine/cac:Price/cbc:PriceAmount", $e);
$row ['tva_id'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID", $e);
$row ['tva_percent'] = $this->get_node_value("//cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent", $e);
$row ['quantity'] = $node->item($e)->getElementsByTagName("InvoicedQuantity")->item(0)->textContent;
$row ['code_quantity'] = $node->item($e)->getElementsByTagName("InvoicedQuantity")->item(0)->getAttribute('unitCode');
$row ['amount'] = $node->item($e)->getElementsByTagName("LineExtensionAmount")->item(0)->textContent;
$row ['description'] = $node->item($e)->getElementsByTagName("Description")->item(0)?->textContent;
$row ['name'] = $node->item($e)->getElementsByTagName("Name")->item(0)->textContent;
$row ['unit_price'] = $node->item($e)->getElementsByTagName("PriceAmount")->item(0)->textContent;
$row ['tva_id'] = $node->item($e)->getElementsByTagName("ID")->item(0)?->textContent;
$row ['tva_percent'] = $node->item($e)->getElementsByTagName("Percent")->item(0)?->textContent;
$result[] = $row;
return $result;
}
return $result;
}
/**
* @brief return the code of the document
@ -164,7 +164,12 @@ class XMLInvoice_Reader extends XML_Reader
$row ['taxable_amount'] = $xml->xpath("//cbc:TaxableAmount")[$e] . "";
$row ['tax'] = $xml->xpath("//cbc:TaxAmount")[$e] . "";
$row ['tax_id'] = $xml->xpath("//cac:TaxCategory/cbc:ID")[$e] . "";
$row ['tax_percent'] = $xml->xpath("//cac:TaxCategory/cbc:Percent")[$e] . "";
$row ['tax_percent'] =0;
$r=$xml->xpath("//cac:TaxCategory/cbc:Percent");
if ( isset($r[$e]) )
{
$row ['tax_percent'] = $xml->xpath("//cac:TaxCategory/cbc:Percent")[$e] . "";
}
if (isset($xml->xpath("//cac:InvoiceLine/cac:Item/cbc:Name")[$e]))
{
$row ['name'] =$xml->xpath("//cac:InvoiceLine/cac:Item/cbc:Name")[$e]."";

View file

@ -0,0 +1,93 @@
<?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 dany 27 févr. 2026
/*
*
*/
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file admin_logfile.inc
* @brief Show log file and download them
*/
if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
print '<div class="content">';
print '<h2 class="h-section">';
print _("Fichiers trace");
print "</h2>";
//print p(_("Fichiers trace"),' class="text-muted"');
$directory=dir( NOALYSS_BASE.DIRECTORY_SEPARATOR."log");
$a_file=[];
while ( $file = $directory->read()) {
if (preg_match("/noalyss.*log/", $file)) {
$a_file[]=$file;
}
}
rsort($a_file);
$nb_file=count($a_file);
if ( $nb_file == 0) {
echo p(_("Aucune donnée"),' class="notice"');
return;
}
if ( $http->get("sa","string","x")=="dwn")
{
$file=$http->get("file");
if (! in_array($file,$a_file ) )
{
echo_warning(sprintf("%s non trouvé",$file));
record_log("admin_logfile : {$file} not found");
return;
}
print "<ul class=\"aligned-block\">";
print "<li>";
print \HtmlInput::button_anchor(_("Retour"), NOALYSS_URL."/admin-noalyss.php?action=logfile");
print "</li>";
print "<li>";
print \HtmlInput::button_anchor(_("Télécharger").'<i class="icon icon-download"></i>'
, NOALYSS_URL."/export.php?admin=1&action=logfile&file={$file}");
print "</li>";
print "</ul>";
echo '<pre>';
echo file_get_contents(NOALYSS_BASE.DIRECTORY_SEPARATOR."/log/{$file}");
echo '</pre>';
print "<ul class=\"aligned-block\">";
print "<li>";
print \HtmlInput::button_anchor(_("Retour"), NOALYSS_URL."/admin-noalyss.php?action=logfile");
print "</li>";
print "<li>";
print \HtmlInput::button_anchor(_("Télécharger").'<i class="icon icon-download"></i>'
, NOALYSS_URL."/export.php?admin=1&action=logfile&file={$file}");
print "</li>";
print "</ul>";
return;
}
echo '<ol>';
for ( $i=0;$i < $nb_file;$i++)
{
$url=sprintf("%s?%s", NOALYSS_URL."/admin-noalyss.php"
, http_build_query(["action"=>"logfile","sa"=>"dwn","file"=>$a_file[$i]]));
printf ("<li><a href=\"%s\">%s</a></li>",$url,$a_file[$i]);
}
print "</ol>";

View file

@ -47,6 +47,7 @@ if ($User->admin != 1)
{
$theme=(isset($User->theme))?$User->theme:"";
$User->audit('FAIL',"ADMIN : [$action]".var_export($_REQUEST,true));
record_log("Security alert [{$action}]".var_export($_REQUEST,true));
html_page_start($theme);
echo '<div class=content" style="padding:5%">';
echo "<h1 class=\"title\">";
@ -206,6 +207,12 @@ hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #0
echo $html->saveHTML();
}
if ($action== 'logfile' && SYSINFO_DISPLAY == true )
{
/* List the connexion successfull and failed */
require_once NOALYSS_INCLUDE."/admin_logfile.inc.php";
}
//------------------------------------------------------------------------------
// Upgrade
//------------------------------------------------------------------------------

View file

@ -123,9 +123,15 @@ endif;
echo _("Menu actuel")." : ".hb($_GET['ac']);
echo HtmlInput::array_to_hidden(array("gDossier","ac"), $_REQUEST);
?>
<p>
<?php echo HtmlInput::submit("bookmark_add", _("Ajoutez le menu actuel à vos favoris"),"","smallbutton"); ?>
<ul class="aligned-block ">
<li>
<?=\HtmlInput::button_hide("bookmark_div")?>
</li>
<li>
<?php echo HtmlInput::submit("bookmark_add", _("Ajoutez le menu actuel à vos favoris"),"","smallbutton"); ?>
</li>
</ul>
</form>
</div>

View file

@ -88,7 +88,6 @@ $html=var_export($_REQUEST,true);
// For storing extra information , example the HTML elt id to update
// after creating
$extra="";
$http=new \HttpInput();
switch($op2)
{
case 'attribute':
@ -717,7 +716,7 @@ case 'upc':
}
else
{
if ($cn->get_value('select count(*) from fiche where f_id=$1',array($_GET['f_id'])) == '0' )
if ($cn->get_value('select count(*) from fiche where f_id=$1',array($http->get('f_id'))) == '0' )
{
$html.=alert(_('Fiche non valide'),true);
}
@ -726,7 +725,7 @@ case 'upc':
{
$html=HtmlInput::title_box(_('Détail fiche (sauvée)'),$ctl);
$f=new Fiche($cn,$_GET['f_id']);
$f=new Fiche($cn,$http->get('f_id'));
ob_start();
$f->update($_GET);
$html.=ob_get_contents();

View file

@ -564,7 +564,7 @@ switch ($action) {
break;
case 'note_refresh':
$acc_operation_note= Acc_Operation_Note::build_jrn_id($jr_id);
echo substr($acc_operation_note->getNote()??"",0,120);
echo mb_substr($acc_operation_note->getNote()??"",0,120);
return;
case "rmsup":

View file

@ -113,7 +113,11 @@ for ($i=0;$i<$nMax;$i++):
<?php endfor; ?>
</table>
<ul class="aligned-block ">
<li>
<?=\HtmlInput::button_hide("navi_div")?>
</li>
</ul>
</div>
<script charset="UTF8" lang="javascript">
$('lk_navi_tb').focus();

View file

@ -38,11 +38,19 @@ if ( ($g_user->can_write_action($ag_id) == true || $g_user->can_read_action($ag_
{
$menu=new Default_Menu();
echo $act->Display('READ', false, "ajax", "");
//$action=HtmlInput::array_to_string(array("gDossier","ag_id"), $_GET)."&ac=FOLLOW&sa=detail";
$action= "do.php?".http_build_query(array("gDossier"=>Dossier::id(),"ag_id"=>$ag_id,"ac"=>$menu->get('code_follow'),"sa"=>"detail"));
$action= NOALYSS_URL."/do.php?".http_build_query(array("gDossier"=>Dossier::id(),"ag_id"=>$ag_id,"ac"=>$menu->get('code_follow'),"sa"=>"detail"));
$code='ok';
?>
<ul class="aligned-block">
<li>
<a href="<?php echo $action?>" target="_blank" class="smallbutton"><?php echo _("Modifier")?> </a>
</li>
<li>
<?php echo HtmlInput::button_close($div)?>
</li>
</ul>
<?php
}
else
@ -52,9 +60,13 @@ else
<div style="margin:0px;padding:0px;background-color:red;text-align:center;">
<h2 class="error"><?php echo $forbidden ?></h2>;
</div>
<ul class="aligned-block">
<li>
<?php echo HtmlInput::button_close($div)?>
</li>
</ul>
<?php
}
echo HtmlInput::button_close($div);
$response = ob_get_clean();
$html=escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');

View file

@ -1988,7 +1988,6 @@ EOF;
}
$r.='</table>';
$r.='</p>';
if ( $g_parameter->MY_ANALYTIC!='nu' && !$p_summary) // use of AA
$r.='<input type="button" class="button" value="'._('Vérifiez imputation analytique').'" onClick="verify_ca(\'\');">';
@ -2125,6 +2124,7 @@ EOF;
$file=new IFile();
$file->setAlertOnSize(true);
$file->table=0;
$r.='<h3 class="title">'._("Facture").'</h3>';
$r.=_("Ajoutez une pièce justificative ");
$r.=$file->input("pj","");
@ -2141,11 +2141,13 @@ EOF;
$r.=$doc_gen->input().'<br>';
}
$r.='</p>';
$r.='<h3 class="title">'._("Documents supplémentaires").'</h3>';
$r.=$this->input_supplemental_document();
$r.='<p>';
$obj=new IText();
$obj->size=50;
$r.=_('Numero de bon de commande : ').$obj->input('bon_comm').'<br>';
$r.=_('Autre information : ').$obj->input('other_info').'<br>';
$r.=_('Communication').$obj->input('other_info').'<br>';
$r.='</p>';
$r.='</div>';
return $r;

View file

@ -1282,14 +1282,16 @@ EOF;
$r.='<tr>'.td($other_tax_label).td(hb($other_tax_amount),'class="num"');
}
if ( $other_tax_amount!="") {$tot=bcadd($tot,$other_tax_amount,2);}
$r.='<tr>'.td(_('Total TVAC')).td(hb($tot),'class="num"');
$r.='<tr>'.td(_('Total TVAC')).td(hb($tot),'class="num"').'</tr>';
$r.='</table>';
} else {
$r.='<table>';
if ( ! empty($other_tax_label) ) {
$r.='<tr>'.td($other_tax_label).td(hb($other_tax_amount),'class="num"');
}
if ( $other_tax_amount!="") {$tot=bcadd($tot,$other_tax_amount,2);}
$r.='<br>Total '.hb($tot);
$r.='<tr>'.td(_('Total ')).td(hb($tot),'class="num"');
$r.='</table>';
}
$r.='</div>';
@ -1374,13 +1376,13 @@ EOF;
*/
public function extra_info() {
$r = '<div id="facturation_div_id" style="display:flex;height:185px;height:10rem">';
$r = '<div id="facturation_div_id" style="">';
// check for upload piece
$file = new IFile();
$file->table = 0;
$file->setAlertOnSize(true);
$r.='<p class="decale">';
$r.='<h3 class="title">'._("Facture").'</h3>';
// add a receipt
$r.=_("Ajoutez une pièce justificative ");
$r.=$file->input("pj", "");
@ -1398,11 +1400,15 @@ EOF;
" union select -2,'"._("Z - Facture PDF Standard")."' ".
" order by 2");
$r.=$doc_gen->input() . '<br>';
$r.='<h3 class="title">'._("Documents supplémentaires").'</h3>';
// add a receipt
$r.=$this->input_supplemental_document();
$r.='<br>';
$obj = new IText();
$obj->size=50;
$r.='<p>';
$r.=_('Numero de bon de commande') . $obj->input('bon_comm') . '<br>';
$r.=_('Communication') . $obj->input('other_info') . '<br>';
$r.='</p>';
$r.='</div>';

View file

@ -984,7 +984,7 @@ print $html;
// Note
$r.='<td>';
$r.='<span id="als_note'.$row['jr_id'].'" class="font-small">';
$r.= substr($row['n_text']??"",0,120);
$r.= mb_substr($row['n_text']??"",0,120);
$r.='<span>';
$r.='</span>';
$r.='</td>';

View file

@ -1013,6 +1013,8 @@ EOF;
echo \Noalyss\Dbg::hidden_info("operation->det", $operation->det);
echo \Noalyss\Dbg::hidden_info("array", $array);
}
$ledger=new \Acc_Ledger($this->db,$operation->det->jr_def_id);
$array['nb_item']=max($ledger->get_min_row(),$array['nb_item']);
// transform the operation into hidden element
$r.=HtmlInput::simple_array_to_hidden($array);
$r.=HtmlInput::hidden("e_comm",$operation->det->jr_comment);

View file

@ -210,7 +210,7 @@ class Card_Property
}
if ( $this->ad_id == ATTR_DEF_QUANTITY_TYPE){
$result['input']=new IText( "av_text" . $this->ad_id,$this->av_text);
$array=$this->cn->get_array("select qc_code,format('%s %s',qc_code,qc_label) label from quantity_code_ref order by qc_label",p_mode: PGSQL_NUM);
$array=$this->cn->get_array("select qc_code,format('%s %s',qc_code,qc_label) as label from quantity_code_ref order by qc_label",p_mode: PGSQL_NUM);
$result['input']->set_datalist($array);
$result['label']=$this->ad_text;
return $result;

View file

@ -528,14 +528,14 @@ class Fiche
if ( $p_array["av_text".ATTR_DEF_QUICKCODE] =="")
{
if ( ! empty( $p_array['av_text'. ATTR_DEF_ACCOUNT])) {
$base_acc=substr($p_array['av_text'. ATTR_DEF_ACCOUNT]??"",0, 3);
$base_acc=mb_substr($p_array['av_text'. ATTR_DEF_ACCOUNT]??"",0, 3);
}else {
$base_acc=$this->cn->get_value("select substr(fd_class_base,1,2) from fiche_def where fd_id = $1",
[$p_fiche_def]);
}
$p_array["av_text".ATTR_DEF_QUICKCODE]=sprintf("%s%s"
, $base_acc
, substr($p_array["av_text".ATTR_DEF_NAME], 0, 4)
, mb_substr($p_array["av_text".ATTR_DEF_NAME], 0, 4)
);
}
$sql=sprintf("select insert_quick_code(%d,'%s')", $fiche_id,
@ -1503,7 +1503,7 @@ class Fiche
$solde=abs(bcsub($deb,$cred));
$side=($deb > $cred)?'Débit':'Crédit';
$r.='<tr class="highlight">';
$r.=td("").td("").td("").td("").td("Totaux").td(nbm($deb),'class="num"').td(nbm($cred),'class="num"').td(" $side ".nbm($solde),'class="num"');
$r.=td("").td("").td("").td("").td("").td("Totaux").td(nbm($deb),'class="num"').td(nbm($cred),'class="num"').td(" $side ".nbm($solde),'class="num"');
$r.='</tr>';
$r.="</tfoot>";
$r.="</TABLE>";

View file

@ -283,7 +283,8 @@ class Follow_Up
$title->name="ag_title";
$title->value=$this->ag_title;
$title->size=60;
$title->style='style="font-size:2rem;font-weight:bold"';
$title->style='class="input_text" style="font-size:2rem;font-weight:bold"';
$title->css_size="45rem";
// Priority of the ag_priority
@ -303,7 +304,8 @@ class Follow_Up
$ag_hour->name="ag_hour";
$ag_hour->value=$this->ag_hour;
$ag_hour->size=6;
$ag_hour->javascript=" onblur=check_hour('ag_hour');";
if (! $readonly) $ag_hour->javascript=" onblur=check_hour('ag_hour');";
$str_ag_hour=$ag_hour->input();
// Profile in charged of the action
@ -419,7 +421,7 @@ class Follow_Up
$h_agrefid=new IHidden();
$iag_ref=new IText("ag_ref");
$iag_ref->value=$this->ag_ref;
$iag_ref->readOnly=false;
$iag_ref->readOnly=$readonly;
$iag_ref->css_size="100%";
$str_ag_ref=$iag_ref->input();
// Preparing the return string

View file

@ -263,22 +263,25 @@ class Invoice_PDF extends \PDF
}
$this->write_multi($col['quantity'], 4, nbm($this->data['e_quant' . $i]), '', 'R',fill:$fill);
$this->write_multi($col['price'], 4, nbm($this->data['e_march' . $i . '_price']), '', 'R',fill:$fill);
$this->write_multi($col['vat_code'], 4, $this->data['e_march' . $i . '_tva_id'], '', 'C',fill:$fill);
$x = $this->data['e_march' . $i . '_tva_id'];
if (!isset($a_tva_amount[$x]))
if (isset ($this->data['e_march' . $i . '_tva_id']))
{
$a_tva_amount[$x] = 0;
$this->write_multi($col['vat_code'], 4, $this->data['e_march' . $i . '_tva_id'], '', 'C',fill:$fill);
$x = $this->data['e_march' . $i . '_tva_id'];
if (!isset($a_tva_amount[$x]))
{
$a_tva_amount[$x] = 0;
}
$a_tva_amount[$x] = bcadd($a_tva_amount[$x], $this->data["e_march" . $i . "_tva_amount"], 2);
$tot_vat = bcadd($tot_vat
, $this->data['e_march' . $i . '_tva_amount']
, 2);
}
$a_tva_amount[$x] = bcadd($a_tva_amount[$x], $this->data["e_march" . $i . "_tva_amount"], 2);
$tot_amount = bcadd($tot_amount
, bcmul($this->data['e_march' . $i . '_price']
, $this->data['e_quant' . $i]
, 2
)
, 2);
$tot_vat = bcadd($tot_vat
, $this->data['e_march' . $i . '_tva_amount']
, 2);
$this->line_new(4);
if ($this->GetY()>250) {
$this->AddPage();
@ -318,21 +321,51 @@ class Invoice_PDF extends \PDF
$this->line_new();
$iban = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1",
['COMPANY_BANK_IBAN']);
if ($this->data['e_ech'] != "" && $iban != "")
if ($this->data['e_ech'] != "" ){
$this->write_multi(150, 4,
sprintf(_("Paiement avant le %s "),
$this->data['e_ech']
)
);
$this->line_new();
}
$this->SetFont("DejaVu", "B", 9);
$this->write_multi(80, 4, _("Paiement"));
$this->line_new();
$this->SetFont("DejaVu", "", 7);
if ( $iban != "")
{
$info = ($this->data["other_info"] == "") ? $this->data["e_pj"] : $this->data["other_info"];
$bic = $this->cn->get_value("select pe_value from parameter_extra where pe_code=$1",
['COMPANY_BANK_IBAN']);
['COMPANY_BANK_BIC']);
$this->write_multi(150, 4,
sprintf(_("Paiement avant le %s sur le compte %s (BIC %s) avec comme message %s"),
$this->data['e_ech']
sprintf(_(" compte %s (BIC %s) ")
, $iban
, $bic
)
);
$this->line_new();
}
$this->write_multi(150, 4,_("Montant ").nbm(bcadd($tot_amount, $tot_vat, 2),2));
$this->line_new();
if ( $this->data["other_info"] != ""){
$this->write_multi(150, 4,
sprintf(_(" Communication: %s")
, $this->data["other_info"]
)
);
$this->line_new();
}
if ($this->data["bon_comm"] != "") {
$this->write_multi(150, 4,
sprintf(_(" Bon de commande: %s")
, $this->data["bon_comm"]
)
);
$this->line_new();
}
$this->Output($this->dirname . DIRECTORY_SEPARATOR . $this->filename, "F");
}
}

View file

@ -109,6 +109,7 @@ EOF;
function check_anc_filter($p_value):void
{
$tmp_value=$p_value;
$tmp_value=preg_replace("/[0-9]|,/", '', $p_value);
if ( $tmp_value != "") {
throw new Exception (sprintf(_("Valeur invalide %s"),$tmp_value),1000);
@ -167,6 +168,7 @@ EOF;
function save($p_attr)
{
try {
if ( trim($this->MY_ANC_FILTER) == "") $this->MY_ANC_FILTER="6,7";
$value=$this->check($p_attr,$this->$p_attr);
// check if the parameter does exist

View file

@ -401,7 +401,32 @@ class Noalyss_User
$sql_cond=" where use_id=$1";
$sql_array=array($this->id);
}
$sql="select use_id,
/**
* mono version
*/
if ( $this->repository->exist_table("repo_version")) {
$repo_version = $this->repository->get_value("select val from repo_version");
} else {
$repo_version = $this->repository->get_value("select val from version");
}
/**
* when upgrading , ACCOUNT_REPOSITORY is not yet upgraded
*/
if ( $repo_version < 21)
{
$sql="select use_id,
use_first_name,
use_name,
use_login,
use_active,
use_admin,
use_pass,
use_email
from ac_users ";
$row=array();
$row['use_auth_method']=$row['use_otp_secret']="";
} else {
$sql="select use_id,
use_first_name,
use_name,
use_login,
@ -412,6 +437,7 @@ class Noalyss_User
use_auth_method,
use_otp_secret
from ac_users ";
}
$Res=$this->repository->exec_sql($sql.$sql_cond, $sql_array);
if (($Max=Database::num_row($Res))==0)
return -1;
@ -1452,6 +1478,9 @@ class Noalyss_User
$p_module,
$_SERVER['REQUEST_URI'],
$action));
if ( $action=="FAIL") {
record_log("security alert see audit");
}
}
}

View file

@ -97,6 +97,7 @@ class Tva_Rate_MTable extends Manage_Table_SQL
'tva_peppol_code'=>_("Code TVA est utilisé pour les factures électroniques, plus d'information dans le manuel"),
'vx_code'=>_("Code exemption pour facture PEPPOL (ubl)")
);
$this->setTitle(_("Détail TVA"));
}
/**
@ -453,17 +454,17 @@ class Tva_Rate_MTable extends Manage_Table_SQL
}
// if vatex is set then code invoice must be different from S and Z
if ( $g_parameter->MY_INVOICE_FORMAT == 'UBL21BE' && trim($this->table->vx_code??"") != "" && in_array($this->table->tva_peppol_code,['S','Z'] ))
if ( $g_parameter->MY_INVOICE_FORMAT == 'UBL21BEL' && trim($this->table->vx_code??"") != "" && in_array($this->table->tva_peppol_code,['S','Z'] ))
{
$this->set_error("vx_code",_("Le code d'exemption TVA ne peut être utilisé avec ce code Facture électronique UBL "));
}
// if vatex is set then code invoice must be different from S and Z
if ( $g_parameter->MY_INVOICE_FORMAT == 'UBL21BE' && trim($this->table->vx_code??"") != "" && $this->table->tva_peppol_code=="")
if ( $g_parameter->MY_INVOICE_FORMAT == 'UBL21BEL' && trim($this->table->vx_code??"") != "" && $this->table->tva_peppol_code=="")
{
$this->set_error("vx_code",_("Le code d'exemption TVA n' pas de sens sans code Facture électronique"));
}
// if tva_peppol_code is not S or Z then a VATEX code must be supplied
if ( $g_parameter->MY_INVOICE_FORMAT == 'UBL21BE'
if ( $g_parameter->MY_INVOICE_FORMAT == 'UBL21BEL'
&& ! in_array($this->table->tva_peppol_code??"",["Z","S"])
&& trim($this->table->vx_code??"" ) =="")
{

View file

@ -256,7 +256,7 @@ try
$Ledger->id=$p_jrn_predef;
$p_post['p_jrn']=$Ledger->id;
echo $Ledger->input($p_post);
echo '<div class="content">';
echo '<div class="">';
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';
@ -273,7 +273,7 @@ try
echo HtmlInput::hidden("sa", "p");
echo HtmlInput::hidden("action_gestion",$action_id);
echo $Ledger->input($array);
echo '<div class="content">';
echo '<div class="">';
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';
@ -285,7 +285,7 @@ try
echo $Ledger->input($array);
echo HtmlInput::hidden("p_action", "ach");
echo HtmlInput::hidden("sa", "p");
echo '<div class="content">';
echo '<div class="">';
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';

View file

@ -202,7 +202,7 @@ if (isset($_POST['save']))
$cn->start();
for ($i = 0; $i < count($array); $i++)
{
$cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($_POST['ext'], $array[$i]));
$cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($receipt_nb, $array[$i]));
$tot = bcadd($tot, $cn->get_value('select qf_amount from quant_fin where jr_id=$1', array($array[$i])));
}
$diff = bcsub($end_extrait, $start_extrait);
@ -210,22 +210,30 @@ if (isset($_POST['save']))
{
$remain=bcsub($tot,$diff);
$cn->rollback();
alert("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, mise à jour annulée, la différence est de $remain");
$str_message=_("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, mise à jour annulée, la différence est de $remain");
alert($str_message);
echo '<div class="error">';
echo '<p>'.$g_failed._("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, la différence est de $remain <br>mise à jour annulée").'</p>';
echo '<p>'.$g_failed.$str_message.'</p>';
/* if file : warning that file is not uploaded*/
echo '<p>'.
_('Attention : Fichier non chargé').
_('Attention : Fichier non chargé et rapprochement annulé').
'</p>';
echo '</div>';
}
else
{
echo '<div class="content">'.$g_succeed.' Mise à jour extrait '.$_POST['ext'].'</div>';
{
echo '<div class="content">'.$g_succeed._(' Mise à jour extrait')." ".$receipt_nb.'</div>';
// -- chargement fichier
$oid=$cn->upload('file_receipt',true);
if ( $oid != false ) {
$oid=null;
if ( $_FILES['file_receipt']['name'] != "" && $_FILES['file_receipt']['error'] == 0)
{
$oid=$cn->upload('file_receipt',true);
echo _("Fichier sauvé");
}
if( $_FILES['file_receipt']['error'] != 4 && $_FILES['file_receipt']['error'] !=0 )
echo_warning(_("Fichier non chargé: mise à jour annulée"));
else
{
for ($i = 0; $i < count($array); $i++)
{
$cn->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2,
@ -411,6 +419,7 @@ echo '</tr>';
echo '</table>';
$receipt=new IFile('file_receipt');
$receipt->setAlertOnSize(true);
echo _("Pièce justificative"),"&nbsp;" ,
$receipt->input();
echo '<p class="text-align:center">';

View file

@ -158,6 +158,10 @@ if ( isset($_POST['record']) )
$Ledger=new Acc_Ledger_Sale($cn,$post_jrn);
try {
$internal=$Ledger->insert($_POST);
/* Save the additional information into jrn_info */
$obj=new Acc_Ledger_Info($cn);
$obj->save_extra($Ledger->jr_id,$_POST);
$Ledger->upload_supplemental_document($Ledger->jr_id);
// var $receipt (string) contains the name of the file name of
// the invoice (document created), if empty there
@ -290,9 +294,6 @@ if ( isset($_POST['record']) )
}
/* Save the additional information into jrn_info */
$obj=new Acc_Ledger_Info($cn);
$obj->save_extra($Ledger->jr_id,$_POST);
/* save followup */
$Ledger->save_followup($http->request("action_gestion","string",""));
@ -394,7 +395,7 @@ try
$Ledger->id=$http->request('p_jrn_predef');
echo $Ledger->input($p_post);
echo '<div class="content">';
echo '<div class="">';
echo $Ledger->input_paid($payment);
echo '</div>';
echo '<script>';
@ -411,7 +412,7 @@ try
echo HtmlInput::hidden("sa", "p");
echo HtmlInput::hidden("action_gestion",$action_id);
echo $Ledger->input($array);
echo '<div class="content">';
echo '<div class="">';
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';
@ -426,7 +427,7 @@ try
$action_id=$http->get('ag_id',"string","");
echo HtmlInput::hidden("action_gestion",$action_id);
echo $Ledger->input($array);
echo '<div class="content">';
echo '<div class="">';
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';

View file

@ -25,10 +25,10 @@
global $version_noalyss;
// version
define('NOALYSS_VERSION', 10000 );
define('NOALYSS_VERSION', 10100 );
// Database schema version
define("DBVERSION", 206);
define("DBVERSION", 207);
// version for MONO_DATABASE
define("MONO_DATABASE", 25);

View file

@ -1398,7 +1398,8 @@ function record_log($p_message)
if ($handle_log == false )
{
if ( isset ($_SERVER['REMOTE_ADDR']) ) error_log(sprintf("origin %s\n",$_SERVER['REMOTE_ADDR']));
if ( isset ($_SERVER['HTTP_USER_AGENT']) ) error_log(sprintf("agent %s\n",$_SERVER['HTTP_USER_AGENT']));
if ( gettype ($p_message) == "object" && method_exists($p_message,"getTraceAsString") == 1) {
$exc=$p_message;
do {
@ -1417,6 +1418,9 @@ function record_log($p_message)
error_log("noalyss GET [".json_encode($_GET,0,10)."]");
error_log("_POST [".json_encode($_POST,0,10)."]",0);
} else {
if ( isset ($_SERVER['REMOTE_ADDR']) ) fwrite($handle_log,sprintf("origin %s\n",$_SERVER['REMOTE_ADDR']));
if ( isset ($_SERVER['HTTP_USER_AGENT']) ) fwrite($handle_log,sprintf("agent %s\n",$_SERVER['HTTP_USER_AGENT']));
if ( gettype ($p_message) == "object" && method_exists($p_message,"getTraceAsString") == 1) {
error_log("noalyss exception ".$p_message->getMessage(),0);

View file

@ -165,7 +165,13 @@ function display_file_config($p_array, $from_setup = 1, $p_os = 1)
echo PHP_EOL;
print ('define ("NOALYSS_ADMIN_PASSWORD","' . $cpassword_admin . '");');
echo PHP_EOL;
echo "
/*
* LOCALE 0 means no language change , on some PHP installation
* you cannot change the language
*/
";
echo PHP_EOL;
print ('define ("LOCALE",' . $clocale . ');');
echo PHP_EOL;
echo "

View file

@ -190,7 +190,7 @@ abstract class Data_SQL
{
return $this->$cols;
}
throw new \Exception (" unknow cols [$cols] =".$this,EXC_DATA_SQL);
throw new \Exception (" unknow cols {$this->table}[$cols] =".$this,EXC_DATA_SQL);
}
/**
@ -203,7 +203,7 @@ abstract class Data_SQL
$this->$cols=$p_value;
return $this;
} else
throw new \Exception (" unknow cols [$cols] =".$this,EXC_DATA_SQL);
throw new \Exception (" unknow cols {$this->table}[$cols] =".$this,EXC_DATA_SQL);
}
@ -214,6 +214,7 @@ abstract class Data_SQL
*/
public function getp($cols)
{
$cols=trim($cols);
if (array_key_exists($cols, $this->name)) {
$idx=$this->name[$cols];
return $this->$idx;
@ -226,7 +227,7 @@ abstract class Data_SQL
return $this->$cols;
}
throw new \Exception (" unknow cols [$cols] =".$this,EXC_DATA_SQL);
throw new \Exception (" unknow cols {$this->table} [$cols] =".$this,EXC_DATA_SQL);
}
/**
@ -236,6 +237,7 @@ abstract class Data_SQL
*/
public function setp($cols, $p_value)
{
$cols=trim($cols);
if (array_key_exists($cols, $this->name)) {
$idx=$this->name[$cols];
$this->$idx=$p_value;
@ -246,10 +248,11 @@ abstract class Data_SQL
return $this;
}
throw new \Exception (" unknow cols [$cols] =".$this,EXC_DATA_SQL);
throw new \Exception (" unknow cols {$this->table}[$cols] = ".$this,EXC_DATA_SQL);
}
public function __set($cols,$p_value) {
$cols=trim($cols);
if (array_key_exists($cols, $this->type)) {
$this->$cols=$p_value;
return $this;
@ -259,10 +262,10 @@ abstract class Data_SQL
$this->$cols=$p_value;
return $this;
}
throw new \Exception (" unknow cols [$cols] =".$this,EXC_DATA_SQL);
throw new \Exception (" unknow cols {$this->table}[$cols] =".$this,EXC_DATA_SQL);
}
public function __get($cols) {
$cols=trim($cols);
if (array_key_exists($cols, $this->type)) {
return $this->$cols;
}
@ -270,7 +273,7 @@ abstract class Data_SQL
{
return $this->$cols;
}
throw new \Exception (" unknow cols [$cols] =".$this,EXC_DATA_SQL);
throw new \Exception (" unknow cols {$this->table}[$cols] =".$this,EXC_DATA_SQL);
}
abstract function insert();

View file

@ -210,7 +210,7 @@ class PDF_Core extends TFPDF
* @see TFPDF::SetFontSize()
* @return void
*/
protected function print_row()
function print_row()
{
static $e=0;
$e++;

View file

@ -62,6 +62,9 @@ function MenuAdmin()
case 'info':
$def=6;
break;
case 'logfile':
$def=9;
break;
}
}
if (!defined("MULTI")||(defined("MULTI")&&MULTI==1))
@ -76,13 +79,17 @@ function MenuAdmin()
array("admin-noalyss.php?action=audit_log",_("Audit"),_("Utilisateurs qui se sont connectés"),4),
array("admin-noalyss.php?action=info",
_("Information système"),('Information à propos de votre installation'),6),
array("admin-noalyss.php?action=logfile"
,_("Trace")
,_("Fichiers erreurs")
,9),
array("login.php",_("Accueil"),"",7),
array("logout.php",_("Sortie"),"",8)
);
if ( SYSINFO_DISPLAY == false ) {
$nb_item = count($tmp_item);
for ($i=0;$i<$nb_item;$i++) {
if ($tmp_item[$i][3] <> 6 ) {
if ($tmp_item[$i][3] <> 6 && $tmp_item[$i][3] <> 9 ) {
$item[]=$tmp_item[$i];
}
}
@ -96,6 +103,10 @@ function MenuAdmin()
array("admin-noalyss.php?action=audit_log",_("Audit"),_("Utilisateurs qui se sont connectés"),4),
array("admin-noalyss.php?action=info",
_("Information système"),('Information à propos de votre installation'),6),
array("admin-noalyss.php?action=logfile"
,_("Trace")
,_("Fichiers erreurs")
,9),
array("login.php",_("Accueil")),
array("logout.php",_("Sortie"))
);

View file

@ -27,6 +27,7 @@
*
*/
if ( !defined ('ALLOWED')) die('Forbidden');
if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
\Noalyss\Dbg::echo_file(__FILE__);
$http=new HttpInput();
$sa = $http->request("sa", "string", 'list');

View file

@ -204,7 +204,9 @@ if (isset($_POST['delete_profil']))
{
throw new Exception('On ne peut pas effacer le profil par défaut');
}
$new_id=$cn->get_value("delete from profile
$cn->exec_sql("delete from profile_mobile
where p_id=$1 ", array($p_id));
$cn->exec_sql("delete from profile
where p_id=$1 ", array($p_id));
$cn->commit();
}

View file

@ -4,7 +4,6 @@ set search_path = public,comptaproc,pg_catalog ;
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
@ -15,14 +14,36 @@ SET row_security = off;
SELECT pg_catalog.lo_create('2346174');
SELECT pg_catalog.lo_create('2346176');
SELECT pg_catalog.lo_create('2346177');
SELECT pg_catalog.lo_create('2346178');
SELECT pg_catalog.lo_create('2346179');
SELECT pg_catalog.lo_create('2346181');
SELECT pg_catalog.lo_create('2346476');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (800, 'Ajout de fiche', 'fiche', 'FICADD');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (805, 'Création, modification et effacement de fiche', 'fiche', 'FIC');
INSERT INTO public.action (ac_id, ac_description, ac_module, ac_code) VALUES (910, 'création, modification et effacement de catégorie de fiche', 'fiche', 'FICCAT');

View file

@ -9,7 +9,7 @@ export TEMPLATE=${DOMAIN}mod1
psql -X $TEMPLATE -c "delete from user_local_pref"
psql -X $TEMPLATE -c "delete from user_local_pref"
pg_dump -Ox -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
sed -i -e "/COMMENT ON EXTENSION/d" schema.sql
sed -i -e "/CREATE EXTENSION/d" schema.sql
sed -ne '0,/ADD CONSTRAINT/p' schema.sql > tmpSchema.sql

View file

@ -3,7 +3,6 @@
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
@ -17,12 +16,6 @@ CREATE SCHEMA comptaproc;
<<<<<<< HEAD
=======
>>>>>>> review-stash
CREATE SCHEMA tva_belge;

View file

@ -9,7 +9,7 @@ export TEMPLATE=${DOMAIN}mod2
psql -X $TEMPLATE -c "delete from user_local_pref"
psql -X $TEMPLATE -c "delete from user_local_pref"
pg_dump -Ox -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
pg_dump -O -U dany -s $TEMPLATE|grep -v "COMMENT ON SCHEMA public IS 'Standard public schema';" |sed "/^--/d" > schema.sql
sed -i -e "/COMMENT ON EXTENSION/d" schema.sql
sed -i -e "/CREATE EXTENSION/d" schema.sql
sed -ne '0,/ADD CONSTRAINT/p' schema.sql > tmpSchema.sql
@ -17,5 +17,5 @@ sed -ne '/ADD CONSTRAINT/,$p' schema.sql |sed -e '1d' > constraint.sql
cp tmpSchema.sql schema.sql
echo "set search_path = public,comptaproc,pg_catalog ;" > data.sql
pg_dump -Ox -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql
pg_dump -O -U dany --data-only --column-inserts -O ${TEMPLATE}|sed "/^--/d" | sed -e "/SET search_path/d" >> data.sql

View file

@ -0,0 +1,45 @@
begin;
CREATE OR REPLACE FUNCTION guess_country_code()
RETURNS void
AS
$$
declare
country_code char(2);
x record;
begin
for x in
select
f1.jft_id
,f1.f_id
,( select f2.ad_value from fiche_detail f2 where f2.f_id=f1.f_id and ad_id= 13) as tva_num
,( select f3.ad_value from fiche_detail f3 where f3.f_id=f1.f_id and ad_id= 16) as country
from
fiche_detail f1
where
f1.ad_id=57
and coalesce(f1.ad_value,'')=''
loop
country_code='';
case
when substr(x.tva_num,1,2) = 'FR' or upper(x.country)='FRANCE' then country_code='FR';
when substr(x.tva_num,1,2) = 'BE' or upper(x.country)='BELGIQUE' then country_code='BE';
when substr(x.tva_num,1,2) = 'LU' or upper(x.country)='LUXEMBOURG' then country_code='LU';
when substr(x.tva_num,1,2) <> '' then country_code=upper(substr(x.tva_num,1,2));
else
country_code='';
end case;
raise notice 'tva_num % country % country_code % jft_id %s',x.tva_num,x.country,country_code,x.jft_id;
if country_code <> '' then
update fiche_detail set ad_value=country_code where jft_id=x.jft_id;
end if;
end loop;
end;
$$
LANGUAGE plpgsql;
select guess_country_code();
insert into version (val,v_description) values (207,'Guess country code ');
commit;

View file

@ -38,11 +38,11 @@ $dossier_id=Dossier::id();
*
*/
?>
<div>
<div class="p-3">
<?php
\Noalyss\Dbg::echo_file(__FILE__);
?>
<div class="row m-0">
<div class="row ">
<div class="col">
<table>
@ -83,7 +83,7 @@ $dossier_id=Dossier::id();
?>
</td>
</tr>
<tr class="font-weight-bolder" style="background: lightsteelblue;color:navy">
<tr class="highlight">
<td style="width: auto" colspan="2" >
<?=$sp->input()?>
</td>
@ -321,8 +321,13 @@ function small(p_id_textarea){
}
</script>
<p style="margin-left:5%;">
<?php echo $title->input();
?>
<?php if ( ! $readonly) : ?>
<?php echo $title->input(); ?>
<?php else: ?>
<span style="font-size:2rem;font-weight:bold;">
<?php echo $title->value; ?>
</span>
<?php endif; ?>
</p>
<div class="nicEdit-main">
<?php
@ -408,11 +413,18 @@ function small(p_id_textarea){
}
}
//---------------------------------- Comment -----------------------------------------------------------------------
//---------------------------------- -----------------------------------
//Comment
//---------------------------------- -----------------------------------
//------------------------------------------------
// Single comment to edit
//------------------------------------------------
if ( Document_Option::can_add_comment($ag_id) &&
Document_Option::option_comment($this->dt_id) == "ONE_EDIT" )
{
echo '<div class="fu_comment_div">';
if (count($acomment) > 1 ) {
echo h2(_("Commentaire"));
$comment=new ITextarea("ag_comment_edit");
@ -451,14 +463,18 @@ function small(p_id_textarea){
}
echo '</span>';
}
echo '</div>';
}
//------------------------------------------------
// Multiple comments
//------------------------------------------------
if ( count($acomment) > 0
if ( count($acomment) > 0
&& Document_Option::can_add_comment($ag_id)
&& Document_Option::option_comment($this->dt_id) == "SOME_FIXED")
{
echo h2(_("Commentaire"));
echo '<div class="fu_comment_div">';
for( $c=1;$c<count($acomment);$c++){
$m_desc=_('Commentaire');
$comment="";
@ -522,6 +538,7 @@ function small(p_id_textarea){
if ($p_view == 'UPD') {
}
echo '</div>';
}

View file

@ -40,7 +40,7 @@ $option_detail= Document_Option::option_operation_detail($document_type);
// default menu for invoice
$menu=new Default_Menu();
?>
<div id="follow_up_detail">
<div id="follow_up_detail" class="p-3">
<?php echo h2(_("Détail opération"),'class="h-section"') ?>
<?php echo HtmlInput::hidden("nb_item", $article_count); ?>
@ -249,4 +249,5 @@ $menu=new Default_Menu();
<?php
endif;
?>
</div>
</div>

View file

@ -23,7 +23,7 @@ $dossier_id=Dossier::id();
?>
<?php if ($access == 'W') : ?>
<form class="print" onsubmit="return op_save(this);">
<form class="print" id="<?=$div?>_frm" onsubmit="return op_save('<?=$div?>_frm');">
<?php endif; ?>
<?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>

View file

@ -18,7 +18,7 @@ $dossier_id=Dossier::id();
?>
<?php if ( $access=='W') : ?>
<form class="print" onsubmit="return op_save(this);">
<form class="print" id="<?=$div?>_frm" onsubmit="return op_save('<?=$div?>_frm');">
<?php endif; ?>
<?php echo HtmlInput::hidden('whatdiv',$div).HtmlInput::hidden('jr_id',$jr_id).dossier::hidden();?>

View file

@ -22,7 +22,7 @@ $dossier_id=Dossier::id();
<div class="content">
<?php if ( $access=='W') : ?>
<form class="print" onsubmit="return op_save(this);">
<form class="print" id="<?=$div?>_frm" onsubmit="return op_save('<?=$div?>_frm');">
<?php endif; ?>
<?php echo HtmlInput::hidden('whatdiv',$div).HtmlInput::hidden('jr_id',$jr_id).dossier::hidden();?>

View file

@ -25,9 +25,9 @@ $str_anc = "";
$owner = new Noalyss_Parameter_Folder($cn);
?>
<?php if ($access == 'W') :
echo '<form class="print" onsubmit="return op_save(this);">';
endif; ?>
<?php if ($access == 'W') :?>
<form class="print" id="<?=$div?>_frm" onsubmit="return op_save('<?=$div?>_frm');">
<?php endif; ?>
<?php echo HtmlInput::hidden('whatdiv', $div) . HtmlInput::hidden('jr_id', $jr_id) . dossier::hidden(); ?>
<table style="width:100%">

View file

@ -62,7 +62,7 @@ global $g_parameter;
$i = 0;
foreach ($avail as $r) {
$array[$i]['value'] = $r['dos_id'];
$array[$i]['label'] = sprintf("%s %s (%s)",$r['dos_id'],$r['dos_name'],substr($r['dos_description']??"",0,50));
$array[$i]['label'] = sprintf("%s %s (%s)",$r['dos_id'],$r['dos_name'],mb_substr($r['dos_description']??"",0,50));
$i++;
}
$sAvail = new ISelect('dos_id');

View file

@ -21,9 +21,7 @@
* \file
* \brief
*/
?>
<?php
$cn=\Dossier::connect();
echo HtmlInput::title_box($p_title, $this->dialog_box_id,"close","","y")
?>
@ -33,6 +31,7 @@ echo HtmlInput::title_box($p_title, $this->dialog_box_id,"close","","y")
<th><?php echo _('Date')?></th>
<th><?php echo _('Code Interne')?></th>
<th><?php echo _('Pièce')?></th>
<th><?php echo _('Tiers')?></th>
<th><?php echo _('Description')?></th>
<th>
<?php echo _('Montant')?>
@ -41,6 +40,17 @@ echo HtmlInput::title_box($p_title, $this->dialog_box_id,"close","","y")
</tr>
<?php
for ($i=0;$i<count($p_array);$i++):
$card_tiers=false;
if ( mb_substr($p_array[$i]['jr_internal'],0,1) =="A") {
$card_tiers=new \Fiche($cn
,$cn->get_value("select distinct qp_supplier from quant_purchase JOIN JRNX using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1"
,[$p_array[$i]['jr_id']]));
} else {
$card_tiers=new \Fiche($cn
,$cn->get_value("select distinct qs_client from quant_sold JOIN JRNX using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1"
,[$p_array[$i]['jr_id']]));
}
?>
<tr class="<?php echo (($i%2)==0)?'odd':'even';?>">
<td>
@ -52,6 +62,14 @@ echo HtmlInput::title_box($p_title, $this->dialog_box_id,"close","","y")
<td>
<?php echo h($p_array[$i]['jr_pj_number'])?>
</td>
<td>
<?php
if ($card_tiers != false )
{
echo \HtmlInput::card_detail($card_tiers->get_quick_code());
}
?>
</td>
<td>
<?php echo h($p_array[$i]['jr_comment']) ?>
</td>

View file

@ -36,6 +36,12 @@ foreach ($array as $item):
if ( $aParam['time_limit'] == 'P' && $today->format('ymd')>$ech->format('ymd') )
continue;
$p++;
$card_tiers=false;
if ( $ledger_type=="ACH") {
$card_tiers=new \Fiche($this->db,$this->db->get_value("select distinct qp_supplier from quant_purchase JOIN JRNX using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1",[$item['jr_id']]));
} else {
$card_tiers=new \Fiche($this->db,$this->db->get_value("select distinct qs_client from quant_sold JOIN JRNX using (j_id) join jrn on (jr_grpt_id=j_grpt) where jrn.jr_id=$1",[$item['jr_id']]));
}
$class=($p&1)?' odd ':'even';
?>
<div class="row <?=$class?>">
@ -45,11 +51,18 @@ foreach ($array as $item):
<div class="col-2">
<?=\HtmlInput::detail_op($item['jr_id'],$item['jr_pj_number'])?>
</div>
<div>
<?php if ($card_tiers != false )
{
echo \HtmlInput::card_detail($card_tiers->get_quick_code());
}
?>
</div>
<div class="col">
<?=h($item['jr_comment'])?>
<?=h($item['jr_date'])?>
</div>
<div class="col-2">
<div class="col-2" style="text-align: right">
<?=nbm($item['jr_montant'],2)?>
</div>
</div>

View file

@ -41,7 +41,7 @@ class Invoice extends Widget
* @return array
*/
static function getConstantLimit() :array {
return ['P' => _("Prochaines factures"), "R" => "facture en retard",'T'=>_("Aujourd'hui")];
return ['P' => _("Prochaines factures"), "R" => _("facture en retard"),'T'=>_("Aujourd'hui")];
}
/**
@ -113,6 +113,7 @@ class Invoice extends Widget
$array = $acc_ledger->get_operation_date(date('d.m.Y'), $ledger_type, '=');
break;
}
include "invoice-display.php";
$this->close_div();