Merge branch 'master' into dev-8-bootstrap

This commit is contained in:
sparkyx 2021-03-12 18:56:29 +01:00
commit 60bb8f50c1
86 changed files with 1374 additions and 741 deletions

View file

@ -31,7 +31,7 @@ PROJECT_NAME = noalyss
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = Version-7.2
PROJECT_NUMBER = Version-8.1
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

View file

@ -552,7 +552,7 @@ EOF;
echo '<div>';
echo '<h1 >'.$ajrn[0]['jrn_def_name'].'</h1>';
if ( trim($ajrn[0]['jrn_def_description']) != "") {
echo '<p style="border:1px solid;margin-top:0px">'.$ajrn[0]['jrn_def_description'].'</p>';
echo '<p style="border:1px solid;margin-top:0px;padding:1rem">'.$ajrn[0]['jrn_def_description'].'</p>';
}
echo '</div>';
}

View file

@ -254,29 +254,20 @@ if (isset($_REQUEST['ac']))
pm_id_v3,pm_id_v2,pm_id_v1
from v_menu_profile where code= upper($1) and p_id=$2',
array($AC,$user_profile));
try {
if ( count($amenu_id) != 1 ) {
// if AC is a simple code and this menu can be accessed
// we should find the first menu which used it and change the
// request AC to it
$pm_id=$cn->get_array('select pm_id from profile_menu '
. ' where lower(me_code)=lower($1) and p_id=$2',
array($AC,$user_profile));
if ( count($pm_id) > 0 ) {
show_menu($pm_id[0]['pm_id']);
return;
} else {
throw new Exception(_('Erreur menu'),10);
}
if (count($amenu_id) == 0 ) { throw new Exception(_('Erreur menu'),10);}
if ( count($amenu_id)> 1) {
$tmp=$amenu_id[0];
$amenu_id=[];
$amenu_id[0]=$tmp;
}
$amenu_id=complete_default_menu($amenu_id,$user_profile);
$AC=rebuild_access_code($amenu_id);
put_global(array(array("key"=>"ac","value"=>$AC)));
$module_id=$cn->get_value('select
$module_id=$cn->get_value('select distinct
case when pm_id_v3 = 0 then (case when pm_id_v2 = 0 then pm_id_v1 else pm_id_v2 end) else pm_id_v3 end
from
v_menu_profile

View file

@ -106,7 +106,9 @@ else
{
if (isset($_REQUEST['type']))
{
if ($_REQUEST['type']=='gl' || $_REQUEST['type']=='') $filter_card='';
if ($_REQUEST['type']=='gl' || $_REQUEST['type']=='') {
$filter_card='';
}
else
{
$get_cred='jrn_def_fiche_cred';
@ -168,7 +170,7 @@ if ($sql != false && sizeof($sql) != 0 )
echo '</ul>';
if (count($sql) > 12)
{
printf ('<i>...'._('Résultat limité à 12').' ...</i>');
printf ('<i>...'._('Résultat limité à %s').' ...</i>',$limit);
}
}
else

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

View file

@ -142,7 +142,7 @@ BODY {
position:absolute;
z-index:-1;
height:auto;
width:10%;
width:125px;
left:1%;
top:30px;
@ -196,11 +196,12 @@ BODY {
}
#recover_link {
position:absolute;
margin-top:397px;
/*! margin-top:397px; */
left:1px;
background-color: white;
bottom: initial;
width: 20rem;
bottom: 30px;
}
}
@media only screen and (min-width : 1100px) {
@ -228,9 +229,9 @@ BODY {
width: 24rem;
}
#recover_link {
position:absolute;
top:397px;
position:fixed;
left:539px;
bottom:2px;
background-color: white;
width:auto;
@ -274,9 +275,9 @@ BODY {
width: 24rem;
}
#recover_link {
position:absolute;
top:55%;
position:fixed;
left:55%;
bottom:20px;
background-color: white;
margin-top:0px;
}

View file

@ -191,7 +191,7 @@ if (isset ($_REQUEST['reconnect']) && isset ($_REQUEST['backurl'])) {
}
echo '
<IMG SRC="image/logo8000.png" id="logo_id" alt="NOALYSS">
<IMG SRC="image/logo8100.png" id="logo_id" alt="NOALYSS">
<form id="login_frm" action="login.php" method="post" name="loginform">'.
'<h1>Noalyss</h1>'.
$goto .

View file

@ -83,7 +83,7 @@
</head>
<body>
<p align="center">
<IMG SRC="image/logo8000.png" style="width: 30%;z-index:-1;position:fixed;top:30%;margin-left: 20%;opacity: 0.2" alt="NOALYSS">
<IMG SRC="image/logo8100.png" style="width: 30%;z-index:-1;position:fixed;top:30%;margin-left: 20%;opacity: 0.2" alt="NOALYSS">
</p>
<h1>NOALYSS : comptabilité - accountancy </h1>

View file

@ -596,7 +596,8 @@ function fill_ipopcard(obj)
if ( nTop > 300 ) {
nTop=170;
}
var str_top=fixed_position(250,nTop)
var str_top="top:"+calcy(nTop)+"px";
var str_style=str_top+";width:45em;height:auto;position:absolute";
var popup={'id': content,'cssclass':'inner_box','style':str_style,'html':loading(),'drag':false};

View file

@ -65,3 +65,51 @@ function displayBulle(p_comment) {
d.style.left=posX+offsetX+"px";
d.style.visibility="visible";
}
/**
*
* @param p_name
* @see select_box.class.php
*/
function displaySelectBox(p_name) {
try {
if (! document.getElementById("select_box_content") ) {
var newDiv=new Element("div");
newDiv.id="select_box_content";
document.body.appendChild(newDiv);
newDiv.addClassName("select_box");
$("select_box_content").onmouseleave=function() {
try {
var newDiv=$("select_box_content");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}
} else {
var newDiv=document.getElementById("select_box_content");
}
newDiv.innerHTML=$("select_box"+p_name).innerHTML;
var viewport = document.viewport.getDimensions();
var locPosY=posY;
if ( posY+offsetY+ newDiv.getHeight() > window.innerHeight -3) {
locPosY-=newDiv.getHeight()+20
}
newDiv.style.top=locPosY+"px";
newDiv.style.left=document.getElementById(p_name+"_bt").offsetLeft+"px";
newDiv.setStyle({display:"block",position:"absolute","z-index":999});
if ( $("search_"+p_name+"_list") ) {
var sTmp = newDiv.innerHTML;
var regex=new RegExp(p_name+"_list","g");
sTmp = sTmp.replace(regex,p_name+"_t_list");
newDiv.innerHTML=sTmp;
$("search_"+p_name+"_t_list").focus();
}
} catch(e) {
alert(e.message);
}
}

View file

@ -74,7 +74,7 @@ var ManageTable = function (p_table_name)
{
this.callback = "ajax.php"; //!< File to call
this.control = "dtr"; //<! Prefix Id of dialog box, table, row
this.mt_style={position: "fixed", top: '15%', width: "auto", "margin-left": "20%"};
this.mt_style={position: "fixed", top: '15%', width: "auto", "max-width":"60%","margin-left": "20%"};
this.sort_column=0;
this.param = {"table": p_table_name, "ctl_id": this.control}; //<! default value to pass
this.set_style=function(p_json) {
@ -311,6 +311,11 @@ var ManageTable = function (p_table_name)
var obj = {id: control, "cssclass": "inner_box", "html": loading()};
add_div(obj);
var pos = calcy(250);
if (window.innerWidth < 1200) {
here.mt_style["margin-left"]="2%";
here.mt_style["max-width"]="80%";
}
console.log(here.mt_style);
$(obj.id).setStyle(here.mt_style);
$(obj.id).update(x['html']);
} catch (e) {

View file

@ -330,6 +330,16 @@ function format_number(obj, p_prec)
$(obj).value = value;
}
/**
* Replace slash and minus by dot
* @param p_object
*/
function format_date(p_object)
{
p_object.value=p_object.value.replace(/\//g,'.');
p_object.value=p_object.value.replace(/-/g,'.');
}
/**
*@brief check if the object is hidden or show and perform the opposite,
* show the hidden obj or hide the shown one
@ -3955,3 +3965,62 @@ var operation_tag = function (p_div)
});
};
};
/**
* Check the sum of size of all the FILES to upload
* @param p_object the form DOM object,
* @param p_max_size MAX_FILE_SIZE constant (see config.inc.php or constant.php)
* @returns true if the sum of filesize is greater than the limit
*/
function check_file_size(p_object,p_max_size)
{
var sum_file=0;
for(var i=0;i<p_object.elements.length;i++) {
var a=p_object.elements[i];
if ( p_object.elements[i].getAttribute('type')=="file" )
{
if( p_object.elements[i].files[0]){
sum_file+=p_object.elements[i].files[0].size;
}
}
}
if ( sum_file > p_max_size) {alert_box(content[78]);return false;}
return true;
}
/**
* Check that the receipt file is not too big
* @see ajax_ledger.php , ledger_detail_file
* @param int p_max_size maximum size
* @param p_info name of the waiting box
* @returns true if file size is less than the maximum
*/
function check_receipt_size(p_max_size,p_info)
{
document.getElementById(p_info).style.display="inline";
console.debug ("param p_max_file_size"+p_max_size);
var f=document.getElementById("receipt_id");
if ( f && f.files[0] && f.files[0].size > parseFloat(p_max_size)) {
document.getElementById("receipt_info_id").innerHTML=content[78];
document.getElementById(p_info).style.display="none";
return false;
}
document.getElementById("receipt_info_id").innerHTML="";
document.getElementById("form_file").submit();
return true;
}
/**
* @brief toggle size of a div : fullsize or normal
*
*/
function full_size(p_div) {
div_dom=document.getElementById(p_div);
if ( ! div_dom ) return;
if ( div_dom.hasClassName('fullsize')) {
div_dom.removeClassName('fullsize');$('size_'+p_div).innerHTML='&#xe82a;';
} else {
div_dom.addClassName('fullsize');$('size_'+p_div).innerHTML='&#xe83d;';
}
}

View file

@ -40,13 +40,13 @@ input{
font-family: 'OpenSansRegular';
padding : 2px;
margin:2px;
border:solid 1px #4b4b91;
border:1px solid #4b4b91;
font-size:14px;
color:#4b4b91;
}
input:focus {
border:solid 1px orange;
border:1px solid orange;
margin:1px;
background-color: lightyellow;
}
@ -64,7 +64,7 @@ table.sortable, table.table_large, table.result ,table.resultfooter {
border-spacing: 1px;
/*border-collapse:collapse; */
border:1px #5D90CD solid;
border:1px solid #5D90CD;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
@ -238,7 +238,7 @@ table.document th{
}
table.mtitle {
border:0;
border:0px;
text-align:center;
/*! border-spacing: 0; */
}
@ -246,7 +246,7 @@ td.mshort {
height:15px;
width:60px;
text-align:center;
border: 1px solid;
border: 1px solid transparent;
color:#5D90CD ;
background-color:#DDE6FF;
}
@ -264,6 +264,7 @@ td.mtitle {
border-bottom-left-radius: 0px;
border-collapse: collapse;
background-color: #366497;
}
@media only screen and (max-width:1250px) {
td.mtitle {
@ -278,16 +279,15 @@ td.mtitle {
}
}
td.mtitle a.mtitle {
color : white;
color : lightblue;
display:block;
font-size:1rem;
font-family:OpenSansRegular;
/*! width:100%; */
padding:0px;
margin:0px;
height:100%;
height:42px;
padding:4px 0px 0px 0px;
border-radius:6px;
}
@media only screen and (max-width:1280px) {
td.mtitle a.mtitle {
@ -353,7 +353,8 @@ td.selectedcell{
}
}
.menu2 td.mtitle ,.menu2 td.selectedcell{
border-radius: 0px;
/*! border-radius: 0px; */
border-radius: 4px;
}
@media only screen and (max-width:955px) {
@ -367,7 +368,7 @@ a.mtitle {
text-decoration:none;
display:inline;
color: #0000FF;
pointer:cursor;
cursor: pointer;
background-color: transparent;
}
a.mtitle:hover {
@ -511,18 +512,18 @@ a.document:hover {
}
.input_text_ro {
border:solid 1px #0000FF;
border:1px solid #0000FF;
background:#EDEDED;
color:#0000FF;
margin:1px;
}
.input_text {
border:solid text #4b4b91;
border:1px solid #4b4b91;
margin:1px;
border-radius: 2px;
}
.input_text:focus {
border:solid 1px orange;
border:1px solid orange;
margin:1px;
background-color: lightyellow;
}
@ -684,7 +685,7 @@ div.content div.pc_calendar tr{
}
div.pc_calendar td{
width:14%;
border:#879ED4 solid 1px;
border:1px solid #879ED4 ;
}
div.pc_calendar td.weekend {
@ -753,7 +754,7 @@ a#anchorbutton:hover, .button:hover,a.button:hover,div.content a.button:hover {
}
a#smallanchorbutton, .smallbutton, a.smallbutton,div.content a.smallbutton {
color:#FFFFFF;
font-weight: bold;
font-weight: normal;
text-decoration:none;
font-family: arial,verdana,sans-serif,helvetica;
/*! background-image: url("image/bg-submit2.gif"); */
@ -804,7 +805,7 @@ a#smallanchorbutton, .smallbutton, a.smallbutton,div.content a.smallbutton .butt
font-family: SansationLight;
}
td.tool {
border: solid 1px gray;
border: 1px solid gray;
background-color: #FFFFFF;
border-bottom-width: 2px;
text-align:center;
@ -819,7 +820,7 @@ td.tool {
}
}
td.toolselected {
border: solid 1px gray;
border: 1px solid gray;
color: #FFFFFF;
border-bottom-width: 2px;
text-align:center;
@ -922,7 +923,7 @@ div.inner_box {
/*! -webkit-box-shadow: 10px 10px 5px #888; */
box-shadow: 15px 15px 15px #888;
font-size:14.4px;
font-size:0.90rem;
font-size:0.9rem;
}
div.inner_box {
width: 85%;
@ -930,7 +931,7 @@ div.inner_box {
@media only screen and (min-width: 1281px) {
div.inner_box {
width: 85%;
/*! border-radius: 9px; */
border-radius: 9px;
/*! padding: 5px; */
}
}
@ -1219,7 +1220,7 @@ div.foldercontent {
font-size:0.95rem;
width: 95%;
margin-left: 2.5%;
margin-top:7%;
margin-top:5rem;
}
h1.title {
@ -1230,17 +1231,25 @@ h1.title {
}
h2.title {
color:#FFFFFF;
color:white;
text-align:center;
padding-top: 9px;
margin-top: 0px;
padding-bottom: 2px;
background-color: #366497;
font-size: 1.05rem;
background-color: #5681B7;
font-size: 1.1rem;
height: 35px;
vertical-align: middle;
border-bottom: white;
border-bottom-style: groove;
border-bottom-width: 2px;
font-style: normal;
font-stretch: normal;
font-variant-caps: all-small-caps;
font-family: OpenSansRegular;
margin-bottom: 1px;
}
h3.title {
color: #0000FF;
@ -1262,7 +1271,7 @@ div.myfieldset
margin-top: 5px;
margin-left:5px;
margin-right: 5px;
border:#EDF3FF 2px groove;
border:2px groove #EDF3FF ;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
@ -1288,7 +1297,7 @@ div.menu2 a.mtitle{
/*color: darkblue;*/
padding:5px 0px;
margin:0px;
border-radius: 5px;
/*! border-radius: 5px; */
}
div.menu2 a.mtitle:hover,div.menu a.mtitle:hover,td.mtitle a.mtitle:hover {
/* color:#5681B7;
@ -1300,11 +1309,11 @@ div.menu2 a.mtitle:hover,div.menu a.mtitle:hover,td.mtitle a.mtitle:hover {
}
div.menu2 a.mtitle:hover {
border-radius: 0px 0px;
/*! border-radius: 0px 0px; */
/*! padding: 5px; */
}
div.menu2 table {
border-collapse: collapse;
border-collapse: separate;
/*! border-spacing:1px; */
}
div.menu3 {
@ -1334,14 +1343,14 @@ div.menu3 {
font-size : 1.2em;
}*/
textarea.itextarea{
border:solid #0000FF 1px;
border:1px solid #0000FF ;
width:90%;
margin-left:5%;
height:120px;
}
textarea.itextarea:focus {
border:solid 1px orange;
border:1px solid orange;
background-color: lightyellow;
}
div#notice {
@ -1532,7 +1541,8 @@ td.workday ol {
input.inum {
text-align:right;
border:1px solid #0000FF;
margin:2px
margin:2px;
border-radius: 2px;
}
div.box {
background-color:#e4e7ed;
@ -1977,8 +1987,8 @@ td.box {
right: 0px;
visibility: hidden;
opacity: 0;
background: rgba(0,0,0,.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#90000000,endColorstr=#900000000);
background-color: rgba(0,0,0,.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#90000000,endColorstr=#90000000);
}
.smoke-base.smoke-visible {
@ -2217,7 +2227,7 @@ div.content a.arrow {
* Select box : list of actions
*/
.select_box {
border:solid 0.5px darkblue;
border:0.5px solid darkblue;
background:white;
width:455px;
max-width:250px;
@ -2256,8 +2266,9 @@ div.menu2 td.mtitle, div.menu2 td.mtitle a{
border-style: solid;
border-width: 0.1px;
border-color:white;
height:35px;
height:40px;
border-radius: 4px 4px 4px 4px;
/*! padding: 5px; */
}
div.menu2 td.mtitle a{
border-width:0px;
@ -2282,7 +2293,7 @@ div.menu2 td.mtitle a{
*/
div.bxbutton .icon
{
color:white;
/*! color:white; */
text-decoration:none;
margin-left: 6px;
margin-right:6px;
@ -2292,6 +2303,8 @@ div.bxbutton .icon
cursor: pointer;
border:0px;
height: 18px;
color: #f0d19a;
font-size: 87%;
}
div.bxbutton .icon:hover
{
@ -2488,7 +2501,6 @@ p.info {
/* Cell with tag */
span.tagcell {
border-radius:3px;
border:1px solid darkblue;
padding:3px;margin:1px;
display: inline-block;
}
@ -2655,3 +2667,23 @@ span.tagcell {
padding: 0.25em 1em 0.25em 1em;
font-family: bold;
}
/**
* set a element full size
*/
.fullsize {
width:100% !important;
height: 100% !important;
overflow:auto !important;
top:0px !important;
position:fixed !important;
left:0px !important;
}
/*********************************************
* If a input is incorrect
*/
.input-error {
border:1px dotted red !important;
color:darkred !important;
}

View file

@ -38,12 +38,12 @@ require_once('lib/icon_action.class.php');
require_once ('lib/function_javascript.php');
require_once 'class/user.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
html_page_start();
global $http;
$http=new HttpInput();
load_all_script();
$gDossier=$http->request('gDossier',"number", -1);
if ($gDossier==-1)
{
@ -64,7 +64,7 @@ if (!file_exists('authorized_debug'))
exit();
}
define('ALLOWED', 1);
html_page_start("Classic");
load_all_script();
/******************************************************************************************************************/
/* Utilities
/******************************************************************************************************************/

View file

@ -225,7 +225,8 @@ if ($sub_action == 'detail')
if ($g_user->can_write_action($ag_id) == true)
{
echo '<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php" method="post" style="display:inline">';
printf( '<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php"
method="post" style="display:inline" onsubmit="return check_file_size(this,%s)">',MAX_FILE_SIZE);
echo $supl_hidden;
echo HtmlInput::hidden('ac', $http->request('ac'));
echo dossier::hidden();

View file

@ -110,14 +110,23 @@ switch($op2)
case 'dc':
$f=new Fiche($cn);
/* add title + close */
$html=HtmlInput::title_box(_("Détail fiche"), $ctl,"close","","y");
$qcode=$http->request("qcode","string",false);
// if there is no qcode then try to find it thanks the card id
if ( ! isset ($qcode) ){
$f->id=$http->get("f_id","number");
if ( $qcode == false ){
$f->id=$http->get("f_id","number","0");
if ( $f->id==0) {
$html=HtmlInput::title_box(_("Fiche"), $ctl,"close","","y");
$html.='<h2 class="error">'._('Aucune fiche demandée').'</h2>';
break;
}
$qcode=$f->get_quick_code();
} else {
$f->get_by_qcode($qcode);
}
$title=$f->getLabelCategory();
$html=HtmlInput::title_box($title, $ctl,"close","","y");
// after save , we can either show a card in readonly or update a row
$safter_save=$http->request("after_save","string","1");
switch ($safter_save)
@ -134,22 +143,21 @@ case 'dc':
break;
}
if ( $qcode != '')
if ( $qcode != null)
{
$f->get_by_qcode($qcode);
$can_modify=$g_user->check_action(FIC);
if ( isset($ro) )
{
$can_modify=0;
}
if ( $can_modify==1)
$card=$f->Display(false,$ctl);
else
$card=$f->Display(true);
if ( $card == 'FNT' )
{
$html.='<h2 class="error">'._('Fiche non trouvée').'</h2>';
}
$can_modify=$g_user->check_action(FIC);
if ( isset($ro) )
{
$can_modify=0;
}
if ( $can_modify==1)
$card=$f->Display(false,$ctl);
else
$card=$f->Display(true);
if ( $card == 'FNT' )
{
$html.='<h2 class="error">'._('Fiche non trouvée').'</h2>';
}
else
{
@ -192,11 +200,11 @@ case 'dc':
case 'bc':
if ( $g_user->check_action(FICADD)==1 || $g_user->check_action(FIC)==1)
{
$r=HtmlInput::title_box(_("Nouvelle fiche"), $ctl);
/* get cat. name */
$cat_name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',
/* get cat. name */
$cat_name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',
array($fd_id));
$f=new Fiche($cn);
$r=HtmlInput::title_box($cat_name, $ctl);
$f=new Fiche($cn);
$r.='<form id="save_card" method="POST" onsubmit="this.ipopup=\''.$ctl.'\';save_card(this);return false;" >';
$r.=dossier::hidden();
$r.=(isset($ref))?HtmlInput::hidden('ref',1):'';

View file

@ -224,8 +224,7 @@ case 'file':
$obj=$op->get_quant(); /* return an obj. ACH / FIN or VEN or null if nothing is found*/
$repo = new Database();
$theme = $repo->get_value("select the_filestyle from theme where the_name=$1", array($_SESSION[SESSION_KEY.'g_theme']));
html_min_page_start($theme);
html_min_page_start($_SESSION[SESSION_KEY.'g_theme']);
// if there is a receipt document
if ( $obj->det->jr_pj_name=='')
@ -238,7 +237,9 @@ case 'file':
}
if ( $access=='W')
{
echo '<FORM METHOD="POST" ENCTYPE="multipart/form-data" id="form_file">';
$check_receipt=sprintf("check_receipt_size('%s','file%s')",
MAX_FILE_SIZE,$div);
echo '<FORM METHOD="POST" ENCTYPE="multipart/form-data" id="form_file" >';
$sp=new ISpan('file'.$div);
$sp->style="display:none;background-color:red;color:white;font-size:12px";
@ -248,8 +249,10 @@ case 'file':
echo dossier::hidden();
echo HtmlInput::hidden('jr_id',$jr_id);
echo HtmlInput::hidden('div',$div);
echo '<INPUT TYPE="FILE" id="receipt_id" name="pj" onchange="'.$check_receipt.'">';
echo '<p id="receipt_info_id" class="error"></p>';
echo '<INPUT TYPE="FILE" name="pj" onchange="getElementById(\'file'.$div.'\').style.display=\'inline\';submit(this);">';
echo '</FORM>';
}
else
@ -285,17 +288,20 @@ case 'file':
{
// Not possible to remove the file thanks a modal dialog box,
// because of the frameset
$x=sprintf('<a class="smallbutton icon" style="margin-left:12;margin-right:12" href="ajax_misc.php?op=ledger&gDossier=%d&div=%s&jr_id=%s&act=rmf" onclick="return confirm(\'Effacer le document ?\')">'."x".'</a>',
$gDossier,$div,$jr_id);
$x=Icon_Action::trash(uniqid(),
sprintf("if (confirm(content[47])) {document.location.href='ajax_misc.php?op=ledger&gDossier=%d&div=%s&jr_id=%s&act=rmf'}",
$gDossier,$div,$jr_id));
}
$filename= $obj->det->jr_pj_name;
if ( strlen($obj->det->jr_pj_name) > 20 )
if ( strlen($obj->det->jr_pj_name) > 60 )
{
$filename=mb_substr($obj->det->jr_pj_name,0,23);
$filename=mb_substr($obj->det->jr_pj_name,0,60);
}
echo HtmlInput::show_receipt_document($jr_id,h($filename));
echo $x;
echo '<p id="receipt_info_id" class="error"></p>';
echo '</div>';
echo '</body></html>';
exit();
@ -314,29 +320,24 @@ case 'loadfile':
// Show a link to the new file
$op->get();
$obj=$op->get_quant(); /* return an obj. ACH / FIN or VEN or null if nothing is found*/
echo "<html><head>";
$repo=new Database();
$theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION[SESSION_KEY.'g_theme']));
echo " <LINK REL=\"stylesheet\" type=\"text/css\" href=\"$theme\" media=\"screen\">";
echo "</head>";
html_min_page_start($_SESSION[SESSION_KEY.'g_theme']);
if ( ! isset($_REQUEST['ajax']) ) echo "<body class=\"op_detail_frame\">"; else echo "<body>";
echo "<h2>"._("Document")."</h2>";
echo '<div class="op_detail_frame">';
$x="";
// check if the user can remove a document
if ($g_user->check_action (RMRECEIPT) == 1) {
// Not possible to remove the file thanks a modal dialog box,
// because of the frameset
$x=sprintf('<a class="mtitle" class="notice" style="margin-left:12;margin-right:12px" href="ajax_misc.php?op=ledger&gDossier=%d&div=%s&jr_id=%s&act=rmf" onclick="return confirm(\'Effacer le document ?\')">'.SMALLX.'</a>',
$gDossier,$div,$jr_id);
echo $x;
$x=Icon_Action::trash(uniqid(),
sprintf("if (confirm(content[47])) {document.location.href='ajax_misc.php?op=ledger&gDossier=%d&div=%s&jr_id=%s&act=rmf'}",
$gDossier,$div,$jr_id));
}
$filename= $obj->det->jr_pj_name;
echo HtmlInput::show_receipt_document($jr_id,h($filename));
echo $x;
echo '</div>';
echo '</body></html>';
}
exit();
/////////////////////////////////////////////////////////////////////////////
@ -345,16 +346,14 @@ case 'loadfile':
case 'rmf':
if ( $access == 'W' && $g_user->check_action (RMRECEIPT) == 1)
{
echo "<html><head>";
$repo=new Database();
$theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION[SESSION_KEY.'g_theme']));
echo " <LINK REL=\"stylesheet\" type=\"text/css\" href=\"$theme\" media=\"screen\">";
echo "</head><body class=\"op_detail_frame\">";
echo "<h2>"._("Document")."</h2>";
html_min_page_start($_SESSION[SESSION_KEY.'g_theme']);
echo '<div class="op_detail_frame">';
$check_receipt=sprintf("check_receipt_size('%s','file%s')",
MAX_FILE_SIZE,$div);
echo '<FORM METHOD="POST" ENCTYPE="multipart/form-data" id="form_file">';
$sp=new ISpan('file'.$div);
$sp->style="display:none;width:155;height:15;background-color:red;color:white;font-size:10";
$sp->style="display:none;width:155px;height:15px;background-color:red;color:white;font-size:10px";
$sp->value=_("Chargement");
echo $sp->input();
@ -363,7 +362,8 @@ case 'rmf':
echo HtmlInput::hidden('jr_id',$jr_id);
echo HtmlInput::hidden('div',$div);
echo '<INPUT TYPE="FILE" name="pj" onchange="getElementById(\'file'.$div.'\').style.display=\'inline\';submit(this);">';
echo '<INPUT TYPE="FILE" id="receipt_id" name="pj" onchange="'.$check_receipt.'">';
echo '<p id="receipt_info_id" class="error"></p>';
echo '</FORM>';
$ret=$cn->exec_sql("select jr_pj from jrn where jr_id=$1",array($jr_id));
if (Database::num_row($ret) != 0)

View file

@ -213,6 +213,7 @@ if ($op=="delete_search_operation")
if ($op=='display_filter_tag')
{
$tag=$http->request("uf_tag");
if ( trim($tag)=="") {return;}
$div=$http->request("div");
$aTag=explode(',', $tag);
if (is_array($aTag))

View file

@ -10,7 +10,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
echo '<div style="content">';
global $http;
require_once NOALYSS_INCLUDE.'/class/anc_grandlivre.class.php';
$cn=Dossier::connect();
$grandLivre=new Anc_Grandlivre($cn);
$grandLivre->get_request();
@ -35,18 +35,25 @@ if ($result != null)
echo _('Tout sélectionner')." ".ICheckBox::toggle_checkbox('export_pdf_bt1','export_anc_receipt_pdf');
echo '</span>';
$task_id=uniqid();
echo $grandLivre->show_button();
printf ('<form method="GET" id="export_anc_receipt_pdf" action="export.php" style="display:inline" onsubmit="return start_export_anc_receipt_pdf(\'%s\',\'%s\');">',
$task_id,
_("Le traitement est en cours , merci de patienter sans recharger la page")
);
echo $grandLivre->button_export_csv();
printf ('<form method="GET" id="export_anc_receipt_pdf" action="export.php"
style="display:inline" onsubmit="return start_export_anc_receipt_pdf(\'%s\',\'%s\');">',
$task_id,
_("Le traitement est en cours , merci de patienter sans recharger la page")
);
echo HtmlInput::hidden("task_id",$task_id);
$type_pdf=new Select_Box("type_pdf",_("Type export PDF"));
$type_pdf->add_value(_("Un seul PDF"),1);
$type_pdf->add_value(_("Un PDF par opération"),2);
$type_pdf->set_position("in-absolute");
echo $type_pdf->input();
echo $grandLivre->button_export_pdf();
echo $grandLivre->display_html();
echo $grandLivre->button_export_pdf();
echo HtmlInput::get_to_hidden(array('ac','gDossier','sa'));
echo $grandLivre->button_export_pdf();
echo '</form>';
echo $grandLivre->show_button();
echo $grandLivre->button_export_csv();
?>
<script>
function start_export_anc_receipt_pdf(p_task_id,p_message)
@ -60,11 +67,16 @@ if ($result != null)
break;
}
}
if (document.getElementById("type_pdf").value == "-1" )
{
valid=false;
}
if ( valid ) {
progress_bar_start(p_task_id,p_message);
return true;
} else {
smoke.alert("<?=_('Choisissez au moins une opération')?>");
smoke.alert("<?=_('Choisissez au moins une opération et le type d\'export')?>");
return false;
}

View file

@ -207,7 +207,11 @@ if ( isset ($_GET['view'] ) )
{
$hid=new IHidden();
$from_periode=$http->get("from_periode","number");
$to_periode=$http->get("to_periode","number");
$from_poste=$http->get("from_poste","string");
$to_poste=$http->get("to_poste","string");
$p_filter=$http->get("p_filter");
echo "<table>";
echo '<TR>';
@ -217,9 +221,9 @@ if ( isset ($_GET['view'] ) )
HtmlInput::hidden("ac",$_REQUEST['ac']).
HtmlInput::hidden("act","PDF:balance").
HtmlInput::hidden("summary", $is_summary).
HtmlInput::hidden("from_periode",$_GET['from_periode']).
HtmlInput::hidden("to_periode",$_GET['to_periode']);
echo HtmlInput::hidden('p_filter',$_GET['p_filter']);
HtmlInput::hidden("from_periode",$from_periode).
HtmlInput::hidden("to_periode",$to_periode);
echo HtmlInput::hidden('p_filter',$p_filter);
for ($e=0;$e<count($selected);$e++)
if (isset($selected[$e]) && in_array ($selected[$e],$array))
echo HtmlInput::hidden("r_jrn[$e]",$selected[$e]);
@ -227,8 +231,8 @@ if ( isset ($_GET['view'] ) )
if (isset($select_cat[$e]))
echo HtmlInput::hidden("r_cat[$e]",$e);
echo HtmlInput::hidden("from_poste",$_GET['from_poste']).
HtmlInput::hidden("to_poste",$_GET['to_poste']);
echo HtmlInput::hidden("from_poste",$from_poste).
HtmlInput::hidden("to_poste",$to_poste);
echo HtmlInput::get_to_hidden(array('lvl1','lvl2','lvl3','unsold','previous_exc'));
echo "</form></TD>";
@ -237,10 +241,10 @@ if ( isset ($_GET['view'] ) )
HtmlInput::submit('bt_csv',"Export CSV").
dossier::hidden().
HtmlInput::hidden("act","CSV:balance").
HtmlInput::hidden("from_periode",$_GET['from_periode']).
HtmlInput::hidden("to_periode",$_GET['to_periode']);
HtmlInput::hidden("from_periode",$from_periode).
HtmlInput::hidden("to_periode",$to_periode);
echo HtmlInput::get_to_hidden(array('ac'));
echo HtmlInput::hidden('p_filter',$_GET['p_filter']);
echo HtmlInput::hidden('p_filter',$p_filter);
for ($e=0;$e<count($selected);$e++){
if (isset($selected[$e]) && in_array ($selected[$e],$array)){
echo HtmlInput::hidden("r_jrn[$e]",$selected[$e]);
@ -250,8 +254,8 @@ if ( isset ($_GET['view'] ) )
if (isset($select_cat[$e]))
echo HtmlInput::hidden("r_cat[$e]",$e);
echo HtmlInput::hidden("from_poste",$_GET['from_poste']).
HtmlInput::hidden("to_poste",$_GET['to_poste']);
echo HtmlInput::hidden("from_poste",$from_poste).
HtmlInput::hidden("to_poste",$to_poste);
echo HtmlInput::get_to_hidden(array('unsold','previous_exc'));
echo "</form></TD>";
@ -295,9 +299,11 @@ if ( isset($_GET['view'] ) )
$previous= (isset ($row[0]['sum_cred_previous']))?1:0;
$periode=new Periode($cn);
$a=$periode->get_date_limit($_GET['from_periode']);
$b=$periode->get_date_limit($_GET['to_periode']);
echo "<h2 class=\"info\"> période du ".$a['p_start']." au ".$b['p_end']."</h2>";
$a=$periode->get_date_limit($from_periode);
$b=$periode->get_date_limit($to_periode);
echo '<h2>';
printf ( _("période du %s au %s"),$a['p_start'],$b['p_end']);
echo '</h2>';
echo '<span style="display:block">';
echo _('Cherche').Icon_Action::infobulle(24);
echo HtmlInput::filter_table("t_balance", "0,1","1");

View file

@ -272,8 +272,8 @@ class Acc_Bilan
throw new Exception(_("le formulaire id n'est pas donnee"));
$sql="select b_name,b_file_template,b_file_form,lower(b_type) as b_type from bilan where".
" b_id = ".$this->b_id;
$res=$this->db->exec_sql($sql);
" b_id = $1";
$res=$this->db->exec_sql($sql,[$this->b_id]);
if ( Database::num_row($res)==0)
throw new Exception (_('Aucun enregistrement trouve'));
@ -284,7 +284,7 @@ class Acc_Bilan
}
catch(Exception $Ex)
{
record_log($e);
record_log($e);
echo $Ex->getMessage();
throw $Ex;
}
@ -401,7 +401,7 @@ class Acc_Bilan
$regex="/&lt;&lt;\\$[A-Z]*[0-9]*&gt;&gt;/";
$lt="&lt;";
$gt="&gt;";
$header_txt=header_txt($this->db);
$header_txt=utf8_encode(header_txt($this->db));
while ( !feof($p_file) )
{
@ -656,7 +656,8 @@ class Acc_Bilan
ob_start();
// save the file in a temp folder
// create a temp directory in /tmp to unpack file and to parse it
$dirname=tempnam($_ENV['TMP'].DIRECTORY_SEPARATOR.'tmp','bilan_');
// bug PHP 7 tempnam throw a notice
$dirname=@tempnam($_ENV['TMP'].DIRECTORY_SEPARATOR.'tmp','bilan_');
unlink($dirname);

View file

@ -883,7 +883,7 @@ class Acc_Ledger extends jrn_def_sql
$ret.=HtmlInput::hidden('jrn_type', $this->get_type());
$info=Icon_Action::infobulle(0);
$info_poste=Icon_Action::infobulle(9);
$ret.='<table id="quick_item" style="position:float;width:100%">';
$ret.='<table id="quick_item" style="width:100%">';
$ret.='<tr>'.
'<th style="text-align:left">Quickcode'.$info.'</th>'.
'<th style="text-align:left">'._('Poste').$info_poste.'</th>'.
@ -1087,7 +1087,7 @@ class Acc_Ledger extends jrn_def_sql
throw new Exception(
sprintf (
_('Vous utilisez le mode strict la dernière operation est la date du %s
vous ne pouvez pas encoder à une date antérieure',$last_date)),
vous ne pouvez pas encoder à une date antérieure'),$last_date),
15);
}
@ -2040,7 +2040,7 @@ class Acc_Ledger extends jrn_def_sql
echo '<input type="hidden" value="'.$id.'" name="p_jrn">';
$op=new Pre_operation($cn);
$op->p_jrn=$id;
$op->od_direct='t';
if ($op->count()!=0)
{
echo HtmlInput::submit('use_opd',

View file

@ -218,16 +218,23 @@ class Acc_Ledger_Fin extends Acc_Ledger
throw new Exception('Il n\'y a aucune opération', 12);
/* Check if the last_saldo and first_saldo are correct */
if (strlen(trim($last_sold)) != 0 && isNumber($last_sold) &&
strlen(trim($first_sold)) != 0 && isNumber($first_sold))
if (strlen(trim($last_sold)) != 0
&& isNumber($last_sold)
&& strlen(trim($first_sold)) != 0
&& isNumber($first_sold)
)
{
$diff = $last_sold - $first_sold;
$diff = round($diff, 2) - round($tot_amount, 2);
if ($first_sold != 0 && $last_sold != 0)
$calc=bcadd($first_sold,$tot_amount,4);
if ($first_sold != 0 || $last_sold != 0)
{
if ($diff != 0)
throw new Exception('Le montant de l\'extrait est incorrect' .
$tot_amount . ' extrait ' . $diff, 13);
if ($diff != 0) {
throw new Exception(sprintf( _('Le montant de l\'extrait [%s] est incorrect,'.
" solde calculé [%s] , différence de [%s]") ,
$last_sold,$calc,$diff),13);
}
}
}
}
@ -648,7 +655,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
$r.='</table>';
// check for upload piece
$file = new IFile();
$file->setAlertOnSize(true);
$r.="<br>"._("Ajoutez une pièce justificative")." ";
$r.=$file->input("pj", "");

View file

@ -1752,6 +1752,7 @@ EOF;
$r.='<p class="decale">';
// check for upload piece
$file=new IFile();
$file->setAlertOnSize(true);
$file->table=0;
$r.=_("Ajoutez une pièce justificative ");
$r.=$file->input("pj","");

View file

@ -988,6 +988,7 @@ EOF;
// check for upload piece
$file = new IFile();
$file->table = 0;
$file->setAlertOnSize(true);
$r.='<p class="decale">';
$r.=_("Ajoutez une pièce justificative ");
$r.=$file->input("pj", "");

View file

@ -85,6 +85,8 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
$this->other['seq']=$http->request("seq", "string", 0);
$this->other['select_option_operation']=$http->request("select_option_operation", "string", null);
$this->other['select_comment']=$http->request("select_comment", "string", null);
$this->other['videoconf_server']=$http->request('videoconf_server',"string",0);
$this->other['videoconf_server_url']=$http->request('videoconf_server_url',"string",DEFAULT_SERVER_VIDEO_CONF);
$this->other["cor_id"]=$http->request("cor_id","array",[]);
$nb_corid=count($this->other["cor_id"]);
$http->set_empty(0);
@ -126,7 +128,9 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
$error++;
}
if ($error>0)
{
return false;
}
return true;
}
@ -278,6 +282,19 @@ class Action_Document_Type_MTable extends Manage_Table_SQL
$this->other['followup_comment'],
$this->other['select_comment']
]);
// Save videoconf setting
if ( $this->other['videoconf_server'] == 1 && trim($this->other['videoconf_server_url'])=="") {
$this->other['videoconf_server_url']=DEFAULT_SERVER_VIDEO_CONF;
}
$cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4)
on conflict on constraint document_option_un
do update set do_enable=$3,do_option=$4 ",
[ "videoconf_server",
$object_sql->dt_id,
$this->other['videoconf_server'],
$this->other['videoconf_server_url']
]);
// Option contact to save
$cn->exec_sql("delete from jnt_document_option_contact where document_type_id=$1",[$object_sql->dt_id]);

View file

@ -24,6 +24,7 @@
*/
require_once NOALYSS_INCLUDE.'/class/anc_print.class.php';
require_once NOALYSS_INCLUDE.'/lib/impress.class.php';
require_once NOALYSS_INCLUDE."/lib/select_box.class.php";
class Anc_GrandLivre extends Anc_Print
{
@ -113,7 +114,7 @@ class Anc_GrandLivre extends Anc_Print
$pa_id_cond="";
if ( isset ( $this->pa_id) && $this->pa_id !='')
$pa_id_cond= "pa_id=".$this->pa_id." and";
$array=$this->db->get_array(" select
$array=$this->db->get_array(" select
po_name,
to_char(oa_date,'DD.MM.YYYY') as oa_date,
to_char(jr_date_paid,'DD.MM.YY') as strdate_paid,
@ -136,7 +137,8 @@ class Anc_GrandLivre extends Anc_Print
coalesce(oa_group,0) as oa_group,
case when oa_debit='t' then oa_amount else 0 end as amount_deb,
case when oa_debit='f' then oa_amount else 0 end as amount_cred,
case when oa_debit='f' then 'C' else 'D' end as deb_cred
case when oa_debit='f' then 'C' else 'D' end as deb_cred,
ac.str_action
from operation_analytique as B join poste_analytique using(po_id)
left join jrnx using (j_id)
left join jrn on (j_grpt=jr_grpt_id)
@ -145,7 +147,12 @@ class Anc_GrandLivre extends Anc_Print
select distinct qs_client,j_id from quant_sold qs
union
select distinct qf_bank,j_id from quant_fin qf ) as ftiers using (j_id)
where $pa_id_cond oa_amount <> 0.0 $cond_poste $filter_date
left join (select j.jr_id,string_agg( ag_id::text,'-') as str_action
from jrn j left
join action_gestion_operation ago on (j.jr_id=ago.jr_id )
group by j.jr_id) as ac on (ac.jr_id=jrn.jr_id)
where
$pa_id_cond oa_amount <> 0.0 $cond_poste $filter_date
order by po_name,oa_date::date,qcode,j_poste");
@ -162,7 +169,7 @@ class Anc_GrandLivre extends Anc_Print
{
if (CONVERT_GIF_PDF <> 'NOT' && PDFTK <> 'NOT')
{
$r = "";
$r="";
$r.= HtmlInput::hidden("to", $this->to);
$r.= HtmlInput::hidden("from", $this->from);
$r.= HtmlInput::hidden("pa_id", $this->pa_id);
@ -201,7 +208,7 @@ class Anc_GrandLivre extends Anc_Print
{
return 0;
}
$r.= '<table class="result" style="width:100%">';
$r.= '<table class="result" style="width:100%;border-color:transparent">';
$ix = 0;
$prev = 'xx';
$idx = 0;
@ -220,7 +227,7 @@ class Anc_GrandLivre extends Anc_Print
$r.=td('') . td('') . td('');
$r.=td('') . td('') . td('') . td('') . td('') . td(nbm($tot_deb), ' class="num"') . td(nbm($tot_cred), ' class="num"') . td(nbm($tot_solde) . $sign, ' class="num"');
}
$r.='<tr>' . '<td colspan="7" style="width:auto">' . '<h2>' . h($row['po_name'] . ' ' . $row['po_description']) . '</td></tr>';
$r.='<tr>' . '<td colspan="12" style="width:auto">' . '<h2>' . h($row['po_name'] . ' ' . $row['po_description']) . '</td></tr>';
$r.= '<tr>' .
'<th>' . '</th>' .
'<th>' . _('Date') . '</th>' .
@ -304,15 +311,10 @@ class Anc_GrandLivre extends Anc_Print
return $r;
}
/*!
* \brief Show the button to export in PDF or CSV
* \param $url_csv url of the csv
* \param $url_pdf url of the pdf
* \param $p_string hidden data to include in the form
*
*
* \brief Show the button to export CSV
* \return string with the button
*/
function show_button($p_string="")
function button_export_csv($p_string="")
{
$r="";
$r.= '<form method="GET" action="export.php" style="display:inline">';
@ -324,7 +326,7 @@ class Anc_GrandLivre extends Anc_Print
$r.= HtmlInput::hidden("to_poste",$this->to_poste);
$r.= $p_string;
$r.= dossier::hidden();
$r.=HtmlInput::submit('bt_csv',"Export en CSV");
$r.=HtmlInput::submit('bt_csv',_("Export en CSV"));
$r.= '</form>';
return $r;
}
@ -355,6 +357,7 @@ class Anc_GrandLivre extends Anc_Print
$aheader[]=array("title"=>'Debit','type'=>'num');
$aheader[]=array("title"=>'Credit','type'=>'num');
$aheader[]=array("title"=>'D/C','type'=>'string');
$aheader[]=array("title"=>'Action','type'=>'string');
Impress::array_to_csv($array, $aheader,"export-anc-grandlivre");
}
}

View file

@ -78,6 +78,29 @@ class Document_Export
}
}
/**
* Make a zip file
*/
function make_zip()
{
$zip=new Zip_Extended();
$res=$zip->open("{$this->store_pdf}/result.zip",ZipArchive::CREATE);
if ($res !== true) {
error_log("DE89 cannot create zip file");
throw new Exception ( __FILE__.":".__LINE__."cannot recreate zip");
}
chdir($this->store_pdf);
$zip->addGlob("stamp*pdf");
$zip->close();
}
/**
* copy the file
* @param $p_source
* @param $target
* @throws Exception
*/
function move_file($p_source, $target)
{
$this->check_file();
@ -94,6 +117,17 @@ class Document_Export
header('Pragma: public');
echo file_get_contents($this->store_pdf . '/result.pdf');
}
/**
* @brief send the resulting PDF to the browser
*/
function send_zip()
{
header('Content-Type: application/x-download');
header('Content-Disposition: attachment; filename="result.zip"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
echo file_get_contents($this->store_pdf . '/result.zip');
}
/**
* @brief remove folder and its content
*/
@ -118,8 +152,10 @@ class Document_Export
* @brief export all the pieces in PDF and transform them into a PDF with
* a stamp. If an error occurs then $this->feedback won't be empty
* @param $p_array contents all the jr_id
* @param Progress_Bar $progress is the progress bar
* @param int $p_separate 1 everything in a single PDF or a ZIP with all PDF
*/
function export_all($p_array, Progress_Bar $progress)
function export_all($p_array, Progress_Bar $progress,$p_separate=1)
{
$this->check_file();
if ( count($p_array)==0) return;
@ -268,12 +304,21 @@ class Document_Export
}
$progress->set_value(93);
// concatenate all pdf into one
$this->concatenate_pdf();
ob_clean();
$this->send_pdf();
if ( $p_separate == 1) {
// concatenate all pdf into one
$this->concatenate_pdf();
ob_clean();
$this->send_pdf();
} else {
// Put all PDF In a zip file
$this->make_zip();
ob_clean();
$this->send_zip();
}
$progress->set_value(100);
// remove files from "conversion folder"
@ -299,4 +344,5 @@ class Document_Export
throw ($ex);
}
}
}

View file

@ -162,5 +162,38 @@ class Document_Option
}
return $return;
}
/**
* returns true there is a videoconf enable
*
* @param int $p_document_type Document_Type.dt_id
* @return boolean
*/
static function is_enable_video_conf ($p_document_type)
{
$return=false;
$cn=Dossier::connect();
if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
[$p_document_type, 'videoconf_server'])=='1')
{
$return=true;
}
return $return;
}
/**
* returns the videoconf server
*
* @param int $p_document_type Document_Type.dt_id
* @return string with url to videoconf server
*/
static function option_video_conf($p_document_type)
{
$cn=Dossier::connect();
$option_operation = $cn->get_value("select do_option from document_option where document_type_id=$1 "
. " and do_code = $2",
[$p_document_type, 'videoconf_server']);
return $option_operation;
}
}

View file

@ -20,7 +20,7 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
include_once("class/fiche_attr.class.php");
require_once NOALYSS_INCLUDE."/class/fiche_attr.class.php";
require_once NOALYSS_INCLUDE.'/lib/ispan.class.php';
require_once NOALYSS_INCLUDE.'/lib/itva_popup.class.php';
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
@ -60,7 +60,7 @@ class Fiche
$this->id=$p_id;
$this->quick_code='';
$this->attribut=array();
$f_enable='1';
$this->f_enable='1';
}
public function get_id()
{
@ -162,8 +162,8 @@ class Fiche
/**
*@brief set an attribute by a value, if the attribut array is empty
* a call to getAttribut is performed
*@param the AD_ID
*@param the value
*@param int AD_ID
*@param int value
*@see constant.php table: attr_def
*/
function setAttribut($p_ad_id,$p_value)
@ -193,10 +193,10 @@ class Fiche
fiche
natural join fiche_detail
join jnt_fic_attr on (jnt_fic_attr.fd_id=fiche.fd_id and fiche_detail.ad_id=jnt_fic_attr.ad_id)
join attr_def on (attr_def.ad_id=fiche_detail.ad_id) where f_id=".$this->id.
join attr_def on (attr_def.ad_id=fiche_detail.ad_id) where f_id=$1".
" order by jnt_order";
$Ret=$this->cn->exec_sql($sql);
$Ret=$this->cn->exec_sql($sql,[$this->id]);
if ( ($Max=Database::num_row($Ret)) == 0 )
return ;
for ($i=0;$i<$Max;$i++)
@ -253,9 +253,9 @@ class Fiche
}
/**
* @brief find the card with the p_attribut equal to p_value, it is not case sensitive
* @param $p_attribut attribute to find see table attr_def
* @param $p_value value in attr_value.av_text
* @return return ARRAY OF jft_id,f_id,fd_id,ad_id,av_text
* @param int $p_attribut attribute to find see table attr_def
* @param string $p_value value in attr_value.av_text
* @return array returns ARRAY OF jft_id,f_id,fd_id,ad_id,av_text
*/
function seek($p_attribut,$p_value)
{
@ -281,30 +281,38 @@ class Fiche
/*!
**************************************************
* \brief Return array of card from the frd family
* \brief Count the nb of card with the reference card id frd_id
*
* \param $p_frd_id the fiche_def_ref.frd_id
* \param $p_search p_search is a filter on the name
* \param $p_sql extra sql condition
*
* \return array of fiche object
* \return nb of item found
*/
function count_by_modele($p_frd_id,$p_search="",$p_sql="")
{
$sql="select *
from
fiche join fiche_Def using (fd_id)
where frd_id=".$p_frd_id;
// Scan for SQL inject
$this->cn->search_sql_inject($p_sql);
if ( $p_search != "" )
{
$a=sql_string($p_search);
$sql="select * from vw_fiche_attr where frd_id=".$p_frd_id.
" and vw_name ilike '%$p_search%'";
$result = $this->cn->get_value("select count(*) from
vw_fiche_attr
where
frd_id=$1
and vw_name ilike '%'||$2||'%'",
[$p_frd_id,$p_search]);
return $result;
} else {
$result = $this->cn->get_value("select count(*)
from
fiche join fiche_Def using (fd_id)
where frd_id=$1 ".$p_sql
,[$p_frd_id]);
return $result;
}
$Ret=$this->cn->exec_sql($sql.$p_sql);
return Database::num_row($Ret) ;
}
/*!
**************************************************
@ -375,8 +383,8 @@ class Fiche
/***
* @brief return the string of the given attribute
* (attr_def.ad_id)
* @param $p_ad_id the AD_ID from attr_def.ad_id
* @param $p_return 1 return NOTFOUND otherwise an empty string
* @param int $p_ad_id AD_ID from attr_def.ad_id
* @param int $p_return 1 return NOTFOUND otherwise an empty string
* @see constant.php
* @return string
*/
@ -467,7 +475,7 @@ class Fiche
$f=new Fiche_Def($this->cn,$p_fiche_def);
$f->get();
$array=$f->getAttribut();
$r=h2(_('Catégorie').' '.$f->label,"");
$r="";
$r.='<table style="width:98%;margin:1%">';
foreach ($array as $attr)
{
@ -591,6 +599,17 @@ class Fiche
return $r;
}
/**
*
* @return string with the category
*/
function getLabelCategory()
{
$type_card=$this->cn->get_value('select fd_label '
. ' from fiche_def join fiche using (fd_id) where f_id=$1',
array($this->id));
return $type_card;
}
/*!
* \brief Display object instance, getAttribute
@ -605,14 +624,9 @@ class Fiche
{
$this->GetAttribut();
$attr=$this->attribut;
/* show card type here */
$type_card=$this->cn->get_value('select fd_label '
. ' from fiche_def join fiche using (fd_id) where f_id=$1',
array($this->id));
$ret="";
$ret.=h2(_("Catégorie")." ".$type_card, 'style="display:inline"');
$ret.='<span style="margin-right:5px;float:right">'.
_('id fiche').':'.$this->id."</span>";
$ret.='<span style="margin-right:5px;float:right;font-size:80%">'.
_('id').':'.$this->id."</span>";
$ret.="<table style=\"width:98%;margin:1%\">";
if (empty($attr))
{
@ -794,7 +808,7 @@ class Fiche
$enable_is->readOnly=$p_readonly;
$ret.=tr(
td(_("Actif")).td($enable_is->input())
td(_("Actif"),'class="input_text"').td($enable_is->input(),'class="input_text"')
);
@ -849,8 +863,12 @@ class Fiche
try
{
$this->cn->start();
$Ret=$this->cn->exec_sql("insert into fiche(f_id,f_enable,fd_id) value ($1,$2,$3)",
// by default the card is available
if ( !isset ($p_array['f_enable'])) {
$p_array['f_enable']=1;
}
$Ret=$this->cn->exec_sql("insert into fiche(f_id,f_enable,fd_id) values ($1,$2,$3)",
array($fiche_id, $p_array['f_enable'],$p_fiche_def));
// parse the $p_array array
@ -1806,6 +1824,7 @@ class Fiche
function Summary($p_search="",$p_action="",$p_sql="",$p_amount=false)
{
global $g_user;
$http=new HttpInput();
$bank=new Acc_Parm_Code($this->cn,'BANQUE');
$cash=new Acc_Parm_Code($this->cn,'CAISSE');
$cc=new Acc_Parm_Code($this->cn,'COMPTE_COURANT');
@ -1826,8 +1845,8 @@ class Fiche
$all_tiers=$this->count_by_modele($this->fiche_def_ref,"",$p_sql.$filter_amount);
// Get offset and page variable
$offset=( isset ($_REQUEST['offset'] )) ?$_REQUEST['offset']:0;
$page=(isset($_REQUEST['page']))?$_REQUEST['page']:1;
$offset=$http->request("offset","number",0);
$page=$http->request("page","number",1);
$bar=navigation_bar($offset,$all_tiers,$_SESSION[SESSION_KEY.'g_pagesize'],$page);
// set a filter ?
@ -1880,7 +1899,7 @@ class Fiche
$odd="";
$odd = ($i % 2 == 0 ) ? ' odd ': ' even ';
$accounting=$tiers->strAttribut(ATTR_DEF_ACCOUNT);
if ( $p_action == 'bank' && $amount['debit'] < $amount['credit'] ){
if ( ! empty($accounting) && $p_action == 'bank' && $amount['debit'] < $amount['credit'] ){
if ( strpos($accounting,$bank->p_value)===0 || strpos($accounting,$cash->p_value)===0 || strpos($accounting,$cc->p_value)===0){
//put in red if c>d
$odd.=" notice ";
@ -2140,7 +2159,7 @@ class Fiche
{
case 'cred':
if (!isset($jrn))
throw ('Erreur pas de valeur pour jrn');
throw Exception('Erreur pas de valeur pour jrn');
$filter_jrn=$this->cn->make_list("select jrn_def_fiche_cred from jrn_Def where jrn_def_id=$1",
array($jrn));
$filter_fd_id=" fd_id in (".$filter_jrn.")";
@ -2148,7 +2167,7 @@ class Fiche
break;
case 'deb':
if (!isset($jrn))
throw ('Erreur pas de valeur pour jrn');
throw Exception('Erreur pas de valeur pour jrn');
$filter_jrn=$this->cn->make_list("select jrn_def_fiche_deb from jrn_Def where jrn_def_id=$1",
array($jrn));
$filter_fd_id=" fd_id in (".$filter_jrn.")";
@ -2156,7 +2175,7 @@ class Fiche
break;
case 'filter':
if (!isset($jrn))
throw ('Erreur pas de valeur pour jrn');
throw Exception('Erreur pas de valeur pour jrn');
$filter_jrn=$this->cn->make_list("select jrn_def_fiche_deb from jrn_Def where jrn_def_id=$1",
array($jrn));

View file

@ -34,14 +34,14 @@ require_once NOALYSS_INCLUDE.'/lib/iradio.class.php';
*/
class Fiche_Def
{
var $cn; // database connection
var $id; // id (fiche_def.fd_id
var $label; // fiche_def.fd_label
var $class_base; // fiche_def.fd_class_base
var $fiche_def; // fiche_def.frd_id = fiche_def_ref.frd_id
var $create_account; // fd_create_account: flag
var $cn; //!< database connection
var $id; //!< id (fiche_def.fd_id
var $label; //!< fiche_def.fd_label
var $class_base; //!< fiche_def.fd_class_base
var $fiche_def; //!< fiche_def.frd_id = fiche_def_ref.frd_id
var $create_account; //!< fd_create_account: flag
var $all;
var $attribut; // get from attr_xxx tables
var $attribut; //!< get from attr_xxx tables
function __construct($p_cn,$p_id = 0)
{
$this->cn=$p_cn;
@ -75,10 +75,10 @@ class Fiche_Def
function getAttribut()
{
$sql="select * from jnt_fic_attr ".
" natural join attr_def where fd_id=".$this->id.
" natural join attr_def where fd_id= $1".
" order by jnt_order";
$Ret=$this->cn->exec_sql($sql);
$Ret=$this->cn->exec_sql($sql,[$this->id]);
if ( ($Max=Database::num_row($Ret)) == 0 )
return ;

View file

@ -401,6 +401,7 @@ class Follow_Up
/* for new files */
$upload=new IFile();
$upload->name="file_upload[]";
$upload->setAlertOnSize(true);
$upload->readOnly=$readonly;
$upload->value="";
$aAttachedFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype,'.

View file

@ -40,7 +40,7 @@ class Pre_operation
private $jrn_type; /*!< $jrn_type */
private $name; /*!< $name name of the predef. operation */
private $detail; /*!< Pre_operation_detail object */
private $od_direct ; /*!< Compatibility for ACH in direct mode, only for ODS */
var $od_direct ; /*!< Compatibility for ACH in direct mode, only for ODS */
private $od_id; /*!< id of the Predefined Operation */
private $isloaded;
private $description; /*!< description of the predefined operation */

View file

@ -25,6 +25,7 @@ class Tag
function __construct($p_cn,$id=-1)
{
$this->cn=$p_cn;
$id = (trim($id)=="")?-1:$id;
$this->data=new Tag_SQL($p_cn,$id);
}
public function get_data()

View file

@ -28,10 +28,10 @@ require_once NOALYSS_INCLUDE.'/lib/ipopup.class.php';
global $g_user,$g_parameter;
$gDossier=dossier::id();
$http=new HttpInput();
$cn=Dossier::connect();
$menu_action="?ledger_type=fin&ac=".$_REQUEST['ac']."&".dossier::get();
$menu_action="?ledger_type=fin&ac=".$http->request('ac')."&".dossier::get();
$Ledger=new Acc_Ledger_Fin($cn,0);
@ -40,7 +40,9 @@ $Ledger=new Acc_Ledger_Fin($cn,0);
//--------------------------------------------------------------------------------
if ( isset($_REQUEST['p_jrn']))
$Ledger->id=$_REQUEST['p_jrn'];
{
$Ledger->id=$http->request('p_jrn',"number");
}
else
{
$def_ledger=$Ledger->get_first('fin');
@ -137,7 +139,7 @@ if ( $p_msg !="" ) echo '<span class="warning">'.$p_msg.'</span>';
echo '<form class="print" name="form_detail" enctype="multipart/form-data" class="print" METHOD="POST">';
echo HtmlInput::hidden('ledger_type','fin');
echo HtmlInput::hidden('ac',$_REQUEST['ac']);
echo HtmlInput::hidden('ac',$http->request("ac"));
$array=( isset($correct))?$_POST:null;
// show select ledger
@ -149,13 +151,15 @@ try
echo HtmlInput::submit('save',_('Sauve'));
echo HtmlInput::reset(_('Effacer'));
$script="update_name();";
if ( ! isset($_REQUEST['e_date'])&& $g_parameter->MY_DATE_SUGGEST=='Y')
{
echo create_script(" get_last_date();ajax_saldo('first_sold');");
}else {
echo create_script(" ajax_saldo('first_sold');");
$script.=" get_last_date();";
}
echo create_script(" update_name()");
if ( ! isset ($_REQUEST['first_sold']) ) {
$script.=" ajax_saldo('first_sold');";
}
echo create_script($script);
} catch (Exception $ex) {
echo $ex->getMessage();
}

View file

@ -72,3 +72,5 @@ define ("dbname","");
// $pdftk = /snap/bin/pdftk
// Define a random session key if you work with different version of NOALYSS
// define ('SESSION_KEY','abcde');
// Max size is defined by default to 2MB, it could be also needed to modify PHP Ini file
// define ("MAX_FILE_SIZE",2097152);

View file

@ -109,7 +109,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
define ("DBVERSION",151);
define ("DBVERSION",153);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",19);
define ('NOTFOUND','--not found--');
@ -228,8 +228,11 @@ define ("FICHE_TYPE_ACH_SER",3);
define ("FICHE_TYPE_ACH_MAT",7);
define ("FICHE_TYPE_PROJET",26);
define ("FICHE_TYPE_MATERIAL",7);
/**
// Max size is defined by default to 2MB,
if ( ! defined("MAX_FILE_SIZE")) {
define ("MAX_FILE_SIZE",2097152);
}
/**
* -- pour utiliser unoconv démarrer un server libreoffice
* commande
* libreoffice --headless --accept="socket,host=127.0.0.1,port=2002;urp;" --nofirststartwizard
@ -314,6 +317,7 @@ define ('EMAIL_LIMIT',1002);
define ('EXC_PARAM_VALUE',1005);
define ('EXC_PARAM_TYPE',1006);
define ('EXC_DUPLICATE',1200);
define ('EXC_INVALID',1400);
define ("UNPINDG","&#xf047;");
define ("PINDG","&#xe809;");
@ -330,3 +334,6 @@ if ( ! defined ("NOALYSS_URL")) {
dirname($_SERVER['PHP_SELF']);
define ("NOALYSS_URL",$base);
}
if (!defined ("DEFAULT_SERVER_VIDEO_CONF")) {
define ("DEFAULT_SERVER_VIDEO_CONF","https://www.free-solutions.org/");
}

View file

@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Attr_def_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.attr_def";
$this->primary_key="ad_id";

View file

@ -31,7 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Contact_option_ref_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.contact_option_ref";
$this->primary_key="cor_id";

View file

@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Document_State_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.document_state";
$this->primary_key="s_id";

View file

@ -35,7 +35,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Document_type_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.document_type";
$this->primary_key="dt_id";

View file

@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Fiche_def_ref_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.fiche_def_ref";
$this->primary_key="frd_id";

View file

@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Jrn_def_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.jrn_def";
$this->primary_key="jrn_def_id";

View file

@ -34,7 +34,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Jrn_periode_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.jrn_periode";
$this->primary_key="id";

View file

@ -35,7 +35,7 @@ require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
class Menu_Ref_SQL extends Noalyss_SQL
{
function __construct(Database &$p_cn, $p_id=-1)
function __construct(DatabaseCore &$p_cn, $p_id=-1)
{
$this->table="public.menu_ref";
$this->primary_key="me_code";

View file

@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Op_predef_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn,$p_id=-1)
function __construct(DatabaseCore $p_cn,$p_id=-1)
{
$this->table = "public.op_predef";
$this->primary_key = "od_id";

View file

@ -35,7 +35,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Parm_periode_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn,$p_id=-1)
function __construct(DatabaseCore $p_cn,$p_id=-1)
{
$this->table = "public.parm_periode";
$this->primary_key = "p_id";

View file

@ -32,7 +32,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Payment_method_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.payment_method";
$this->primary_key="mp_id";

View file

@ -35,7 +35,7 @@ require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
class Poste_analytique_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.poste_analytique";
$this->primary_key="po_id";

View file

@ -30,7 +30,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Tag_group_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn,$p_id=-1)
function __construct(DatabaseCore $p_cn,$p_id=-1)
{
$this->table = "public.tag_group";
$this->primary_key = "tg_id";

View file

@ -31,7 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class Tva_rate_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.tva_rate";
$this->primary_key="tva_id";

View file

@ -31,7 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class User_filter_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.user_filter";
$this->primary_key="id";

View file

@ -31,7 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/database.class.php';
class V_Tva_Rate_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
function __construct(DatabaseCore $p_cn, $p_id=-1)
{
$this->table="public.v_tva_rate";
$this->primary_key="tva_id";

View file

@ -39,6 +39,9 @@ if ($ck == 0)
exit();
}
$anc=new Document_Export();
$type_pdf=$http->get("type_pdf","number",1);
$task_id=$http->request("task_id");
$progress=new Progress_Bar($task_id);
$anc->export_all($ck,$progress);
$anc->export_all($ck,$progress,$type_pdf);

View file

@ -132,7 +132,7 @@ if ( $allcard == 0 ){
if ($array == null && $allcard == 0 && $histo->selected != 3 )
{
echo '<div class="content">';
echo '<h2 class="info2"> '._('Aucune fiche trouvée').'</h2>';
echo '<h2 class="error"> '._('Aucune fiche trouvée').'</h2>';
echo $str_add_card;
echo '</div>';
return;

View file

@ -94,13 +94,13 @@ if (!isset($p_array['date_start']))
list($date_start, $date_end) = $per->get_date_limit();
$p_array['date_start'] = $date_start;
$p_array['date_end'] = $date_end;
$msg='<h2 class="info2">'.sprintf(_("Période %s au %s "),$date_start,$date_end).'</h2>';
$msg='<h2 class="">'.sprintf(_("Période %s au %s "),$date_start,$date_end).'</h2>';
}
else
{
$date_start=$http->get("date_start","string","");
$date_end=$http->get("date_end","string","");
$msg='<h2 class="info2">'.sprintf(_("Période %s au %s "),$date_start,$date_end) .'</h2>';
$msg='<h2 class="">'.sprintf(_("Période %s au %s "),$date_start,$date_end) .'</h2>';
}
/* compute the sql stmt */

View file

@ -32,12 +32,12 @@ require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
/**
* \brief to protect again bad characters which can lead to a cross scripting attack
the string to be diplayed must be protected
the string to be diplayed must be protected. Side effects with htmlentities, especially for
* the date (transform dot in &periode;) and number
*/
function h($p_string)
{
return htmlspecialchars($p_string);
return htmlspecialchars($p_string,ENT_QUOTES|ENT_HTML5,'UTF-8',true);
}
function span($p_string, $p_extra='')
@ -47,31 +47,31 @@ function span($p_string, $p_extra='')
function hi($p_string)
{
return '<i>' . htmlspecialchars($p_string) . '</i>';
return '<i>' . h($p_string) . '</i>';
}
function hb($p_string)
{
return '<b>' . htmlspecialchars($p_string) . '</b>';
return '<b>' . h($p_string) . '</b>';
}
function th($p_string, $p_extra='',$raw='')
{
return '<th ' . $p_extra . '>' . htmlspecialchars($p_string).$raw . '</th>';
return '<th ' . $p_extra . '>' . h($p_string).$raw . '</th>';
}
function h2info($p_string)
{
return '<h2 class="info">' . htmlspecialchars($p_string) . '</h2>';
return '<h2 class="info">' . h($p_string) . '</h2>';
}
function h2($p_string, $p_class="",$raw="")
{
return '<h2 ' . $p_class . '>' . $raw.htmlspecialchars($p_string) . '</h2>';
return '<h2 ' . $p_class . '>' . $raw.h($p_string) . '</h2>';
}
function h1($p_string, $p_class="")
{
return '<h1 ' . $p_class . '>' . htmlspecialchars($p_string) . '</h1>';
return '<h1 ' . $p_class . '>' . h($p_string) . '</h1>';
}
/**
* \brief surround the string with td
@ -424,9 +424,11 @@ function html_min_page_start($p_theme="", $p_script="", $p_script2="")
<LINK REL=\"stylesheet\" type=\"text/css\" href=\"$style\" media=\"screen\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"style-print.css\" media=\"print\">" .
$p_script2 . "
<script src=\"js/prototype.js\" type=\"text/javascript\"></script>
<script src=\"js/scripts.js\" type=\"text/javascript\"></script>
<script src=\"js/acc_ledger.js\" type=\"text/javascript\"></script>
<script src=\"js/smoke.js\" type=\"text/javascript\"></script>";
include_once NOALYSS_INCLUDE.'/lib/message_javascript.php';
echo '</HEAD>
';
@ -523,15 +525,23 @@ function ShowItem($p_array, $p_dir='V', $class="mtitle", $class_ref="mtitle", $d
$title = "";
$set = "XX";
if (isset($href[2]))
$title = $href[2];
if (isset($href[3]))
$set = $href[3];
{
$title=$href[2];
}
if (isset($href[3]))
{
$set=$href[3];
}
if ($set == $default)
$ret.='<TR><TD CLASS="selectedcell"><A class="' . $class_ref . '" HREF="' . $href[0] . '" title="' . $title . '" ' . $javascript . '>' . $href[1] . '</A></TD></TR>';
else
$ret.='<TR><TD CLASS="' . $class . '"><A class="' . $class_ref . '" HREF="' . $href[0] . '" title="' . $title . '" ' . $javascript . '>' . $href[1] . '</A></TD></TR>';
}
if ($set==$default)
{
$ret.='<TR><TD CLASS="selectedcell"><A class="'.$class_ref.'" HREF="'.$href[0].'" title="'.$title.'" '.$javascript.'>'.$href[1].'</A></TD></TR>';
}
else
{
$ret.='<TR><TD CLASS="'.$class.'"><A class="'.$class_ref.'" HREF="'.$href[0].'" title="'.$title.'" '.$javascript.'>'.$href[1].'</A></TD></TR>';
}
}
}
//direction Horizontal
else if ($p_dir == 'H')
@ -686,13 +696,17 @@ function sql_filter_per($p_cn, $p_from, $p_to, $p_form='p_id', $p_field='jr_tech
throw new Exception("SFP2"._("Date invalide"));
}
}
if ($p_from == $p_to)
$periode = " $p_field = (select p_id from parm_periode " .
" where " .
" p_start = to_date('$p_from','DD.MM.YYYY')) ";
if ($p_from==$p_to)
{
$periode=" $p_field = (select p_id from parm_periode ".
" where ".
" p_start = to_date('$p_from','DD.MM.YYYY')) ";
}
else
$periode = "$p_field in (select p_id from parm_periode " .
" where p_start >= to_date('$p_from','DD.MM.YYYY') and p_end <= to_date('$p_to','DD.MM.YYYY')) ";
{
$periode="$p_field in (select p_id from parm_periode ".
" where p_start >= to_date('$p_from','DD.MM.YYYY') and p_end <= to_date('$p_to','DD.MM.YYYY')) ";
}
return $periode;
}
@ -710,7 +724,9 @@ function alert($p_msg, $buffer=false)
$r.= '</script>';
if ($buffer)
return $r;
{
return $r;
}
echo $r;
}
@ -720,14 +736,23 @@ function alert($p_msg, $buffer=false)
function set_language()
{
// desactivate local check
if ( defined("LOCALE") && LOCALE==0 ) return;
if ( ! isset ($_SESSION[SESSION_KEY.'g_lang'])) return;
if (defined("LOCALE")&&LOCALE==0)
{
return;
}
if (!isset($_SESSION[SESSION_KEY.'g_lang']))
{
return;
}
/*
* If translation is not supported by current
*/
if (! function_exists("bindtextdomain")) return;
if (!function_exists("bindtextdomain"))
{
return;
}
$dir = "";
// set differently the language depending of the operating system
if (what_os() == 1)
@ -1155,6 +1180,7 @@ function display_menu($p_menuid)
}
tracedebug("'menu", $file[0]['me_file'],__FUNCTION__.__LINE__."line");
tracedebug("'menu", $file[0]['me_parameter'],__FUNCTION__.__LINE__."parm ");
if ( DEBUG ) { echo $file[0]['me_file']," param : ",$file[0]['me_parameter'] ;}
/*
* Log the file we input to put in the folder test-noalyss for replaying it
*/

View file

@ -27,13 +27,13 @@
/**
* @brief this an abstract class , all the SQL class, like noalyss_sql (table),
* Acc_Plan_SQL (based on a SQL not a table).
* Acc_Plan_SQL (based on a SQL not a table) or a view.
*
* You must create a class extending this one, in the constructor
* these variables have to be defined
*
* - table = name of the view or empty
* - select = name of the select
* - sql = sql statement
* - name = array of column name, match between logic and actual name
* - type = array , match between column and type of data
* - default = array of column with a default value

View file

@ -956,6 +956,24 @@ class DatabaseCore
static function nb_column($p_ret) {
return pg_num_fields($p_ret);
}
/**
* FInd if a SQL Select has a SQL stmt to inject or damage Data
* When a SELECT SQL string is build, this string could contain a SQL attempt to damage data,
*so the statement DELETE TRUNCATE ... are forbidden. Throw an exception EXC_INVALID
*
*/
function search_sql_inject($p_sql)
{
$forbid_sql=array("update","delete","truncate","insert");
// protect against SQL inject
foreach ($forbid_sql as $forbid_key) {
if (stripos($p_sql,$forbid_key) !== false)
{
throw new Exception(_("Possible SQL inject",EXC_INVALID));
}
}
}
}

View file

@ -837,7 +837,7 @@ class HtmlInput
* @return type
*/
static function title_box($p_name, $p_div, $p_mod="close", $p_js="",
$p_draggable="n")
$p_draggable="n",$p_enlarge='n')
{
$p_div=strip_tags($p_div);
$r='<div class="bxbutton">';
@ -847,6 +847,9 @@ class HtmlInput
{
$r.=Icon_Action::draggable($p_div);
}
if ( $p_enlarge=='y') {
$r.=Icon_Action::full_size($p_div);
}
if ($p_mod=='close')
{
$r.=Icon_Action::close($p_div, $p_js);

View file

@ -120,7 +120,45 @@ require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
class ICard extends HtmlInput
{
//!< $fct ,by default it is update_value called BEFORE the querystring is send
var $fct;
//!< $dblclick action if double click
var $dblclick;
//!< $callback ,
var $callback;
//!< $choice
var $choice;
//!< $indicator, text displaid when searching
var $indicator;
//!< $choice_create 1 , display a (+) button , default 1
var $choice_create;
//!< $autocomplete : 1 enable - 0 disable
var $autocomplete;
//!< $style supplemental CSS
var $style=' ';
//!< $accvis account_visible =1 otherwise 0, default 1
var $accvis;
//!< $limit Max of row show
var $limit;
//!< $amount_from_type : accountancy , sell or purchase price
var $amount_from_type;
//!< $typecard : type of card
var $typecard;
//!< $autocomplete_file , ajax file used for autocompletion (see Ajax.Autocompleter)
private $autocomplete_file;
function __construct($name="", $value="", $p_id="")
{
parent::__construct($name, $value);
@ -137,6 +175,8 @@ class ICard extends HtmlInput
$this->accvis=1; //!< account_visible =1 otherwise 0
$this->limit=12; //!< Max of row show
$this->amount_from_type=''; //!< in the follow up ,when a card is selected you take Prix Vente or Prix Achat
$this->typecard='all';
$this->autocomplete_file="fid_card.php";
}
/**
@ -155,7 +195,8 @@ class ICard extends HtmlInput
}
/**\brief set the javascript callback function
/**
* \brief set the javascript callback function
* by default it is update_value called BEFORE the querystring is send
*
* \param $p_name callback function name
@ -256,12 +297,12 @@ class ICard extends HtmlInput
$query=http_build_query([ 'gDossier'=>Dossier::id(),'e'=>$this->typecard,'limit'=>$this->limit]);
$javascript=sprintf('try { new Ajax.Autocompleter("%s","%s","fid_card.php?%s",'.
$javascript=sprintf('try { new Ajax.Autocompleter("%s","%s","%s?%s",'.
'{paramName:"FID",minChars:1,indicator:%s, '.
'callback:%s, '.
'limit:%s,'.
' afterUpdateElement:%s});} catch (e){alert(e.message);};',
$this->id, $this->choice, $query, $this->indicator,
$this->id, $this->choice, $this->autocomplete_file,$query, $this->indicator,
$this->callback, $this->limit, $this->fct);
$javascript=create_script($javascript.$this->dblclick);

View file

@ -368,26 +368,34 @@ class Icon_Action
if ( $p_value == 0 ) { return \Icon_Action::iconoff($p_id, $p_javascript,$p_style);}
}
static function checked ($p_id,$p_javascript="") {
static function checked ($p_id,$p_javascript="",$p_classrange="") {
$lock_cur="&#xe741;";
$r=sprintf( '<span id="%s" onclick="%s" class="icon smallicon">%s</span>',
$r=sprintf( '<span id="%s" onclick="%s" class="icon smallicon %s" >%s</span>',
$p_id,
$p_javascript,
$p_classrange,
$lock_cur);
return $r;
}
static function unchecked ($p_id,$p_javascript="") {
static function unchecked ($p_id,$p_javascript="",$p_classrange="") {
$lock_cur="&#xf096";
$r=sprintf( '<span id="%s" onclick="%s" class="icon smallicon" >%s</span>',
$r=sprintf( '<span id="%s" onclick="%s" class="icon smallicon %s" >%s</span>',
$p_id,
$p_javascript,
$p_classrange,
$lock_cur);
return $r;
}
static function checkbox ($p_id,$p_javascript="",$p_value=0) {
if ( $p_value == 0 ) { return \Icon_Action::checked($p_id, $p_javascript); }
if ( $p_value == 1 ) { return \Icon_Action::unchecked($p_id, $p_javascript);}
static function checkbox ($p_id,$p_javascript="",$p_value=0,$p_classrange="") {
if ( $p_value == 0 ) { return \Icon_Action::checked($p_id, $p_javascript,$p_classrange); }
if ( $p_value == 1 ) { return \Icon_Action::unchecked($p_id, $p_javascript,$p_classrange);}
}
static function full_size($p_div) {
$js=sprintf("full_size('%s')",$p_div);
$icon="&#xe82a;";
$r=sprintf('<span id="size_%s" onclick="%s" class="icon smallicon">%s</span>',
$p_div,$js,$icon);
return $r;
}
}

View file

@ -132,7 +132,7 @@ class IDate extends HtmlInput
return $this->display();
if ($this->id=="") $this->id=self::generate_id($this->name);
$autofocus=($this->autofocus)?" autofocus ":"";
$onchange='onchange="format_date(this)"';
$r=sprintf('
<input type="text" name="%s" id="%s"
class="input_text"
@ -140,14 +140,17 @@ class IDate extends HtmlInput
value ="%s"
placeholder="%s"
title="%s"
pattern="[0-9]{1,2}.[0-9]{1,2}.[0-9]{4}"
pattern="[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}"
%s
/>
<span class="smallbutton icon"
id="%s_trigger"
/>
&#xe811;
</span>
',$this->name,$this->id,$this->value,$this->placeholder,$this->title,$this->id
',$this->name,$this->id,$this->value,$this->placeholder,$this->title,
$onchange,
$this->id
);
// @see calendar-setup.js
$r.=sprintf('<script type="text/javascript">

View file

@ -25,13 +25,57 @@
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
class IFile extends HtmlInput
{
// if true , the size is tested and a box is displaid
private $alert_on_size;
function __construct($p_name = "", $p_value = "", $p_id = "")
{
parent::__construct($p_name, $p_value, $p_id);
$this->alert_on_size=false;
}
/**
* @return false
*/
public function getAlertOnSize()
{
return $this->alert_on_size;
}
/**
* if true , the size is tested and a box is displaid
* @param false $alert_on_size
*/
public function setAlertOnSize(bool $alert_on_size)
{
$this->alert_on_size = $alert_on_size;
}
/*!\brief show the html input of the widget*/
public function input($p_name=null,$p_value=null)
{
$this->name=($p_name==null)?$this->name:$p_name;
$this->value=($p_value==null)?$this->value:$p_value;
if ( $this->readOnly==true) return $this->display();
$r='<INPUT class="inp" TYPE="file" name="'.$this->name.'" VALUE="'.$this->value.'">';
if ($this->id=="") $this->id=uniqid("file_");
$r=sprintf('<INPUT class="inp" TYPE="file" name="%s" id="%s" value="%s">',
$this->name,
$this->id,
$this->value);
if ( $this->alert_on_size)
{
$max_size=MAX_FILE_SIZE;
$max_size_mb=round($max_size / 1024 /1024,2);
$too_large=h(_("Fichier trop grand(max = $max_size_mb MB)"));
$js_check_size=sprintf('
document.getElementById("%s").addEventListener("change",function ()
{
var fFile=document.getElementById("%s");
if (fFile.files[0] && fFile.files[0].size>%s) { smoke.alert("%s");}
});',$this->id,$this->id,$max_size,$too_large);
$r.=create_script($js_check_size);
}
return $r;
}

View file

@ -111,6 +111,7 @@ EOF;
function value()
{
$v=$this->input->get_value();
$v=html_entity_decode($v);
if ( $this->input instanceof ITextarea) {
echo '<span class="input_text" id="'.$this->input->id.'edit" >';
echo '<pre class="field_follow_up">';
@ -140,6 +141,7 @@ EOF;
function input() {
ob_start();
$v=$this->input->get_value();
$v=html_entity_decode($v);
if ( $this->input instanceof ITextarea) {
echo '<span class="" id="'.$this->input->id.'edit" >';
echo '<pre class="field_follow_up">';

View file

@ -50,6 +50,7 @@ class InputCheckBox extends HtmlInput
$this->id_hidden=$p_id;
$this->id_icon=uniqid($p_id);
$this->javascript="";
$this->classrange="";
}
function input($p_name=NULL, $p_value=0)
@ -75,9 +76,9 @@ class InputCheckBox extends HtmlInput
$this->javascript);
if ($this->value=='1') {
$r.=Icon_Action::checked($this->id_icon,$this->javascript);
$r.=Icon_Action::checked($this->id_icon,$this->javascript,$this->classrange);
} else {
$r.=Icon_Action::unchecked($this->id_icon,$this->javascript);
$r.=Icon_Action::unchecked($this->id_icon,$this->javascript,$this->classrange);
}
return $r;
}

View file

@ -65,7 +65,7 @@ class ISelect extends HtmlInput
{
$checked=($this->selected==$this->value[$i]['value'])?"SELECTED":"";
$a.='<OPTION VALUE="'.$this->value[$i]['value'].'" '.$checked.'>';
$a.=$this->value[$i]['label'];
$a.=strip_tags($this->value[$i]['label']);
}
$a.="</SELECT>";
if ( $this->table == 1 ) $a='<td>'.$a.'</td>';
@ -80,7 +80,7 @@ class ISelect extends HtmlInput
{
if ($this->selected==$this->value[$i]['value'] )
{
$r=h($this->value[$i]['label']);
$r=htmlentities($this->value[$i]['label'],ENT_QUOTES|ENT_HTML5,'UTF-8',true);
}
}
@ -96,7 +96,7 @@ class ISelect extends HtmlInput
{
if ($this->selected==$this->value[$i]['value'] )
{
$r=h($this->value[$i]['label']);
$r=$this->value[$i]['label'];
}
}

View file

@ -82,12 +82,15 @@ class Manage_Table_SQL
protected $a_info; //!< Array with the infotip
protected $sort_column; //!< javascript sort , if empty there is no js sort
protected $dialog_box; //!< ID of the dialog box which display the result of the ajax calls
protected $search_table; //!< boolean , by default true ,it is possible to search in the table,
const UPDATABLE=1;
const VISIBLE=2;
private $icon_mod; //!< place of right or left the icon update or mod, default right, accepted value=left,right,first column for mod
private $icon_del; //!< place of right or left the icon update or mod, default right, accepted value=left,right
private $dialogbox_style;
private $dialogbox_style;
private $button_add_top; //!< place of the button add on the top, by default true
protected $title; //! < give the title of the diabox , default is Data
/**
* @brief Constructor : set the label to the column name,
* the order of the column , set the properties and the
@ -124,9 +127,46 @@ class Manage_Table_SQL
// By default no js sort
$this->sort_column="";
$this->dialog_box="dtr";
$this->dialogbox_style=array("position"=> "fixed", "top"=> '15%',"width"=> "auto", "margin-left"=> "20%");
$this->dialogbox_style=array("position"=> "fixed", "top"=> '15%',"width"=> "auto",
"max-width"=>"60%",
"margin-left"=> "20%");
$this->search_table=true;
$this->button_add_top=true;
$this->title=_("Donnée");
}
/**
* Set the title of the diabox , default is Donnée
* @param type $p_title
*/
function setTitle($p_title)
{
$this->title=$p_title;
}
function getTitle()
{
return $this->title;
}
/**
* Get if we can search in the table
* @return boolean
*/
public function get_search_table()
{
return $this->search_table;
}
/**
* Set the table searchable or not
* @param boolean : true we can search
* @return $this
*/
public function set_search_table($search_table)
{
$this->search_table=$search_table;
return $this;
}
/**
* send the XML headers for the ajax call
*/
function send_header()
@ -642,8 +682,18 @@ function check()
}
}
}
public function get_button_add_top()
{
return $this->button_add_top;
}
/**
public function set_button_add_top($button_add_top)
{
$this->button_add_top=$button_add_top;
return $this;
}
/**
* @brief display the data of the table
* @param $p_order is the cond or order of the rows,
* if empty the primary key will be used
@ -658,7 +708,7 @@ function check()
}
$ret=$this->table->seek($p_order, $p_array);
$nb=Database::num_row($ret);
if ($this->can_append_row()==TRUE)
if ($this->can_append_row()==TRUE && $this->button_add_top == true)
{
echo HtmlInput::button_action(" "._("Ajout"),
sprintf("%s.input('-1','%s')",
@ -678,7 +728,10 @@ function check()
$visible++;
}
}
echo _('Cherche')." ".HtmlInput::filter_table("tb".$this->object_name, $result, 1);
if ( $this->get_search_table() )
{
echo _('Cherche')." ".HtmlInput::filter_table("tb".$this->object_name, $result, 1);
}
// Set a sort on a column if sort_column is not empty
if ( $this->sort_column =="")
@ -925,7 +978,7 @@ function check()
/**
* @brief display into a dialog box the datarow in order
* to be appended or modified. Can be override if you need
* a more complex form
* a more complex form.
*/
function input()
{
@ -1021,7 +1074,8 @@ function check()
}
/**
* @brief Save the record from Request into the DB and returns an XML
* to update the Html Element
* to update the Html Element. The function check() will be called before saving
* @see check
* @return \DOMDocument
*/
function ajax_save()
@ -1104,7 +1158,7 @@ function check()
ob_start();
echo HtmlInput::title_box(_("Donnée"), $this->dialog_box,"close","","y");
echo HtmlInput::title_box($this->getTitle(), $this->dialog_box,"close","","y","y");
printf('<form id="frm%s_%s" method="POST" onsubmit="%s.save(\'frm%s_%s\');return false;">',
$this->object_name, $this->table->get_pk_value(),
$this->object_name, $this->object_name,
@ -1119,10 +1173,10 @@ function check()
$this->display_error();
echo '<ul class="aligned-block">',
'<li>',
HtmlInput::submit('update', _("OK")),
HtmlInput::submit('update', _("Sauver")),
'</li>',
'<li>',
HtmlInput::button_action(_("Cancel"), $close, "", "smallbutton"),
HtmlInput::button_action(_("Annuler"), $close, "", "smallbutton"),
'</li>',
'</ul>';
echo "</form>";

View file

@ -30,83 +30,85 @@
<script>
var content=new Array();
content[0]="<?php echo htmlspecialchars(_("Cherchez en saisissant le quickcode, le poste comptable ou une partie du nom de la fiche ou de l'adresse"),ENT_QUOTES)?>";
content[1]="<?php echo htmlspecialchars(_("(optionnel) La description est un commentaire libre qui sert à identifier cette opération",ENT_QUOTES))?>";
content[2]="<?php echo htmlspecialchars(_("Selectionnez le journal l'opération doit être sauvée",ENT_QUOTES))?>";
content[3]="<?php echo htmlspecialchars(_("Les périodes comptables servent comme un second contrôle pour la date de l'opération. Modifiez dans vos préférence pour avoir une autre période par défaut. Pour ne plus avoir à changer la période aller dans COMPANY, et mettez 'Afficher la période comptable' à non",ENT_QUOTES))?>";
content[4]="<?php echo htmlspecialchars(_("(optionnel) L'échéance est la date limite de paiement",ENT_QUOTES))?>";
content[5]="<?php echo htmlspecialchars(_("(optionnel)Le numéro d'extrait permet de retrouver plus facilement l'extrait de banque",ENT_QUOTES))?>";
content[1]="<?php echo htmlspecialchars(_("(optionnel) La description est un commentaire libre qui sert à identifier cette opération"),ENT_QUOTES)?>";
content[2]="<?php echo htmlspecialchars(_("Selectionnez le journal l'opération doit être sauvée"),ENT_QUOTES)?>";
content[3]="<?php echo htmlspecialchars(_("Les périodes comptables servent comme un second contrôle pour la date de l'opération. Modifiez dans vos préférence pour avoir une autre période par défaut. Pour ne plus avoir à changer la période aller dans COMPANY, et mettez 'Afficher la période comptable' à non"),ENT_QUOTES)?>";
content[4]="<?php echo htmlspecialchars(_("(optionnel) L'échéance est la date limite de paiement"),ENT_QUOTES)?>";
content[5]="<?php echo htmlspecialchars(_("(optionnel)Le numéro d'extrait permet de retrouver plus facilement l'extrait de banque"),ENT_QUOTES)?>";
content[6]="<?php echo htmlspecialchars(_("Indiquez ici le prix hors tva si vous êtes affilié à la tva et que vous pouvez la déduire , sinon indiquez ici le total tva incluse et utilisez un taux tva de 0%"))?>";
content[7]="<?php echo htmlspecialchars(_("(optionnel) Ces champs servent à contrôler que les montants correspondent à l'extrait",ENT_QUOTES))?>";
content[8]="<?php echo htmlspecialchars(_("(optionnel) Ce montant correspond au total tva, si vous le laissez à vide, il sera calculé automatiquement en fonction du taux",ENT_QUOTES))?>";
content[9]="<?php echo htmlspecialchars(_("Tapez le numéro de poste ou une partie du poste ou du libellé puis sur recherche, Si vous avez donné un quickcode, le poste comptable ne sera pas utilisé",ENT_QUOTES))?>";
content[10]="<?php echo htmlspecialchars(_("ATTENTION changer le poste comptable d'une fiche <b>ne modifiera pas toutes les opérations</b> cette fiche est utilisée",ENT_QUOTES))?>";
content[11]="<?php echo htmlspecialchars(_("ATTENTION si le poste comptable est vide, il sera créé automatiquement",ENT_QUOTES))?>";
content[12]="<?php echo htmlspecialchars(_("Document généré uniquement si le mode de paiement est utilisé",ENT_QUOTES))?>";
content[13]="<?php echo htmlspecialchars(_("Vous pouvez utiliser le % pour indiquer le poste parent",ENT_QUOTES))?>";
content[14]="<?php echo htmlspecialchars(_("Attention, le poste comptable doit exister, il ne sera pas vérifié",ENT_QUOTES))?>";
content[15]="<?php echo htmlspecialchars(_("Laissez à 0 pour ne rien changer",ENT_QUOTES))?>";
content[16]="<?php echo htmlspecialchars(_("Vous devez donner la date par opération",ENT_QUOTES))?>";
content[17]="<?php echo htmlspecialchars(_("Cliquez sur le titre d'une colonne pour trier",ENT_QUOTES))?>";
content[18]="<?php echo htmlspecialchars(_("Donnez une partie du nom, prénom, de la description, du poste comptable, du de TVA,quick code ... ",ENT_QUOTES))?>";
content[19]="<?php echo htmlspecialchars(_("Donnez une partie du nom, de la description, du de TVA du poste comptable ou du quick code",ENT_QUOTES))?>";
content[20]="<?php echo htmlspecialchars(_("Les menus ne peuvent dépendre que dans d'un menu principal ou d'un menu, si cette liste est vide, ajouter des modules ou menu principal sans donner de dépendance",ENT_QUOTES))?>";
content[21]="<?php echo htmlspecialchars(_("Donnez un nombre entre 0 & 100",ENT_QUOTES))?>";
content[22]="<?php echo htmlspecialchars(_("Donnez une partie du nom du dossier,du nom, du prénom ou du login pour filtrer",ENT_QUOTES))?>";
content[23]="<?php echo htmlspecialchars(_("Donnez une partie du nom du dossier ou de la description pour filtrer",ENT_QUOTES))?>";
content[24]="<?php echo htmlspecialchars(_("Donnez une partie du poste comptable ou du libellé pour filtrer",ENT_QUOTES))?>";
content[25]="<?php echo htmlspecialchars(_("Donnez une partie du libellé, la date, le montant ou le numéro d'opération pour filtrer, cela n'efface pas ce qui a déjà été sélectionné",ENT_QUOTES))?>";
content[26]="<?php echo htmlspecialchars(_("Donnez une partie du quickcode, nom, description... pour filtrer",ENT_QUOTES))?>";
content[27]="<?php echo htmlspecialchars(_("Attention, <b>SI</b> la fiche a changé de poste comptable, c'est seulement le dernier qui est affiché",ENT_QUOTES))?>";
content[28]="<?php echo htmlspecialchars(_("Attention Différence entre TVA calculée et donnée",ENT_QUOTES))?>";
content[29]="<?php echo htmlspecialchars(_("Si vous ne donnez pas de nom, ce sera le nom du fichier qui sera utilisé",ENT_QUOTES))?>";
content[30]="<?php echo htmlspecialchars(_("Peut contenir une information telle que le message structuré sur le virement",ENT_QUOTES))?>";
content[31]="<?php echo htmlspecialchars(_("Peut contenir un numéro de bon de commande",ENT_QUOTES))?>";
content[7]="<?php echo htmlspecialchars(_("(optionnel) Ces champs servent à contrôler que les montants correspondent à l'extrait"),ENT_QUOTES)?>";
content[8]="<?php echo htmlspecialchars(_("(optionnel) Ce montant correspond au total tva, si vous le laissez à vide, il sera calculé automatiquement en fonction du taux"),ENT_QUOTES)?>";
content[9]="<?php echo htmlspecialchars(_("Tapez le numéro de poste ou une partie du poste ou du libellé puis sur recherche, Si vous avez donné un quickcode, le poste comptable ne sera pas utilisé"),ENT_QUOTES)?>";
content[10]="<?php echo htmlspecialchars(_("ATTENTION changer le poste comptable d'une fiche <b>ne modifiera pas toutes les opérations</b> cette fiche est utilisée"),ENT_QUOTES)?>";
content[11]="<?php echo htmlspecialchars(_("ATTENTION si le poste comptable est vide, il sera créé automatiquement"),ENT_QUOTES)?>";
content[12]="<?php echo htmlspecialchars(_("Document généré uniquement si le mode de paiement est utilisé"),ENT_QUOTES)?>";
content[13]="<?php echo htmlspecialchars(_("Vous pouvez utiliser le % pour indiquer le poste parent"),ENT_QUOTES)?>";
content[14]="<?php echo htmlspecialchars(_("Attention, le poste comptable doit exister, il ne sera pas vérifié"),ENT_QUOTES)?>";
content[15]="<?php echo htmlspecialchars(_("Laissez à 0 pour ne rien changer"),ENT_QUOTES)?>";
content[16]="<?php echo htmlspecialchars(_("Vous devez donner la date par opération"),ENT_QUOTES)?>";
content[17]="<?php echo htmlspecialchars(_("Cliquez sur le titre d'une colonne pour trier"),ENT_QUOTES)?>";
content[18]="<?php echo htmlspecialchars(_("Donnez une partie du nom, prénom, de la description, du poste comptable, du de TVA,quick code ... "),ENT_QUOTES)?>";
content[19]="<?php echo htmlspecialchars(_("Donnez une partie du nom, de la description, du de TVA du poste comptable ou du quick code"),ENT_QUOTES)?>";
content[20]="<?php echo htmlspecialchars(_("Les menus ne peuvent dépendre que dans d'un menu principal ou d'un menu, si cette liste est vide, ajouter des modules ou menu principal sans donner de dépendance"),ENT_QUOTES)?>";
content[21]="<?php echo htmlspecialchars(_("Donnez un nombre entre 0 & 100"),ENT_QUOTES)?>";
content[22]="<?php echo htmlspecialchars(_("Donnez une partie du nom du dossier,du nom, du prénom ou du login pour filtrer"),ENT_QUOTES)?>";
content[23]="<?php echo htmlspecialchars(_("Donnez une partie du nom du dossier ou de la description pour filtrer"),ENT_QUOTES)?>";
content[24]="<?php echo htmlspecialchars(_("Donnez une partie du poste comptable ou du libellé pour filtrer"),ENT_QUOTES)?>";
content[25]="<?php echo htmlspecialchars(_("Donnez une partie du libellé, la date, le montant ou le numéro d'opération pour filtrer, cela n'efface pas ce qui a déjà été sélectionné"),ENT_QUOTES)?>";
content[26]="<?php echo htmlspecialchars(_("Donnez une partie du quickcode, nom, description... pour filtrer"),ENT_QUOTES)?>";
content[27]="<?php echo htmlspecialchars(_("Attention, <b>SI</b> la fiche a changé de poste comptable, c'est seulement le dernier qui est affiché"),ENT_QUOTES)?>";
content[28]="<?php echo htmlspecialchars(_("Attention Différence entre TVA calculée et donnée"),ENT_QUOTES)?>";
content[29]="<?php echo htmlspecialchars(_("Si vous ne donnez pas de nom, ce sera le nom du fichier qui sera utilisé"),ENT_QUOTES)?>";
content[30]="<?php echo htmlspecialchars(_("Peut contenir une information telle que le message structuré sur le virement"),ENT_QUOTES)?>";
content[31]="<?php echo htmlspecialchars(_("Peut contenir un numéro de bon de commande"),ENT_QUOTES)?>";
content[32]="<?php echo htmlspecialchars(_('Le résultat peut changer en fonction du type de journal',ENT_QUOTES));?>";
content[32]="<?php echo htmlspecialchars(_('Le résultat peut changer en fonction du type de journal'),ENT_QUOTES);?>";
content[33]="<?php echo htmlspecialchars(_("le type vaut : ME pour Menu, PR pour les impressions,PL pour les plugins,SP pour des valeurs spéciales",ENT_QUOTES))?>";
content[34]="<?php echo htmlspecialchars(_("Cliquez sur le code AD pour ouvrir le menu dans un nouvel onglet",ENT_QUOTES))?>";
content[35]="<?php echo htmlspecialchars(_("Cliquez sur le chemin pour ouvrir le menu",ENT_QUOTES))?>";
content[36]="<?php echo htmlspecialchars(_("En utilisant les dates d échéance ou de paiement, seuls les journaux de type ACH et VEN seront utilisés ,vous excluez d office les autres journaux",ENT_QUOTES))?>";
content[37]="<?php echo htmlspecialchars(_("Les dates sont en format DD.MM.YYYY",ENT_QUOTES))?>";
content[38]="<?php echo htmlspecialchars(_("La numérotation est propre à chaque journal. Laissez à 0 pour ne pas changer le numéro",ENT_QUOTES))?>";
content[39]="<?php echo htmlspecialchars(_("Le préfixe des pièces doit être différent pour chaque journal, on peut aussi utiliser l'année",ENT_QUOTES))?>";
content[40]="<?php echo htmlspecialchars(_("Laissez à 0 pour ne pas changer le numéro",ENT_QUOTES))?>";
content[41]="<?php echo htmlspecialchars(_("Mettez le pourcentage <br> à zéro pour effacer la ligne",ENT_QUOTES))?>";
content[42]="<?php echo htmlspecialchars(_("Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche",ENT_QUOTES))?>";
content[43]="<?php echo htmlspecialchars(_("Autoliquidation : Utilisé en même temps au crédit et au débit",ENT_QUOTES))?>";
content[44]="<?php echo htmlspecialchars(_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à l'achat",ENT_QUOTES))?>";
content[45]="<?php echo htmlspecialchars(_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à la vente",ENT_QUOTES))?>";
content[46]="<?php echo htmlspecialchars(_("Un instant svp",ENT_QUOTES))?>";
content[47]="<?php echo htmlspecialchars(_("Vous confirmez ?",ENT_QUOTES))?>";
content[48]="<?php echo htmlspecialchars(_("Echec ",ENT_QUOTES))?>";
content[49]="<?php echo htmlspecialchars(_("Echec donnée manquante ou incorrecte",ENT_QUOTES))?>";
content[50]="<?php echo htmlspecialchars(_("Vous confirmez effacement ?",ENT_QUOTES))?>";
content[51]="<?php echo htmlspecialchars(_("Vous confirmez mise à jour ?",ENT_QUOTES))?>";
content[33]="<?php echo htmlspecialchars(_("le type vaut : ME pour Menu, PR pour les impressions,PL pour les plugins,SP pour des valeurs spéciales"),ENT_QUOTES)?>";
content[34]="<?php echo htmlspecialchars(_("Cliquez sur le code AD pour ouvrir le menu dans un nouvel onglet"),ENT_QUOTES)?>";
content[35]="<?php echo htmlspecialchars(_("Cliquez sur le chemin pour ouvrir le menu"),ENT_QUOTES)?>";
content[36]="<?php echo htmlspecialchars(_("En utilisant les dates d échéance ou de paiement, seuls les journaux de type ACH et VEN seront utilisés ,vous excluez d office les autres journaux"),ENT_QUOTES)?>";
content[37]="<?php echo htmlspecialchars(_("Les dates sont en format DD.MM.YYYY"),ENT_QUOTES)?>";
content[38]="<?php echo htmlspecialchars(_("La numérotation est propre à chaque journal. Laissez à 0 pour ne pas changer le numéro"),ENT_QUOTES)?>";
content[39]="<?php echo htmlspecialchars(_("Le préfixe des pièces doit être différent pour chaque journal, on peut aussi utiliser l'année"),ENT_QUOTES)?>";
content[40]="<?php echo htmlspecialchars(_("Laissez à 0 pour ne pas changer le numéro"),ENT_QUOTES)?>";
content[41]="<?php echo htmlspecialchars(_("Mettez le pourcentage <br> à zéro pour effacer la ligne"),ENT_QUOTES)?>";
content[42]="<?php echo htmlspecialchars(_("Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche"),ENT_QUOTES)?>";
content[43]="<?php echo htmlspecialchars(_("Autoliquidation : Utilisé en même temps au crédit et au débit"),ENT_QUOTES)?>";
content[44]="<?php echo htmlspecialchars(_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à l'achat"),ENT_QUOTES)?>";
content[45]="<?php echo htmlspecialchars(_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à la vente"),ENT_QUOTES)?>";
content[46]="<?php echo htmlspecialchars(_("Un instant svp"),ENT_QUOTES)?>";
content[47]="<?php echo htmlspecialchars(_("Vous confirmez ?"),ENT_QUOTES)?>";
content[48]="<?php echo htmlspecialchars(_("Echec "),ENT_QUOTES)?>";
content[49]="<?php echo htmlspecialchars(_("Echec donnée manquante ou incorrecte"),ENT_QUOTES)?>";
content[50]="<?php echo htmlspecialchars(_("Vous confirmez effacement ?"),ENT_QUOTES)?>";
content[51]="<?php echo htmlspecialchars(_("Vous confirmez mise à jour ?"),ENT_QUOTES)?>";
content[52]="<?php echo htmlspecialchars(_("Si vous changez de page vous perdez les reconciliations, continuez ?"),ENT_QUOTES) ?>";
content[53]="<?php echo htmlspecialchars(_("Echec réponse",ENT_QUOTES))?>";
content[54]="<?php echo htmlspecialchars(_("Désolé, les montants pour la comptabilité analytique sont incorrects",ENT_QUOTES))?>";
content[55]="<?php echo htmlspecialchars(_("Maximum 15 lignes",ENT_QUOTES))?>";
content[56]="<?php echo htmlspecialchars(_("Maximum",ENT_QUOTES))?>";
content[57]="<?php echo htmlspecialchars(_("calculé",ENT_QUOTES))?>";
content[53]="<?php echo htmlspecialchars(_("Echec réponse"),ENT_QUOTES)?>";
content[54]="<?php echo htmlspecialchars(_("Désolé, les montants pour la comptabilité analytique sont incorrects"),ENT_QUOTES)?>";
content[55]="<?php echo htmlspecialchars(_("Maximum 15 lignes"),ENT_QUOTES)?>";
content[56]="<?php echo htmlspecialchars(_("Maximum"),ENT_QUOTES)?>";
content[57]="<?php echo htmlspecialchars(_("calculé"),ENT_QUOTES)?>";
content[58]="<?php echo htmlspecialchars(_("Balance incorrecte D/C")),ENT_QUOTES; ?>";
content[59]="<?php echo htmlspecialchars(_("Action non autorisée")),ENT_QUOTES; ?>";
content[60]="<?php echo htmlspecialchars(_("Donnée manquante ou déjà supprimée"),ENT_QUOTES) ?>";
content[61]="<?php echo htmlspecialchars(_('Désolé, événement en cours de création à sauver')),ENT_QUOTES; ?>";
content[62]="<?php echo htmlspecialchars(_("Cacher",ENT_QUOTES))?>";
content[63]="<?php echo htmlspecialchars(_("Afficher",ENT_QUOTES))?>";
content[64]="<?php echo htmlspecialchars(_("Traitement en cours",ENT_QUOTES))?>";
content[65]="<?php echo htmlspecialchars(_("Un instant",ENT_QUOTES))?>";
content[66]="<?php echo htmlspecialchars(_("Calculatrice",ENT_QUOTES))?>";
content[67]="<?php echo htmlspecialchars(_('Taper une formule (ex 20*5.1) puis enter',ENT_QUOTES))?>";
content[62]="<?php echo htmlspecialchars(_("Cacher"),ENT_QUOTES)?>";
content[63]="<?php echo htmlspecialchars(_("Afficher"),ENT_QUOTES)?>";
content[64]="<?php echo htmlspecialchars(_("Traitement en cours"),ENT_QUOTES)?>";
content[65]="<?php echo htmlspecialchars(_("Un instant"),ENT_QUOTES)?>";
content[66]="<?php echo htmlspecialchars(_("Calculatrice"),ENT_QUOTES)?>";
content[67]="<?php echo htmlspecialchars(_('Taper une formule (ex 20*5.1) puis enter'),ENT_QUOTES)?>";
content[68]="<?php echo htmlspecialchars(_("Calculatrice simplifiée: écrivez simplement les opérations que vous voulez puis la touche retour. exemple : 1+2+3*(1/5)"),ENT_QUOTES);?>";
content[69]="<?php echo htmlspecialchars(_("Aucune donnée",ENT_QUOTES))?>";
content[70]="<?php echo htmlspecialchars(_("Votre demande est en cours de traitement",ENT_QUOTES))?>";
content[71]="<?php echo htmlspecialchars(_('Limite le type de fiche si vous choisissez la fiche à la saisie, uniquement avec journaux OD',ENT_QUOTES));?>";
content[72]="<?php echo htmlspecialchars(_("Pour les journaux FIN, ce sera la fiche du journal",ENT_QUOTES));?>";
content[73]="<?php echo htmlspecialchars(_("Mettre à oui pour un journal dédié uniquement aux notes de crédit ou de débit, il affichera un avertissement si le montant n'est pas en négatif",ENT_QUOTES));?>";
content[74]="<?php echo htmlspecialchars(_('TVA due ou récupérable quand l\'opération est payée ou exécutée',ENT_QUOTES))?>";
content[75]="<?php echo htmlspecialchars(_('Journaux Achat ou vente en mode simple, TVA ou détaillé',ENT_QUOTES))?>";
content[76]="<?php echo htmlspecialchars(_('Il est conseillé d\'avoir un quickcode de moins de 9 car.',ENT_QUOTES))?>";
content[77]="<?php echo htmlspecialchars(_("Permet de chercher dans le suivi pour les contacts multiples",ENT_QUOTES))?>";
content[69]="<?php echo htmlspecialchars(_("Aucune donnée"),ENT_QUOTES)?>";
content[70]="<?php echo htmlspecialchars(_("Votre demande est en cours de traitement"),ENT_QUOTES)?>";
content[71]="<?php echo htmlspecialchars(_('Limite le type de fiche si vous choisissez la fiche à la saisie, uniquement avec journaux OD'),ENT_QUOTES);?>";
content[72]="<?php echo htmlspecialchars(_("Pour les journaux FIN, ce sera la fiche du journal"),ENT_QUOTES);?>";
content[73]="<?php echo htmlspecialchars(_("Mettre à oui pour un journal dédié uniquement aux notes de crédit ou de débit, il affichera un avertissement si le montant n'est pas en négatif"),ENT_QUOTES);?>";
content[74]="<?php echo htmlspecialchars(_('TVA due ou récupérable quand l\'opération est payée ou exécutée'),ENT_QUOTES)?>";
content[75]="<?php echo htmlspecialchars(_('Journaux Achat ou vente en mode simple, TVA ou détaillé'),ENT_QUOTES)?>";
content[76]="<?php echo htmlspecialchars(_('Il est conseillé d\'avoir un quickcode de moins de 9 car.'),ENT_QUOTES)?>";
content[77]="<?php echo htmlspecialchars(_("Permet de chercher dans le suivi pour les contacts multiples"),ENT_QUOTES)?>";
<?php $file_too_large=sprintf("Fichier trop grand , taille max = %s mb",(round(MAX_FILE_SIZE/1024/1024,2)));?>
content[78]="<?php echo htmlspecialchars($file_too_large,ENT_QUOTES)?>";
</script>

View file

@ -109,109 +109,14 @@ class Select_Box
switch ($this->position)
{
case 'absolute':
// Show when click
$javascript=sprintf('
$("%s_bt").onclick=function() {
try {
if (! document.getElementById("select_box%s") ) {
var newDiv=new Element("div");
newDiv.id="select_box%s";
document.body.appendChild(newDiv);
newDiv.addClassName("select_box");
$("select_box%s").onmouseleave=function() {
try {
var newDiv=$("select_box%s");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}
} else {
var newDiv=document.getElementById("select_box%s");
}
newDiv.innerHTML=$("select_box%s").innerHTML;
var pos=$("%s_bt").cumulativeOffset();
var nTop=pos.top;
var viewport = document.viewport.getDimensions();
if ( nTop> viewport.height-newDiv.getHeight()-20) { nTop-=newDiv.getHeight()-5}
newDiv.setStyle({display:"block",position:"absolute",top:nTop+"px",left:pos.left+5+"px","z-index":999});
if ( $("search_%s") ) { $("search_%s").focus();}
} catch(e) {
alert(e.message);
}
}
', $this->id, $this->id, $this->id,$this->id, $this->id, $this->id, $this->id, $this->id, $list_id, $list_id);
break;
case "normal":
// Show when click
$javascript=sprintf('$("%s_bt").onclick=function() {
try {
var newDiv=$("select_box%s");
var pos=$("%s_bt").cumulativeOffset();
newDiv.setStyle({display:"block",position:"fixed",top:pos.top+25+"px",left:pos.left+5+"px"});
if ( $("search_%s") ) { $("search_%s").focus();}
} catch(e) {
alert(e.message);
}
}
', $this->id, $this->id, $this->id, $list_id, $list_id);
// Hide when out of the zone
$javascript.=sprintf('$("select_box%s").onmouseleave=function() {
try {
var newDiv=$("select_box%s");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}', $this->id, $this->id);
break;
case "in-absolute":
// Show when click
$javascript=sprintf('
$("%s_bt").onclick=function() {
try {
if (! document.getElementById("select_box_content") ) {
var newDiv=new Element("div");
newDiv.id="select_box_content";
document.body.appendChild(newDiv);
newDiv.addClassName("select_box");
$("select_box_content").onmouseleave=function() {
try {
var newDiv=$("select_box_content");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}
} else {
var newDiv=document.getElementById("select_box_content");
}
newDiv.innerHTML=$("select_box%s").innerHTML;
var pos=$("%s_bt").cumulativeOffset();
var nTop=pos.top;
var viewport = document.viewport.getDimensions();
if ( nTop> viewport.height-newDiv.getHeight()-20) { nTop-=newDiv.getHeight()-5}
newDiv.setStyle({display:"block",position:"absolute",top:nTop+"px",left:pos.left+5+"px","z-index":999});
if ( $("search_%s") ) { $("search_%s").focus();}
} catch(e) {
alert(e.message);
}
displaySelectBox("%s");
}
', $this->id, $this->id, $this->id, $list_id, $list_id);
', $this->id, $this->id);
break;
@ -228,12 +133,13 @@ class Select_Box
// Show when click
$javascript=$this->compute_position();
// display the button
printf('<input type="button" class="smallbutton " id="%s_bt" value="%s &#x25BE;" >', $this->id, $this->value);
printf('<input type="hidden" id="%s" name="%s" value="%s">', $this->id, $this->id, $this->default_value);
printf('<div class="select_box " id="select_box%s" style="%s">', $this->id, $this->style_box);
printf('<input type="button" class="smallbutton " id="%s_bt" value="%s &#x25BE;" >',
$this->id, $this->value);
printf('<input type="hidden" id="%s" name="%s" value="%s">',
$this->id, $this->id, $this->default_value);
printf('<div class="select_box " id="select_box%s" style="%s">',
$this->id, $this->style_box);
// Show the filter if there is one,
if ($this->filter!="")

View file

@ -71,6 +71,7 @@ echo $ledger->confirm($_POST,false);
<div id="document_div_id" style="display:none;height:185px;height:10rem">
<?php
$file = new IFile();
$file->setAlertOnSize(true);
$file->table = 0;
echo '<p class="decale">';
echo _("Ajoutez une pièce justificative ");

View file

@ -0,0 +1,253 @@
begin;
-- improve vw_fiche_attr
alter table fiche add column f_enable char(1);
update fiche set f_enable=ad_value from fiche_detail as fd1 where fd1.f_id=fiche.f_id and ad_id=54;
update fiche set f_enable='1' where f_enable is null;
alter table fiche alter f_enable set not null;
alter table fiche add constraint f_enable_ck check (f_enable in ('0','1'));
comment on column fiche.f_enable is 'value = 1 if card enable , otherwise 0 ';
-- improve performance on this view
drop index if exists fiche_detail_attr_ix;
create index fiche_detail_attr_ix on fiche_detail (ad_id);
drop view vw_fiche_attr cascade;
-- add "fiche.f_enable" in the view
create view vw_fiche_attr as SELECT a.f_id,
a.fd_id,
a.ad_value AS vw_name,
k.ad_value AS vw_first_name,
b.ad_value AS vw_sell,
c.ad_value AS vw_buy,
d.ad_value AS tva_code,
tva_rate.tva_id,
tva_rate.tva_rate,
tva_rate.tva_label,
e.ad_value AS vw_addr,
f.ad_value AS vw_cp,
j.ad_value AS quick_code,
h.ad_value AS vw_description,
i.ad_value AS tva_num,
fiche_def.frd_id,
l.ad_value AS accounting,
f_enable
FROM ( SELECT fiche.f_id,
fiche.fd_id,
fiche.f_enable,
fiche_detail.ad_value
FROM fiche
LEFT JOIN fiche_detail USING (f_id)
WHERE fiche_detail.ad_id = 1) a
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 6) b ON a.f_id = b.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 7) c ON a.f_id = c.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 2) d ON a.f_id = d.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 14) e ON a.f_id = e.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 15) f ON a.f_id = f.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 23) j ON a.f_id = j.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 9) h ON a.f_id = h.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 13) i ON a.f_id = i.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 32) k ON a.f_id = k.f_id
LEFT JOIN tva_rate ON d.ad_value = tva_rate.tva_id::text
JOIN fiche_def USING (fd_id)
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 5) l ON a.f_id = l.f_id
;
create view v_detail_sale as
WITH m AS (
SELECT sum(quant_sold_1.qs_price) AS htva,
sum(quant_sold_1.qs_vat) AS tot_vat,
sum(quant_sold_1.qs_vat_sided) AS tot_tva_np,
jrn_1.jr_id
FROM quant_sold quant_sold_1
JOIN jrnx jrnx_1 USING (j_id)
JOIN jrn jrn_1 ON jrnx_1.j_grpt = jrn_1.jr_grpt_id
GROUP BY jrn_1.jr_id
)
SELECT jrn.jr_id,
jrn.jr_date,
jrn.jr_date_paid,
jrn.jr_ech,
jrn.jr_tech_per,
jrn.jr_comment,
jrn.jr_pj_number,
jrn.jr_internal,
jrn.jr_def_id,
jrnx.j_poste,
jrnx.j_text,
jrnx.j_qcode,
jrn.jr_rapt,
quant_sold.qs_fiche AS item_card,
a.name AS item_name,
quant_sold.qs_client,
b.vw_name AS tiers_name,
b.quick_code,
tva_rate.tva_label,
tva_rate.tva_comment,
tva_rate.tva_both_side,
quant_sold.qs_vat_sided AS vat_sided,
quant_sold.qs_vat_code AS vat_code,
quant_sold.qs_vat AS vat,
quant_sold.qs_price AS price,
quant_sold.qs_quantite AS quantity,
quant_sold.qs_price / quant_sold.qs_quantite AS price_per_unit,
m.htva,
m.tot_vat,
m.tot_tva_np,
oc.oc_amount,
oc.oc_vat_amount,
( SELECT currency.cr_code_iso
FROM currency
WHERE jrn.currency_id = currency.id) AS cr_code_iso
FROM jrn
JOIN jrnx ON jrn.jr_grpt_id = jrnx.j_grpt
JOIN quant_sold USING (j_id)
JOIN vw_fiche_name a ON quant_sold.qs_fiche = a.f_id
JOIN vw_fiche_attr b ON quant_sold.qs_client = b.f_id
JOIN tva_rate ON quant_sold.qs_vat_code = tva_rate.tva_id
JOIN m ON m.jr_id = jrn.jr_id
LEFT JOIN operation_currency oc ON oc.j_id = jrnx.j_id;
create view v_detail_purchase as
WITH m AS (
SELECT sum(quant_purchase_1.qp_price) AS htva,
sum(quant_purchase_1.qp_vat) AS tot_vat,
sum(quant_purchase_1.qp_vat_sided) AS tot_tva_np,
jrn_1.jr_id
FROM quant_purchase quant_purchase_1
JOIN jrnx jrnx_1 USING (j_id)
JOIN jrn jrn_1 ON jrnx_1.j_grpt = jrn_1.jr_grpt_id
GROUP BY jrn_1.jr_id
)
SELECT jrn.jr_id,
jrn.jr_date,
jrn.jr_date_paid,
jrn.jr_ech,
jrn.jr_tech_per,
jrn.jr_comment,
jrn.jr_pj_number,
jrn.jr_internal,
jrn.jr_def_id,
jrnx.j_poste,
jrnx.j_text,
jrnx.j_qcode,
jrn.jr_rapt,
quant_purchase.qp_fiche AS item_card,
a.name AS item_name,
quant_purchase.qp_supplier,
b.vw_name AS tiers_name,
b.quick_code,
tva_rate.tva_label,
tva_rate.tva_comment,
tva_rate.tva_both_side,
quant_purchase.qp_vat_sided AS vat_sided,
quant_purchase.qp_vat_code AS vat_code,
quant_purchase.qp_vat AS vat,
quant_purchase.qp_price AS price,
quant_purchase.qp_quantite AS quantity,
quant_purchase.qp_price / quant_purchase.qp_quantite AS price_per_unit,
quant_purchase.qp_nd_amount AS non_ded_amount,
quant_purchase.qp_nd_tva AS non_ded_tva,
quant_purchase.qp_nd_tva_recup AS non_ded_tva_recup,
m.htva,
m.tot_vat,
m.tot_tva_np,
oc.oc_amount,
oc.oc_vat_amount,
( SELECT currency.cr_code_iso
FROM currency
WHERE jrn.currency_id = currency.id) AS cr_code_iso
FROM jrn
JOIN jrnx ON jrn.jr_grpt_id = jrnx.j_grpt
JOIN quant_purchase USING (j_id)
JOIN vw_fiche_name a ON quant_purchase.qp_fiche = a.f_id
JOIN vw_fiche_attr b ON quant_purchase.qp_supplier = b.f_id
JOIN tva_rate ON quant_purchase.qp_vat_code = tva_rate.tva_id
JOIN m ON m.jr_id = jrn.jr_id
LEFT JOIN operation_currency oc ON oc.j_id = jrnx.j_id;
COMMENT ON VIEW vw_fiche_attr IS 'Some attribute for all cards';
comment on view v_detail_sale is 'Summary one row by sale ';
comment on view v_detail_purchase is 'Summary one row by purchase';
-- remove
delete from fiche_detail where ad_id=54;
delete from attr_min where ad_id=54;
delete from attr_def where ad_id=54;
delete from jnt_fic_attr where ad_id =54;
-- open COMPANY when PARAM is choosen for profile 1
update profile_menu set pm_default=1,p_order=1 where pm_id=54;
update menu_ref set me_menu ='Nouvel achat' where me_code in ('ACH');
update menu_ref set me_menu ='Nouvelle vente' where me_code in ('VEN');
update menu_ref set me_menu ='Nouvelle opération' where me_code in ('ODS');
COMMENT ON TABLE public.action_gestion_comment IS 'comment on action management';
COMMENT ON TABLE public.action_gestion_operation IS 'Operation linked on action';
COMMENT ON TABLE public.action_gestion_related IS 'link between action';
COMMENT ON TABLE public.action_tags IS 'Tags link to action';
COMMENT ON TABLE public.currency IS 'currency';
COMMENT ON TABLE public.currency_history IS 'currency values history';
COMMENT ON TABLE public.del_action IS 'deleted actions';
COMMENT ON TABLE public.del_jrn IS 'deleted operation';
COMMENT ON TABLE public.del_jrnx IS 'delete operation details';
COMMENT ON TABLE public.forecast_cat IS 'Category of forecast';
COMMENT ON TABLE public.forecast_item IS 'items of forecast';
COMMENT ON TABLE public.formdef IS 'Simple Report name';
COMMENT ON TABLE public.form IS 'Simple report definition';
COMMENT ON TABLE public.groupe_analytique IS 'Group of analytic accountancy';
COMMENT ON TABLE public.jnt_document_option_contact IS 'Many to many table between document and contact option';
COMMENT ON TABLE public.jnt_letter IS 'm2m tables for lettering';
COMMENT ON TABLE public.jrn_info IS 'extra info for operation';
COMMENT ON TABLE public.jrn_periode IS 'Period by ledger';
COMMENT ON TABLE public.letter_cred IS 'Letter cred';
COMMENT ON TABLE public.letter_deb IS 'letter deb';
COMMENT ON TABLE public.menu_default IS 'default menu for certains actions';
COMMENT ON TABLE public.menu_ref IS 'Definition of all the menu';
COMMENT ON TABLE public.operation_currency IS 'Information about currency';
COMMENT ON TABLE public.operation_tag IS 'Tag for operation';
COMMENT ON TABLE public.parm_code IS 'Parameter code and accountancy';
COMMENT ON TABLE public.profile_menu_type IS 'Type of menu';
COMMENT ON TABLE public.quant_purchase IS 'Supplemental info for purchase';
COMMENT ON TABLE public.stock_change IS 'Change of stock';
COMMENT ON TABLE public.tags IS 'Tags name';
COMMENT ON TABLE public.user_filter IS 'Filter for the search';
COMMENT ON TABLE public.user_active_security IS 'Security for user';
COMMENT ON TABLE public.user_sec_act IS 'Security on actions for user';
COMMENT ON TABLE public.user_sec_jrn IS 'Security on ledger for users';
COMMENT ON TABLE public."version" IS 'DB version';
insert into version (val,v_description) values (152,'Comment on tables,card structure change');
commit;

View file

@ -0,0 +1,7 @@
begin;
insert into document_option (do_code,document_type_id,do_enable,do_option)
select 'videoconf_server',dt_id,'1','https://www.free-solutions.org/'
from
document_type;
insert into version (val,v_description) values (153,'Add videoconf server');
commit;

View file

@ -118,8 +118,20 @@ $select_comment_type->set_value(Document_Option::option_comment($table->dt_id));
echo $select_comment_type->input();
?>
</li>
<li>
<?php
$i=new ICheckBox("videoconf_server",1);
$checked = (Document_Option::is_enable_video_conf($table->dt_id)==true) ?1:0;
$i->set_check($checked);
echo $i->input();
echo _("Serveur de videoconf");
$itVideoconfServer=new IText("videoconf_server_url");
$itVideoconfServer->value=Document_Option::option_video_conf($table->dt_id);
echo $itVideoconfServer->input();
?>
</li>
</ul>
</div>
<div>
<h3 class="info" sytle="margin-block: 4px"><?php echo _("Options contact") ?></h3>

View file

@ -62,12 +62,25 @@ $uniq=uniqid("tab",TRUE);
?>
</td>
</Tr>
<?php
//----------------------- Video Conf --------------------------------------------------------------------------------
if (Document_Option::is_enable_video_conf($this->dt_id)):?>
<tr>
<td><?=_("VideoConf")?></td>
<td><A href="<?=Document_Option::option_video_conf($this->dt_id)?>" target="_blank">
<?=_("Salle de réunion")?>
</a>
</tr>
<?php endif;?>
<tr>
<TD colspan="2">
<?php echo $spcontact->input(); ?>
</td>
</Tr>
<?php if ($this->ag_id > 0 && Document_Option::is_enable_contact_multiple($this->dt_id)): ?>
<?php
//----------------------- Contact Multiple ----------------------------------------------------------------------------
if ($this->ag_id > 0 && Document_Option::is_enable_contact_multiple($this->dt_id)):
?>
<tr>
<td>
<?php echo _('Autres concernés')?>
@ -484,6 +497,11 @@ try {
docAdded=document.getElementById('add_file');
new_element=document.createElement('li');
new_element.innerHTML='<input class="inp" type="file" value="" name="file_upload[]"/><label>Description</label> <input type="input" class="input_text" name="input_desc[]" >';
new_element.innerHTML+='<span id="<?=uniqid("file")?>" onclick="document.getElementById(\'add_file\').removeChild(this.parentNode)" class="icon">&#xe80f;</span>';
docAdded.appendChild(new_element);
}
catch(exception) { alert('<?php echo j(_('Je ne peux pas ajouter de fichier'))?>'); alert(exception.message);}
@ -498,6 +516,10 @@ catch(exception) { alert('<?php echo j(_('Je ne peux pas ajouter de fichier'))?>
?>
<label><?php echo _('Description')?></label>
<input type="input" class="input_text" name="input_desc[]" >
<?php
$js="document.getElementById('add_file').removeChild(this.parentNode)";
echo Icon_Action::trash(uniqid(),$js);
?>
</li>
</ol>
<span >

View file

@ -14,7 +14,7 @@
require_once NOALYSS_INCLUDE."/lib/select_box.class.php";
$select_box=new \Select_Box("sb_".$jr_id, _("Autre action"));
$select_box->set_position("in-absolute");
$select_box->set_position("normal");
$cn=Dossier::connect();
// Contains all the linked actions
$a_followup = Follow_Up::get_all_operation($jr_id);

View file

@ -10,7 +10,7 @@ global $g_failed;
if ( count($this->content) == 0 ) :
?>
<h2 class="info2"><?php echo _('Désolé aucun résultat trouvé')?></h2>
<h2 class="error"><?php echo _('Désolé aucun résultat trouvé')?></h2>
<?php exit();
endif;?>

View file

@ -8,7 +8,7 @@ require_once NOALYSS_INCLUDE.'/class/acc_reconciliation.class.php';
$gDossier=dossier::id();
if ( count($this->content) == 0 ) :
?>
<h2 class="info2"><?php echo _('Désolé aucun résultat trouvé')?></h2>
<h2 class="error"><?php echo _('Désolé aucun résultat trouvé')?></h2>
<?php
else :

View file

@ -35,7 +35,7 @@
// Display the menu
for($i=0;$i < count($amenu);$i++):
if ( (count($amenu)==1)) {
$class="selectedcell";
$class="mtitle selectedcell";
?>
<td class="<?php echo $class?>">
<a class="mtitle" href="do.php?gDossier=<?php echo Dossier::id()?>&ac=<?php echo $access_code?>" title="<?php echo h(gettext($amenu[$i]['me_description']))?>" >
@ -71,7 +71,7 @@
$url=$a_request[0].'/'.$a_request[1];
}
$url.='/'.$amenu[$i]['me_code'];
if ($url == $access_code ) $class="selectedcell";
if ($url == $access_code ) $class="mtitle selectedcell";
$url="do.php?gDossier=".Dossier::id()."&ac=".$url;
}

View file

@ -92,12 +92,15 @@ $http=new HttpInput();
for ($i = 0 ; $i < 10 ; $i ++) :
echo '<li>';
$check[$i]=new InputCheckBox("check[]",1,"checkid".$i);
$check[$i]->classrange="improvechkbox";
echo $i, " - name = ",$check[$i]->value_container,",id = " , $check[$i]->id_icon,$check[$i]->input();
echo '</li>';
endfor;
?>
</ul>
<aside>les selections par plage ne fonctionnent pas encore avec les CHECKBOX améliorés</aside>
<script> activate_checkbox_range("improvechkbox")</script>
<h1>Submit</h1>
<pre>
echo HtmlInput::submit("submit", _("Envoi"));
@ -125,6 +128,54 @@ $http=new HttpInput();
?>
</ol>
</form>
<h2>
Fichier - IFile
</h2>
<form method="POST" enctype="application/x-www-form-urlencoded" onsubmit="check_size();return false;">
<span id="file-info"></span>
<?php
$file=new IFILE("file_to_upload");
$file->id="file_to_upload";
echo "fichier ",$file->input();
echo HtmlInput::submit("file","Upload");
?>
<p>Vérifier le changement de taille fichier dans la console JS</p>
</form>
<script>
function check_size()
{
var aFile=document.getElementsByTagName("input");
console.debug("afile");
console.debug(aFile);
var info=document.getElementById("file-info");
for (var i = 0;i < aFile.length;i++) {
if ( aFile[i].getAttribute("type")==="file" ) {
console.debug("file"+aFile[i].files[0].size);
info.innerHTML+="file : "+aFile[i].files[0].name+":"+aFile[i].files[0].size+" bytes <br>";
}
}
}
document.getElementById("file_to_upload").addEventListener("change",function() {
if ( this.files[0] ) {
console.debug("file"+this.files[0].size);
}
});
</script>
<h2>ICArd</h2>
<h3>Aucun param suppl.</h3>
<?php
$icard=new ICard("test");
echo $icard->input();
echo $icard->search();
?>
<div id="debug_box"></div>

View file

@ -83,4 +83,9 @@ include_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
</p>
<p>
Comment<?php echo Icon_Action::comment("Allo ? l'heure d'été ?")?>
</p>
<p>
<div id="enlarge_it" class="inner_box">
enlarge <?php echo Icon_Action::full_size("enlarge_it")?>
</div>
</p>

View file

@ -23,7 +23,7 @@
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
//@description:Test the class Inplace_Edit , ajax and javascript
$db=Dossier::connect();
require_once NOALYSS_INCLUDE . '/lib/itext.class.php';
require_once NOALYSS_INCLUDE . '/lib/inum.class.php';
@ -44,13 +44,9 @@ if (!isset($_REQUEST["TestAjaxFile"])) {
echo "TEXT #".$ajax_hello->input()."#";
$select = new ISelect ("ajax_select");
$select->value=$db->make_array("select fd_id,fd_label from fiche_def order by 2");
$select->id=uniqid("sel");
$select->value=[
["value"=>1,"label"=>"ONE"],
["value"=>2,"label"=>"TWO"],
["value"=>3,"label"=>"THREE"],
];
$select->selected="2";
$select->selected="10001";
$ajax_select = new Inplace_Edit($select);
$ajax_select->set_callback("ajax_test.php");
$ajax_select->add_json_param("TestAjaxFile", __FILE__) ;

View file

@ -3,16 +3,47 @@
<script src="prototype.js"></script>
<style>
/* The container <div> - needed to position the dropdown content */
.select_box{
position: relative;
display: inline-block;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #f1f1f1}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
display: block;
}
.select_box {
border:solid 0.5px darkblue;
background:white;
width:455px;
max-width:250px;
padding:3px;
margin:0px;
display:none;
top:-17px;
position:absolute;
border:solid 0.5px darkblue;
background:white;
width:455px;
max-width:250px;
padding:3px;
margin:0px;
display:none;
position:absolute;
z-index:10;
}
div.select_box ul {
list-style:none;
@ -44,10 +75,13 @@ div.select_box a:hover,div.select_box ul li:hover {
Le CSS est important , surtout la position, il faut qu'il soit dans
un élément positionné en absolu.
</p>
<h2>in-absolute</h2>
<p style="float : static">
<?php
require_once NOALYSS_INCLUDE.'/lib/select_box.class.php';
$a=new Select_Box("test","click me !");
$a=new Select_Box("test","position in-absolute click me !");
$a->set_position("in-absolute");
$a->add_url("List (link)","?id=5&".Dossier::get());
$a->add_javascript("Hello (Javascript)","alert('hello')");
$a->add_value("Value = 10 (set value)",10);
@ -56,10 +90,15 @@ div.select_box a:hover,div.select_box ul li:hover {
echo $a->input();
?>
?>
</p>
<h2>normal and absolute</h2>
<p>
<?php
$a=new Select_Box("test2","click me !");
$a=new Select_Box("test2","position normal click me !");
$a->set_filter(_("recherche"));
$a->set_position("normal");
$a->add_value("Value = 10 (set value)",10);
$a->add_value("Value = 1 (set value)",1);
$a->add_value("Value = 17 (set value)",15);
@ -74,7 +113,8 @@ div.select_box a:hover,div.select_box ul li:hover {
echo $a->input();
?>
?>
</p>
</div>
</body>

View file

@ -1,211 +0,0 @@
-- improve vw_fiche_attr
alter table fiche add column f_enable char(1);
update fiche set f_enable=ad_value from fiche_detail as fd1 where fd1.f_id=fiche.f_id and ad_id=54;
alter table fiche alter f_enable set not null;
alter table fiche add constraint f_enable_ck check (f_enable in ('0','1'));
comment on column fiche.f_enable is 'value = 1 if card enable , otherwise 0 ';
-- improve performance on this view
drop index if exists fiche_detail_attr_ix;
create index fiche_detail_attr_ix on fiche_detail (ad_id);
drop view vw_fiche_attr cascade;
-- add "fiche.f_enable" in the view
create view vw_fiche_attr as SELECT a.f_id,
a.fd_id,
a.ad_value AS vw_name,
k.ad_value AS vw_first_name,
b.ad_value AS vw_sell,
c.ad_value AS vw_buy,
d.ad_value AS tva_code,
tva_rate.tva_id,
tva_rate.tva_rate,
tva_rate.tva_label,
e.ad_value AS vw_addr,
f.ad_value AS vw_cp,
j.ad_value AS quick_code,
h.ad_value AS vw_description,
i.ad_value AS tva_num,
fiche_def.frd_id,
l.ad_value AS accounting,
f_enable
FROM ( SELECT fiche.f_id,
fiche.fd_id,
fiche.f_enable,
fiche_detail.ad_value
FROM fiche
LEFT JOIN fiche_detail USING (f_id)
WHERE fiche_detail.ad_id = 1) a
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 6) b ON a.f_id = b.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 7) c ON a.f_id = c.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 2) d ON a.f_id = d.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 14) e ON a.f_id = e.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 15) f ON a.f_id = f.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 23) j ON a.f_id = j.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 9) h ON a.f_id = h.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 13) i ON a.f_id = i.f_id
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 32) k ON a.f_id = k.f_id
LEFT JOIN tva_rate ON d.ad_value = tva_rate.tva_id::text
JOIN fiche_def USING (fd_id)
LEFT JOIN ( SELECT fiche_detail.f_id,
fiche_detail.ad_value
FROM fiche_detail
WHERE fiche_detail.ad_id = 5) l ON a.f_id = l.f_id
;
create view v_detail_sale as
WITH m AS (
SELECT sum(quant_sold_1.qs_price) AS htva,
sum(quant_sold_1.qs_vat) AS tot_vat,
sum(quant_sold_1.qs_vat_sided) AS tot_tva_np,
jrn_1.jr_id
FROM quant_sold quant_sold_1
JOIN jrnx jrnx_1 USING (j_id)
JOIN jrn jrn_1 ON jrnx_1.j_grpt = jrn_1.jr_grpt_id
GROUP BY jrn_1.jr_id
)
SELECT jrn.jr_id,
jrn.jr_date,
jrn.jr_date_paid,
jrn.jr_ech,
jrn.jr_tech_per,
jrn.jr_comment,
jrn.jr_pj_number,
jrn.jr_internal,
jrn.jr_def_id,
jrnx.j_poste,
jrnx.j_text,
jrnx.j_qcode,
jrn.jr_rapt,
quant_sold.qs_fiche AS item_card,
a.name AS item_name,
quant_sold.qs_client,
b.vw_name AS tiers_name,
b.quick_code,
tva_rate.tva_label,
tva_rate.tva_comment,
tva_rate.tva_both_side,
quant_sold.qs_vat_sided AS vat_sided,
quant_sold.qs_vat_code AS vat_code,
quant_sold.qs_vat AS vat,
quant_sold.qs_price AS price,
quant_sold.qs_quantite AS quantity,
quant_sold.qs_price / quant_sold.qs_quantite AS price_per_unit,
m.htva,
m.tot_vat,
m.tot_tva_np,
oc.oc_amount,
oc.oc_vat_amount,
( SELECT currency.cr_code_iso
FROM currency
WHERE jrn.currency_id = currency.id) AS cr_code_iso
FROM jrn
JOIN jrnx ON jrn.jr_grpt_id = jrnx.j_grpt
JOIN quant_sold USING (j_id)
JOIN vw_fiche_name a ON quant_sold.qs_fiche = a.f_id
JOIN vw_fiche_attr b ON quant_sold.qs_client = b.f_id
JOIN tva_rate ON quant_sold.qs_vat_code = tva_rate.tva_id
JOIN m ON m.jr_id = jrn.jr_id
LEFT JOIN operation_currency oc ON oc.j_id = jrnx.j_id;
create view v_detail_purchase as
WITH m AS (
SELECT sum(quant_purchase_1.qp_price) AS htva,
sum(quant_purchase_1.qp_vat) AS tot_vat,
sum(quant_purchase_1.qp_vat_sided) AS tot_tva_np,
jrn_1.jr_id
FROM quant_purchase quant_purchase_1
JOIN jrnx jrnx_1 USING (j_id)
JOIN jrn jrn_1 ON jrnx_1.j_grpt = jrn_1.jr_grpt_id
GROUP BY jrn_1.jr_id
)
SELECT jrn.jr_id,
jrn.jr_date,
jrn.jr_date_paid,
jrn.jr_ech,
jrn.jr_tech_per,
jrn.jr_comment,
jrn.jr_pj_number,
jrn.jr_internal,
jrn.jr_def_id,
jrnx.j_poste,
jrnx.j_text,
jrnx.j_qcode,
jrn.jr_rapt,
quant_purchase.qp_fiche AS item_card,
a.name AS item_name,
quant_purchase.qp_supplier,
b.vw_name AS tiers_name,
b.quick_code,
tva_rate.tva_label,
tva_rate.tva_comment,
tva_rate.tva_both_side,
quant_purchase.qp_vat_sided AS vat_sided,
quant_purchase.qp_vat_code AS vat_code,
quant_purchase.qp_vat AS vat,
quant_purchase.qp_price AS price,
quant_purchase.qp_quantite AS quantity,
quant_purchase.qp_price / quant_purchase.qp_quantite AS price_per_unit,
quant_purchase.qp_nd_amount AS non_ded_amount,
quant_purchase.qp_nd_tva AS non_ded_tva,
quant_purchase.qp_nd_tva_recup AS non_ded_tva_recup,
m.htva,
m.tot_vat,
m.tot_tva_np,
oc.oc_amount,
oc.oc_vat_amount,
( SELECT currency.cr_code_iso
FROM currency
WHERE jrn.currency_id = currency.id) AS cr_code_iso
FROM jrn
JOIN jrnx ON jrn.jr_grpt_id = jrnx.j_grpt
JOIN quant_purchase USING (j_id)
JOIN vw_fiche_name a ON quant_purchase.qp_fiche = a.f_id
JOIN vw_fiche_attr b ON quant_purchase.qp_supplier = b.f_id
JOIN tva_rate ON quant_purchase.qp_vat_code = tva_rate.tva_id
JOIN m ON m.jr_id = jrn.jr_id
LEFT JOIN operation_currency oc ON oc.j_id = jrnx.j_id;
COMMENT ON VIEW vw_fiche_attr IS 'Some attribute for all cards';
comment on view v_detail_sale is 'Summary one row by sale ';
comment on view v_detail_purchase is 'Summary one row by purchase';
-- remove
delete from fiche_detail where ad_id=54;
delete from attr_min where ad_id=54;
delete from attr_def where ad_id=54;
delete from jnt_fic_attr where ad_id =54;
-- open COMPANY when PARAM is choosen for profile 1
update profile_menu set pm_default=1,p_order=1 where pm_id=54;

View file

@ -2,7 +2,7 @@
export PGCLUSTER=10/main
DOSSIER_TEST=rel70dossier25
FILE_TEST=dossiertest201107-1806.sql
FILE_TEST=dossiertest210204-1402.sql
dropdb $DOSSIER_TEST
createdb $DOSSIER_TEST

View file

@ -20,6 +20,8 @@ class FicheTest extends TestCase
*/
protected function setUp()
{
include 'global.php';
$this->object=new Fiche($g_connection);
}
/**
@ -33,11 +35,10 @@ class FicheTest extends TestCase
/**
* @covers Fiche::cmp_name
* @todo Implement testCmp_name().
*/
public function testCmp_name()
{
include 'global.php';
global $g_connection;
$fiche=new \Fiche($g_connection,21);
$fiche_2=new \Fiche($g_connection,25);
$this->assertGreaterThan(\Fiche::cmp_name($fiche, $fiche_2),0);
@ -45,11 +46,10 @@ class FicheTest extends TestCase
/**
* @covers Fiche::get_bk_account
* @todo Implement testGet_bk_account().
*/
public function testGet_bk_account()
{
include 'global.php';
include 'global.php';
$this->object=new Fiche($g_connection);
$result=$this->object->get_bk_account();
$this->assertEquals(gettype($result),'array');
@ -83,5 +83,31 @@ class FicheTest extends TestCase
$this->assertEquals ($nb_result,3,"Size array not correct ");
$this->assertEquals($a_result[0][24]["deb_montant"],204.71);
}
/**
* @covers Fiche::count_by_modele()
*/
public function testCount_by_modele()
{
$nb=$this->object->count_by_modele(1,"","");
$this->assertEquals(4,$nb,"number of Sales Card ");
$nb=$this->object->count_by_modele(3,"eau","");
$this->assertEquals(1,$nb,"Purchase card water ");
$nb=$this->object->count_by_modele(3,"EAU","");
$this->assertEquals(1,$nb,"Purchase card water ");
$nb=$this->object->count_by_modele(3,"ZZ","");
$this->assertEquals(0,$nb,"no card found");
$nb=$this->object->count_by_modele(3000,"","");
$this->assertEquals(0,$nb,"no card found");
$nb=$this->object->count_by_modele(3,"","");
$this->assertEquals(7,$nb,"Purchase cards ");
// attempt to inject SQL command, you must get an error
try {
$nb=@$this->object->count_by_modele(3,""," ;delete from jrn;");
$this->assertFalse(true,"Inject SQL command not found");
} catch(Exception $e) {
$this->assertTrue(true,"Inject SQL command found");
}
}
}