diff --git a/doc/developper/Doxyfile b/doc/developper/Doxyfile index 63ef35284..3571e04c5 100644 --- a/doc/developper/Doxyfile +++ b/doc/developper/Doxyfile @@ -673,7 +673,6 @@ EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = a?.php \ b?.php \ ?.php \ - test*.php \ calendar-*.js \ richtext.js \ builder.js \ diff --git a/html/ajax_misc.php b/html/ajax_misc.php index c4bcbe955..70f4f9387 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -46,6 +46,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; require_once NOALYSS_INCLUDE.'/class/user.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; +require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php'; $http=new HttpInput(); mb_internal_encoding("UTF-8"); @@ -86,6 +87,16 @@ else $g_user = new User($cn); $g_user->check(true); } + +// For progress bar, for saving time , we check and answer directly +if ($op == "progressBar") { + $task_id=$http->request("task_id"); + $task=new Progress_Bar($task_id); + $task->answer(); + return; +} + + $html = var_export($_REQUEST, true); set_language(); if ( LOGINPUT) @@ -208,6 +219,8 @@ $path = array( "accounting"=>"ajax_accounting", // Show detail of an ANC operation "anc_detail_op"=>"ajax_anc_detail_operation", + // show history of an analytic account + "history_anc_account"=>"ajax_history_anc_account", // Display the list of filter saved "display_search_filter"=>"ajax_search_filter", // Save search filter @@ -223,7 +236,9 @@ $path = array( // Attribute for category of card 'template_cat_category'=>'ajax_template_cat_category', // From FollowUp , update a comment on a file - 'update_comment_followUp'=>'ajax_follow_up' + 'update_comment_followUp'=>'ajax_follow_up', + // TVA param + "tva_parameter"=>"ajax_tva_parameter" ) ; if (array_key_exists($op, $path)) { @@ -232,6 +247,60 @@ if (array_key_exists($op, $path)) { } switch ($op) { + case "periode_change": + $field=$http->get("field"); + $type=$http->get("type"); + $exercice=$http->get("exercice","number"); + $last=$http->get("last","number"); + + // if last == 1 then show first and last periode of the + // exercice + $periode_start=0; + $periode_end=0; + if ( $last==1) { + $t_periode=new Periode($cn); + list($per_max,$per_min)=$t_periode->get_limit($exercice); + $periode_start=$per_max->p_id; + $periode_end=$per_min->p_id; + } + + $iperiod = new IPeriod($field); + $iperiod->id=$field; + $iperiod->user = $g_user; + $iperiod->cn = $cn; + $iperiod->filter_year = true; + $iperiod->exercice=$exercice; + if ( $type=="from") + { + $iperiod->show_end_date=FALSE; + $iperiod->value=$periode_start; + } elseif ($type=="to"){ + $iperiod->show_start_date=FALSE; + $iperiod->value=$periode_end; + + } else { + throw new Exception(_("Invalide type")); + } + + $iperiod->type = ALL; + echo $iperiod->input(); + + return; + + break; + case "pref_exercice": + $iperiod = new IPeriod("period"); + $iperiod->id="setting_period"; + $iperiod->user = $g_user; + $iperiod->cn = $cn; + $iperiod->filter_year = true; + $iperiod->exercice=$http->get("exercice"); + + $iperiod->type = ALL; + echo $iperiod->input(); + + return; + break; case "remove_anc": if ($g_user->check_module('ANCODS') == 0) exit(); @@ -350,7 +419,29 @@ EOF; break; case 'dsp_tva': $cn = Dossier::connect(); - $Res = $cn->exec_sql("select * from tva_rate order by tva_rate desc"); + // Filter the VAT + $filter=$http->get("filter","string","none"); + if ( $filter == 'sale') { + $Res = $cn->exec_sql("select * + from v_tva_rate + where + tva_sale <> '#' + order by tva_rate desc"); + + } elseif ($filter == "purchase") { + + $Res = $cn->exec_sql("select * + from + v_tva_rate + where + tva_purchase <> '#' + order by tva_rate desc"); + }else { + + $Res = $cn->exec_sql("select * from v_tva_rate + where + order by tva_rate desc"); + } $Max = Database::num_row($Res); $r = ""; $r.=HtmlInput::title_box(_('Choisissez la TVA'),'tva_select',"close","","y"); diff --git a/html/do.php b/html/do.php index 2125c714b..67145029f 100644 --- a/html/do.php +++ b/html/do.php @@ -196,7 +196,7 @@ if (DBVERSION > dossier::get_version($cn)) { echo '

' . _("Votre base de données n'est pas à jour") . ' '; $a = _("cliquez ici pour appliquer le patch"); - $base = dirname($_SERVER['SCRIPT_NAME']); + $base = dirname($_SERVER['REQUEST_URI']); if ($base == '/') { $base = ''; } $base .= '/admin-noalyss.php'; echo '' . $a . '

'; diff --git a/html/image/bg-submit4.gif b/html/image/bg-submit4.gif deleted file mode 100644 index 9774a3ff5..000000000 Binary files a/html/image/bg-submit4.gif and /dev/null differ diff --git a/html/image/bg-submit4.png b/html/image/bg-submit4.png deleted file mode 100644 index 34f6c5afb..000000000 Binary files a/html/image/bg-submit4.png and /dev/null differ diff --git a/html/image/bg-submit5.png b/html/image/bg-submit5.png deleted file mode 100644 index fc0bb8cbd..000000000 Binary files a/html/image/bg-submit5.png and /dev/null differ diff --git a/html/image/bgcolor.gif b/html/image/bgcolor.gif deleted file mode 100644 index 55fcf1ba6..000000000 Binary files a/html/image/bgcolor.gif and /dev/null differ diff --git a/html/image/blackdot.gif b/html/image/blackdot.gif deleted file mode 100644 index f79319f81..000000000 Binary files a/html/image/blackdot.gif and /dev/null differ diff --git a/html/image/bold.gif b/html/image/bold.gif deleted file mode 100644 index bdb3259c3..000000000 Binary files a/html/image/bold.gif and /dev/null differ diff --git a/html/image/button-edit.png b/html/image/button-edit.png deleted file mode 100644 index cf57c75cf..000000000 Binary files a/html/image/button-edit.png and /dev/null differ diff --git a/html/image/centre.gif b/html/image/centre.gif deleted file mode 100644 index f98c86a78..000000000 Binary files a/html/image/centre.gif and /dev/null differ diff --git a/html/image/compute.png b/html/image/compute.png deleted file mode 100644 index 1468e7f02..000000000 Binary files a/html/image/compute.png and /dev/null differ diff --git a/html/image/copy.gif b/html/image/copy.gif deleted file mode 100644 index faebb18c4..000000000 Binary files a/html/image/copy.gif and /dev/null differ diff --git a/html/image/cut.gif b/html/image/cut.gif deleted file mode 100644 index ca60a1aa3..000000000 Binary files a/html/image/cut.gif and /dev/null differ diff --git a/html/image/delete.gif b/html/image/delete.gif deleted file mode 100644 index 327af2a5b..000000000 Binary files a/html/image/delete.gif and /dev/null differ diff --git a/html/image/edit.png b/html/image/edit.png deleted file mode 100644 index 5da832338..000000000 Binary files a/html/image/edit.png and /dev/null differ diff --git a/html/image/email.gif b/html/image/email.gif deleted file mode 100644 index 7e376ea5d..000000000 Binary files a/html/image/email.gif and /dev/null differ diff --git a/html/image/empty.gif b/html/image/empty.gif deleted file mode 100644 index b3dadb0a5..000000000 Binary files a/html/image/empty.gif and /dev/null differ diff --git a/html/image/home.png b/html/image/home.png deleted file mode 100644 index 66f4c3d02..000000000 Binary files a/html/image/home.png and /dev/null differ diff --git a/html/image/hr.gif b/html/image/hr.gif deleted file mode 100644 index c98da9d00..000000000 Binary files a/html/image/hr.gif and /dev/null differ diff --git a/html/image/hyperlink.gif b/html/image/hyperlink.gif deleted file mode 100644 index 1fb1a4a5c..000000000 Binary files a/html/image/hyperlink.gif and /dev/null differ diff --git a/html/image/icon-off.png b/html/image/icon-off.png deleted file mode 100644 index c8d7bd452..000000000 Binary files a/html/image/icon-off.png and /dev/null differ diff --git a/html/image/icon-on.png b/html/image/icon-on.png deleted file mode 100644 index df9c4c9fe..000000000 Binary files a/html/image/icon-on.png and /dev/null differ diff --git a/html/image/indent.gif b/html/image/indent.gif deleted file mode 100644 index 2abb6b281..000000000 Binary files a/html/image/indent.gif and /dev/null differ diff --git a/html/image/italic.gif b/html/image/italic.gif deleted file mode 100644 index 8b1485b43..000000000 Binary files a/html/image/italic.gif and /dev/null differ diff --git a/html/image/justifyfull.gif b/html/image/justifyfull.gif deleted file mode 100644 index b12528b9f..000000000 Binary files a/html/image/justifyfull.gif and /dev/null differ diff --git a/html/image/left_just.gif b/html/image/left_just.gif deleted file mode 100644 index 505c5d961..000000000 Binary files a/html/image/left_just.gif and /dev/null differ diff --git a/html/image/list.gif b/html/image/list.gif deleted file mode 100644 index b3018d9f2..000000000 Binary files a/html/image/list.gif and /dev/null differ diff --git a/html/image/load.gif b/html/image/load.gif deleted file mode 100644 index 16278c05e..000000000 Binary files a/html/image/load.gif and /dev/null differ diff --git a/html/image/logo-noalyss-7000-3.svg b/html/image/logo-noalyss-7000-3.svg deleted file mode 100644 index 3b3a956fd..000000000 --- a/html/image/logo-noalyss-7000-3.svg +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Noalyss comptabilite - - diff --git a/html/image/logo6720.png b/html/image/logo6720.png deleted file mode 100644 index ca014e1f9..000000000 Binary files a/html/image/logo6720.png and /dev/null differ diff --git a/html/image/logo7.png b/html/image/logo7.png deleted file mode 100644 index ca014e1f9..000000000 Binary files a/html/image/logo7.png and /dev/null differ diff --git a/html/image/logo7000.png b/html/image/logo7000.png new file mode 100644 index 000000000..336c984b3 Binary files /dev/null and b/html/image/logo7000.png differ diff --git a/html/image/logout.png b/html/image/logout.png deleted file mode 100644 index 598cf76be..000000000 Binary files a/html/image/logout.png and /dev/null differ diff --git a/html/image/magnifier13.png b/html/image/magnifier13.png deleted file mode 100644 index 9ea232dac..000000000 Binary files a/html/image/magnifier13.png and /dev/null differ diff --git a/html/image/numbered_list.gif b/html/image/numbered_list.gif deleted file mode 100644 index d1a4dbcad..000000000 Binary files a/html/image/numbered_list.gif and /dev/null differ diff --git a/html/image/orange_flower.gif b/html/image/orange_flower.gif deleted file mode 100644 index 55c2c0639..000000000 Binary files a/html/image/orange_flower.gif and /dev/null differ diff --git a/html/image/outdent.gif b/html/image/outdent.gif deleted file mode 100644 index fa3c1b6aa..000000000 Binary files a/html/image/outdent.gif and /dev/null differ diff --git a/html/image/param.png b/html/image/param.png deleted file mode 100644 index 6a2f729e6..000000000 Binary files a/html/image/param.png and /dev/null differ diff --git a/html/image/paste.gif b/html/image/paste.gif deleted file mode 100644 index 9bcc76ac2..000000000 Binary files a/html/image/paste.gif and /dev/null differ diff --git a/html/image/popout.png b/html/image/popout.png deleted file mode 100644 index 4d7c6b8b0..000000000 Binary files a/html/image/popout.png and /dev/null differ diff --git a/html/image/preference.png b/html/image/preference.png deleted file mode 100644 index 930d4c5e8..000000000 Binary files a/html/image/preference.png and /dev/null differ diff --git a/html/image/print.png b/html/image/print.png deleted file mode 100644 index 12d2277be..000000000 Binary files a/html/image/print.png and /dev/null differ diff --git a/html/image/redo.gif b/html/image/redo.gif deleted file mode 100644 index b51d6b842..000000000 Binary files a/html/image/redo.gif and /dev/null differ diff --git a/html/image/right_just.gif b/html/image/right_just.gif deleted file mode 100644 index a3204d97e..000000000 Binary files a/html/image/right_just.gif and /dev/null differ diff --git a/html/image/search.png b/html/image/search.png deleted file mode 100644 index a0f81612c..000000000 Binary files a/html/image/search.png and /dev/null differ diff --git a/html/image/smiley.gif b/html/image/smiley.gif deleted file mode 100644 index 72dcb4c7f..000000000 Binary files a/html/image/smiley.gif and /dev/null differ diff --git a/html/image/spellcheck.gif b/html/image/spellcheck.gif deleted file mode 100644 index e6c8d827e..000000000 Binary files a/html/image/spellcheck.gif and /dev/null differ diff --git a/html/image/spirale2.gif b/html/image/spirale2.gif deleted file mode 100644 index 01bb6d66d..000000000 Binary files a/html/image/spirale2.gif and /dev/null differ diff --git a/html/image/textcolor.gif b/html/image/textcolor.gif deleted file mode 100644 index 413e04178..000000000 Binary files a/html/image/textcolor.gif and /dev/null differ diff --git a/html/image/trash-24.gif b/html/image/trash-24.gif new file mode 100644 index 000000000..b586d42d3 Binary files /dev/null and b/html/image/trash-24.gif differ diff --git a/html/image/undefined.png b/html/image/undefined.png deleted file mode 100644 index eea4fc777..000000000 Binary files a/html/image/undefined.png and /dev/null differ diff --git a/html/image/underline.gif b/html/image/underline.gif deleted file mode 100644 index db8fb4ffd..000000000 Binary files a/html/image/underline.gif and /dev/null differ diff --git a/html/image/undo.gif b/html/image/undo.gif deleted file mode 100644 index 555d0db96..000000000 Binary files a/html/image/undo.gif and /dev/null differ diff --git a/html/image/x-office-calendar.png b/html/image/x-office-calendar.png deleted file mode 100644 index ca55f9077..000000000 Binary files a/html/image/x-office-calendar.png and /dev/null differ diff --git a/html/index.css b/html/index.css index b368f2da8..d7101d20c 100644 --- a/html/index.css +++ b/html/index.css @@ -59,32 +59,39 @@ border-width: 0px; background-image: url("image/bg-submit3.gif"); background-repeat: repeat-x repeat-y; } +#logo_id { + width:19%; +} @media only screen and (max-width : 900px) { #alternate_browser { display : none; } #logo_id { - height:160px; + position:absolute; + z-index:-1; + height:60%; + width:auto; + left:0px; + } .input_text { width:8em; } } -@media only screen and (min-width : 1201px) { +@media only screen and (min-width : 901px) { #alternate_browser { position:absolute; bottom: 0px; left:0px; - z-index: -1 + z-index: -1; } #logo_id { - width:608px; z-index:-1; position:absolute; - top:230px; - left:688px; - height: 125px; + width:19%; + left:27%; + top:24.5%; } #login_frm { position:absolute; @@ -99,5 +106,6 @@ background-repeat: repeat-x repeat-y; position:absolute; margin-top:397px; left:539px; + background-color: white; } } diff --git a/html/index.php b/html/index.php index d4d23b35e..716ffdb61 100644 --- a/html/index.php +++ b/html/index.php @@ -183,7 +183,7 @@ version NOALYSS_VERSION - '.$my_domain.'
-NOALYSS +NOALYSS


diff --git a/html/install.php b/html/install.php index 20a9000a4..db64b0188 100644 --- a/html/install.php +++ b/html/install.php @@ -67,12 +67,18 @@ session_start(); .warning,.error { color:red; } + img:hover { + cursor: inherit; + background-color: inherit; + color: inherit; +}

- NOALYSS + NOALYSS

+

NOALYSS : comptabilité - accountancy

@@ -277,7 +284,7 @@ require_once NOALYSS_INCLUDE.'/lib/database.class.php'; // we shouldn't use it // if ( defined ("MULTI") && MULTI==1) { create_htaccess();} -echo '

'._('Configuration').'

'; +echo '

'._('Configuration').'

'; ?>

Info

@@ -422,11 +429,11 @@ $sql="select setting from pg_settings where name='server_version'"; $version=$cn->get_value($sql); echo _("Version base de données :"),$version; - -if ( $version[0] < 9 ) +$majeur=explode(".",$version); +if ( $majeur[0] < 9 ) { ?> -

diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index 9df198f8c..3bbe15048 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -681,6 +681,38 @@ function view_history_account(p_value, dossier,p_exercice) } ); +} +/** + * @brief View the history of an account + * @param {type} p_value + * @param {type} dossier + * @returns {undefined} + */ +function view_history_anc_account(p_value, dossier,p_exercice) +{ + layer++; + var idbox = 'det' + layer; + var popup = {'id': idbox, 'cssclass': 'inner_box', 'html': loading(), 'drag': false}; + + var querystring={'gDossier':dossier,'op':'history_anc_account','po_id':p_value,'div':idbox,'l':layer,'act':'history','exercice':p_exercice}; + waiting_box(); + + var action = new Ajax.Request( + "ajax_misc.php", + { + method: 'get', + parameters: querystring, + onFailure: error_box, + onSuccess: function (req, xml) + { + remove_waiting_box(); + add_div(popup); + $(idbox).innerHTML=req.responseText; + $(idbox).style.top = calcy(140 + (layer * 3)) + "px"; + } + } + ); + } /** * @brief Change the view of account history diff --git a/html/js/managetable.js b/html/js/managetable.js index af876cf8f..9be363ace 100644 --- a/html/js/managetable.js +++ b/html/js/managetable.js @@ -303,7 +303,7 @@ var ManageTable = function (p_table_name) var obj = {id: control, "cssclass": "inner_box", "html": loading()}; add_div(obj); var pos = calcy(250); - $(obj.id).setStyle({position: "absolute", top: '15%', width: "auto", "margin-left": "20%"}); + $(obj.id).setStyle({position: "fixed", top: '15%', width: "auto", "margin-left": "20%"}); $(obj.id).update(x['html']); } catch (e) { smoke.alert("ERREUR " + e.message); diff --git a/html/js/scripts.js b/html/js/scripts.js index 633427941..46ddea91e 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -496,6 +496,8 @@ function popup_select_tva(obj) queryString += '&code=' + obj.jcode; if (obj.compute) queryString += '&compute=' + obj.compute; + if (obj.filter) + queryString += '&filter=' + obj.filter; var action = new Ajax.Request( "ajax_misc.php", @@ -2896,7 +2898,7 @@ function create_anchor_up() function init_scroll() { var up=new Element('div',{"class":"inner_box", - "style":"padding:5px;left:auto;width:auto;height: auto;display:none;position:fixed;bottom:25px;right:50px;text-align:center", + "style":"padding:5px;left:auto;width:auto;height: auto;display:none;position:fixed;bottom:95px;right:50px;text-align:center;font-size:20px", id:"go_up" }); up.innerHTML=' '; @@ -2904,7 +2906,7 @@ function init_scroll() window.onscroll=function () { if ( document.viewport.getScrollOffsets().top> 0) { if ($('go_up').visible() == false) { - $('go_up').setOpacity(0.80); + $('go_up').setOpacity(0.45); $('go_up').show(); $('go_up').style.zIndex=99; } @@ -3009,14 +3011,14 @@ function pin (object_id) { if ( aDraggableElement[object_id]) { aDraggableElement[object_id].destroy(); aDraggableElement[object_id]=undefined; - $('pin_'+object_id).innerHTML=""; + $('pin_'+object_id).innerHTML=""; } else { aDraggableElement[object_id]=new Draggable(object_id, {starteffect: function () { new Effect.Highlight(object_id, {scroll: window, queue: 'end'}); }} ); - $('pin_'+object_id).innerHTML=""; + $('pin_'+object_id).innerHTML=""; } } /** @@ -3394,3 +3396,115 @@ Periode.filter_exercice=function (p_table_id) { } }; + +// keep track of progress bar +var progressBar = []; +// idx of progress bar +var progressIdx = 0; + +/** + * Start the progress bar + * @param {string} p_taskid id to monitor + * @param {int} p_dossier + */ +function progress_bar_start(p_taskid,p_message) +{ + try { + progressIdx++; + // block the window + var message="Un instant svp"; + if ( p_message) { + message=p_message; + } + add_div({id:"blocking"+progressIdx,cssclass:"smoke-base smoke-visible "}); + + add_div({id:"message"+progressIdx,cssclass:"inner_box",style:"z-index:1000;position:fixed;top:30%;width:40%;left:30%"}); + $("message"+progressIdx).update(message); + // Create a div + add_div({id: "progressDiv" + progressIdx, cssclass: "progressbar", html: '0'}); + // Check status every sec. + progressBar[progressIdx] = setInterval(progress_bar_check.bind(null, progressIdx, p_taskid), 1000); + } catch (e) { + console.error(e.message); + } +} + +/** + * Check every second the status + * @param {integer} p_idx idx of progressbar + * @param {string} p_taskid id to monitor + */ +function progress_bar_check(p_idx, p_taskid) +{ + try { + + new Ajax.Request("ajax_misc.php", { + parameters: {gDossier: 0, task_id: p_taskid,op:"progressBar"}, + method:"get", + onSuccess: function (req) { + try + { + var answer=req.responseText.evalJSON(); + var progress_div=$("progressDiv"+progressIdx); + var a_child=progress_div.childNodes; + var i=0; + for ( i=0;i< a_child.length;i++) { + if ( a_child[i].id="progressValue") { + var progressValue = a_child[i]; + } + } + var progress = parseFloat(progressValue.innerHTML); + if ( answer.value <= progress ) { + return; + } + + progressValue.innerHTML = answer.value; + progressValue.setStyle("width:" + answer.value + "%"); + if (answer.value== 100) { + clearInterval(progressBar[p_idx]); + progressValue.innerHTML="Success"; + Effect.BlindUp("progressDiv"+p_idx,{duration:1.0,scaleContent:false}) + $("message"+p_idx).remove(); + $("blocking"+p_idx).remove(); + setTimeout(function() { $("progressDiv"+progressIdx).remove } , 1100); + } + } catch (e) { + clearInterval(progressBar[p_idx]); + document.getElementById("progressValue").innerHTML=req.responseText; + console.error(e.message); + } + } + }); + } catch (e) { + clearInterval(progressBar[p_idx]); + console.error(e.message); + } +} + +/** + * In the user's setting box, update the period list with the choosen exercice + * @param {int} p_dossier + */ +function updatePeriodePreference(p_dossier) +{ + waiting_box(); + var exercice=$('exercice_setting').value; + new Ajax.Updater('setting_period',"ajax_misc.php",{method:"get",parameters:{ "op":"pref_exercice","gDossier":p_dossier,"exercice":exercice}}); + remove_waiting_box(); +} +/** + * Update the from and to periode list when changing the exercice + * @param {int} p_dossier + * @param {string} p_exercice id of the exercice + * @param {type} p_periode_from id of the starting periode + * @param {type} p_periode_to id of the ending periode + * @param {type} p_last possible value = 1 to show last periode or 0 the first + */ +function updatePeriode(p_dossier,p_exercice,p_periode_from,p_periode_to,p_last) +{ + waiting_box(); + var exercice=$(p_exercice).value; + new Ajax.Updater(p_periode_from,"ajax_misc.php",{method:"get",parameters:{op:"periode_change","gDossier":p_dossier,"exercice":exercice,field:p_periode_from,"type":"from","last":p_last}}); + new Ajax.Updater(p_periode_to,"ajax_misc.php",{method:"get",parameters:{op:"periode_change","gDossier":p_dossier,"exercice":exercice,field:p_periode_to,"type":"to","last":p_last}}); + remove_waiting_box(); +} diff --git a/html/js/smoke.js b/html/js/smoke.js index aab68fa69..bfde05060 100644 --- a/html/js/smoke.js +++ b/html/js/smoke.js @@ -1,519 +1,514 @@ /* - SMOKE.JS - 0.1.3 - (c) 2011-2013 Jonathan Youngblood - demos / documentation: http://smoke-js.com/ -*/ + SMOKE.JS - 0.1.3 + (c) 2011-2013 Jonathan Youngblood + demos / documentation: http://smoke-js.com/ + */ -;(function(window, document) { +; +(function (window, document) { - /*jslint browser: true, onevar: true, undef: true, nomen: false, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */ - - var smoke = { - smoketimeout: [], - init: false, - zindex: 1000, - i: 0, - - bodyload: function(id) { - var ff = document.createElement('div'); - ff.setAttribute('id','smoke-out-'+id); - ff.className = 'smoke-base'; - ff.style.zIndex = smoke.zindex; - smoke.zindex++; - document.body.appendChild(ff); - }, - - newdialog: function() { - var newid = new Date().getTime(); - newid = Math.random(1,99) + newid; - - if (!smoke.init) { - smoke.listen(window,"load", function() { - smoke.bodyload(newid); - }); - }else{ - smoke.bodyload(newid); - } - - return newid; - }, - - forceload: function() {}, - - build: function (e, f) { - smoke.i++; - - f.stack = smoke.i; - - e = e.replace(/\n/g,'
'); - e = e.replace(/\r/g,'
'); - - var prompt = '', - ok = 'OK', - cancel = 'Cancel', - classname = '', - buttons = '', - box; - - if (f.type === 'prompt') { - prompt = - '
'+ - ''+ - '
'; - } - - if (f.params.ok) { - ok = f.params.ok; - } - - if (f.params.cancel) { - cancel = f.params.cancel; - } - - if (f.params.classname) { - classname = f.params.classname; - } - - if (f.type !== 'signal') { - buttons = '
'; - if (f.type === 'alert') { - buttons += - ''; - } - else if (f.type === 'quiz') { - - if (f.params.button_1) { - buttons += - ''; - } - - if (f.params.button_2) { - buttons += - ''; - } - - if (f.params.button_3) { - buttons += - ''; - } - if (f.params.button_cancel) { - buttons += - ''; - } - - } - - else if (f.type === 'prompt' || f.type === 'confirm') { - if (f.params.reverseButtons) { - buttons += - '' + - ''; - } else { - buttons += - ''+ - ''; - } - } - buttons += '
'; - } - - - box = - '
'+ - '
'+ - '
'+ - e+ - prompt+ - buttons+ - '
'+ - '
'; - - if (!smoke.init) { - smoke.listen(window,"load", function() { - smoke.finishbuild(e,f,box); - }); - } else{ - smoke.finishbuild(e,f,box); - } - - }, - - finishbuild: function(e, f, box) { - - var ff = document.getElementById('smoke-out-'+f.newid); - - ff.className = 'smoke-base smoke-visible smoke-' + f.type; - ff.innerHTML = box; - - while (ff.innerHTML === "") { - ff.innerHTML = box; - } - - if (smoke.smoketimeout[f.newid]) { - clearTimeout(smoke.smoketimeout[f.newid]); - } - - smoke.listen( - document.getElementById('smoke-bg-'+f.newid), - "click", - function () { - smoke.destroy(f.type, f.newid); - if (f.type === 'prompt' || f.type === 'confirm' || f.type === 'quiz') { - f.callback(false); - } else if (f.type === 'alert' && typeof f.callback !== 'undefined') { - f.callback(); - } - } - ); - - - switch (f.type) { - case 'alert': - smoke.finishbuildAlert(e, f, box); - break; - case 'confirm': - smoke.finishbuildConfirm(e, f, box); - break; - case 'quiz': - smoke.finishbuildQuiz(e, f, box); - break; - case 'prompt': - smoke.finishbuildPrompt(e, f, box); - break; - case 'signal': - smoke.finishbuildSignal(e, f, box); - break; - default: - throw "Unknown type: " + f.type; - } - }, - - finishbuildAlert: function (e, f, box) { - smoke.listen( - document.getElementById('alert-ok-'+f.newid), - "click", - function () { - smoke.destroy(f.type, f.newid); - if (typeof f.callback !== 'undefined') { - f.callback(); - } - } - ); - - document.onkeyup = function (e) { - if (!e) { - e = window.event; - } - if (e.keyCode === 13 || e.keyCode === 32 || e.keyCode === 27) { - smoke.destroy(f.type, f.newid); - if (typeof f.callback !== 'undefined') { - f.callback(); - } - } - }; - }, - - finishbuildConfirm: function (e, f, box) { - smoke.listen( - document.getElementById('confirm-cancel-' + f.newid), - "click", - function () - { - smoke.destroy(f.type, f.newid); - f.callback(false); - } - ); - - smoke.listen( - document.getElementById('confirm-ok-' + f.newid), - "click", - function () - { - smoke.destroy(f.type, f.newid); - f.callback(true); - } - ); - - document.onkeyup = function (e) { - if (!e) { - e = window.event; - } - /*if (e.keyCode === 13 || e.keyCode === 32) { - smoke.destroy(f.type, f.newid); - f.callback(true); - } else*/ - if (e.keyCode === 27) { - smoke.destroy(f.type, f.newid); - f.callback(false); - } - }; - }, - - finishbuildQuiz: function (e, f, box) { - var a, b, c; - - smoke.listen( - document.getElementById('quiz-cancel-' + f.newid), - "click", - function () - { - smoke.destroy(f.type, f.newid); - f.callback(false); - } - ); - - - if (a = document.getElementById('quiz-ok1-'+f.newid)) - smoke.listen( - a, - "click", - function () { - smoke.destroy(f.type, f.newid); - f.callback(a.innerHTML); - } - ); - - - if (b = document.getElementById('quiz-ok2-'+f.newid)) - smoke.listen( - b, - "click", - function () { - smoke.destroy(f.type, f.newid); - f.callback(b.innerHTML); - } - ); - - - if (c = document.getElementById('quiz-ok3-'+f.newid)) - smoke.listen( - c, - "click", - function () { - smoke.destroy(f.type, f.newid); - f.callback(c.innerHTML); - } - ); - - document.onkeyup = function (e) { - if (!e) { - e = window.event; - } - if (e.keyCode === 27) { - smoke.destroy(f.type, f.newid); - f.callback(false); - } - }; - - }, - - finishbuildPrompt: function (e, f, box) { - var pi = document.getElementById('dialog-input-'+f.newid); - - setTimeout(function () { - pi.focus(); - pi.select(); - }, 100); - - smoke.listen( - document.getElementById('prompt-cancel-'+f.newid), - "click", - function () { - smoke.destroy(f.type, f.newid); - f.callback(false); - } - ); - - smoke.listen( - document.getElementById('prompt-ok-'+f.newid), - "click", - function () { - smoke.destroy(f.type, f.newid); - f.callback(pi.value); - } - ); - - document.onkeyup = function (e) { - if (!e) { - e = window.event; - } - - if (e.keyCode === 13) { - smoke.destroy(f.type, f.newid); - f.callback(pi.value); - } else if (e.keyCode === 27) { - smoke.destroy(f.type, f.newid); - f.callback(false); - } - }; - }, - - finishbuildSignal: function (e, f, box) { - - - document.onkeyup = function (e) { - if (!e) { - e = window.event; - } - if (e.keyCode === 27) { - smoke.destroy(f.type, f.newid); - if (typeof f.callback !== 'undefined') { - f.callback(); - } - } - }; - - smoke.smoketimeout[f.newid] = setTimeout(function () { - smoke.destroy(f.type, f.newid); - if (typeof f.callback !== 'undefined') { - f.callback(); - } - }, f.timeout); - }, - - - destroy: function (type,id) { - - var box = document.getElementById('smoke-out-'+id); - - if (type !== 'quiz') { - var okButton = document.getElementById(type+'-ok-'+id); - } - - var cancelButton = document.getElementById(type+'-cancel-'+id); - box.className = 'smoke-base'; - - if (okButton) { - smoke.stoplistening(okButton, "click", function() {}); - document.onkeyup = null; - } - - if (type === 'quiz') { - var quiz_buttons = document.getElementsByClassName("quiz-button"); - for (var i = 0; i < quiz_buttons.length; i++) { - smoke.stoplistening(quiz_buttons[i], "click", function() {}); - document.onkeyup = null; - } - } - - if (cancelButton) { - smoke.stoplistening(cancelButton, "click", function() {}); - } - - smoke.i = 0; - document.body.removeChild(box); - }, - - alert: function (e, f, g) { - if (typeof g !== 'object') { - g = false; - } - - var id = smoke.newdialog(); - - smoke.build(e, { - type: 'alert', - callback: f, - params: g, - newid: id - }); - }, - - signal: function (e, f, g) { - if (typeof g !== 'object') { - g = false; - } + /*jslint browser: true, onevar: true, undef: true, nomen: false, eqeqeq: true, bitwise: true, regexp: true, newcap: true, immed: true */ - var duration = 5000; - if (g.duration !== 'undefined'){ - duration = g.duration; - } - - var id = smoke.newdialog(); - smoke.build(e, { - type: 'signal', - callback: f, - timeout: duration, - params: g, - newid: id - }); - }, - - confirm: function (e, f, g) { - if (typeof g !== 'object') { - g = false; - } - - var id = smoke.newdialog(); - smoke.build(e, { - type: 'confirm', - callback: f, - params: g, - newid: id - }); - }, - - quiz: function (e, f, g) { - if (typeof g !== 'object') { - g = false; - } - - var id = smoke.newdialog(); - smoke.build(e, { - type: 'quiz', - callback: f, - params: g, - newid: id - }); - }, - - prompt: function (e, f, g) { - if (typeof g !== 'object') { - g = false; - } - - var id = smoke.newdialog(); - return smoke.build(e,{type:'prompt',callback:f,params:g,newid:id}); - }, - - listen: function (e, f, g) { - if (e.addEventListener) { - return e.addEventListener(f, g, false); - } - - if (e.attachEvent) { - return e.attachEvent('on'+f, g); - } - - return false; - }, - - stoplistening: function (e, f, g) { - if (e.removeEventListener) { - return e.removeEventListener(f, g, false); - } - - if (e.detachEvent) { - return e.detachEvent('on'+f, g); - } - - return false; - } - }; - - - smoke.init = true; + var smoke = { + smoketimeout: [], + init: false, + zindex: 1000, + i: 0, - if (typeof module != 'undefined' && module.exports) { - module.exports = smoke; - } - else if (typeof define === 'function' && define.amd) { - define('smoke', [], function() { - return smoke; - }); - } - else { - this.smoke = smoke; - } + bodyload: function (id) { + var ff = document.createElement('div'); + ff.setAttribute('id', 'smoke-out-' + id); + ff.className = 'smoke-base'; + ff.style.zIndex = smoke.zindex; + smoke.zindex++; + document.body.appendChild(ff); + }, + + newdialog: function () { + var newid = new Date().getTime(); + newid = Math.random(1, 99) + newid; + + if (!smoke.init) { + smoke.listen(window, "load", function () { + smoke.bodyload(newid); + }); + } else { + smoke.bodyload(newid); + } + + return newid; + }, + + forceload: function () {}, + + build: function (e, f) { + smoke.i++; + + f.stack = smoke.i; + + e = e.replace(/\n/g, '
'); + e = e.replace(/\r/g, '
'); + + var prompt = '', + ok = 'OK', + cancel = 'Cancel', + classname = '', + buttons = '', + box; + + if (f.type === 'prompt') { + prompt = + '
' + + '' + + '
'; + } + + if (f.params.ok) { + ok = f.params.ok; + } + + if (f.params.cancel) { + cancel = f.params.cancel; + } + + if (f.params.classname) { + classname = f.params.classname; + } + + if (f.type !== 'signal') { + buttons = '
'; + if (f.type === 'alert') { + buttons += + ''; + } else if (f.type === 'quiz') { + + if (f.params.button_1) { + buttons += + ''; + } + + if (f.params.button_2) { + buttons += + ''; + } + + if (f.params.button_3) { + buttons += + ''; + } + if (f.params.button_cancel) { + buttons += + ''; + } + + } else if (f.type === 'prompt' || f.type === 'confirm') { + if (f.params.reverseButtons) { + buttons += + '' + + ''; + } else { + buttons += + '' + + ''; + } + } + buttons += '
'; + } + + + box = + '
' + + '
' + + '
' + + e + + prompt + + buttons + + '
' + + '
'; + + if (!smoke.init) { + smoke.listen(window, "load", function () { + smoke.finishbuild(e, f, box); + }); + } else { + smoke.finishbuild(e, f, box); + } + + }, + + finishbuild: function (e, f, box) { + + var ff = document.getElementById('smoke-out-' + f.newid); + + ff.className = 'smoke-base smoke-visible smoke-' + f.type; + ff.innerHTML = box; + + while (ff.innerHTML === "") { + ff.innerHTML = box; + } + + if (smoke.smoketimeout[f.newid]) { + clearTimeout(smoke.smoketimeout[f.newid]); + } + + smoke.listen( + document.getElementById('smoke-bg-' + f.newid), + "click", + function () { + smoke.destroy(f.type, f.newid); + if (f.type === 'prompt' || f.type === 'confirm' || f.type === 'quiz') { + f.callback(false); + } else if (f.type === 'alert' && typeof f.callback !== 'undefined') { + f.callback(); + } + } + ); + + + switch (f.type) { + case 'alert': + smoke.finishbuildAlert(e, f, box); + break; + case 'confirm': + smoke.finishbuildConfirm(e, f, box); + break; + case 'quiz': + smoke.finishbuildQuiz(e, f, box); + break; + case 'prompt': + smoke.finishbuildPrompt(e, f, box); + break; + case 'signal': + smoke.finishbuildSignal(e, f, box); + break; + default: + throw "Unknown type: " + f.type; + } + }, + + finishbuildAlert: function (e, f, box) { + smoke.listen( + document.getElementById('alert-ok-' + f.newid), + "click", + function () { + smoke.destroy(f.type, f.newid); + if (typeof f.callback !== 'undefined') { + f.callback(); + } + } + ); + + document.onkeyup = function (e) { + if (!e) { + e = window.event; + } + if (e.keyCode === 13 || e.keyCode === 32 || e.keyCode === 27) { + smoke.destroy(f.type, f.newid); + if (typeof f.callback !== 'undefined') { + f.callback(); + } + } + }; + }, + + finishbuildConfirm: function (e, f, box) { + smoke.listen( + document.getElementById('confirm-cancel-' + f.newid), + "click", + function () + { + smoke.destroy(f.type, f.newid); + f.callback(false); + } + ); + + smoke.listen( + document.getElementById('confirm-ok-' + f.newid), + "click", + function () + { + smoke.destroy(f.type, f.newid); + f.callback(true); + } + ); + + document.onkeyup = function (e) { + if (!e) { + e = window.event; + } + /*if (e.keyCode === 13 || e.keyCode === 32) { + smoke.destroy(f.type, f.newid); + f.callback(true); + } else*/ + if (e.keyCode === 27) { + smoke.destroy(f.type, f.newid); + f.callback(false); + } + }; + }, + + finishbuildQuiz: function (e, f, box) { + var a, b, c; + + smoke.listen( + document.getElementById('quiz-cancel-' + f.newid), + "click", + function () + { + smoke.destroy(f.type, f.newid); + f.callback(false); + } + ); + + + if (a = document.getElementById('quiz-ok1-' + f.newid)) + smoke.listen( + a, + "click", + function () { + smoke.destroy(f.type, f.newid); + f.callback(a.innerHTML); + } + ); + + + if (b = document.getElementById('quiz-ok2-' + f.newid)) + smoke.listen( + b, + "click", + function () { + smoke.destroy(f.type, f.newid); + f.callback(b.innerHTML); + } + ); + + + if (c = document.getElementById('quiz-ok3-' + f.newid)) + smoke.listen( + c, + "click", + function () { + smoke.destroy(f.type, f.newid); + f.callback(c.innerHTML); + } + ); + + document.onkeyup = function (e) { + if (!e) { + e = window.event; + } + if (e.keyCode === 27) { + smoke.destroy(f.type, f.newid); + f.callback(false); + } + }; + + }, + + finishbuildPrompt: function (e, f, box) { + var pi = document.getElementById('dialog-input-' + f.newid); + + setTimeout(function () { + pi.focus(); + pi.select(); + }, 100); + + smoke.listen( + document.getElementById('prompt-cancel-' + f.newid), + "click", + function () { + smoke.destroy(f.type, f.newid); + f.callback(false); + } + ); + + smoke.listen( + document.getElementById('prompt-ok-' + f.newid), + "click", + function () { + smoke.destroy(f.type, f.newid); + f.callback(pi.value); + } + ); + + document.onkeyup = function (e) { + if (!e) { + e = window.event; + } + + if (e.keyCode === 13) { + smoke.destroy(f.type, f.newid); + f.callback(pi.value); + } else if (e.keyCode === 27) { + smoke.destroy(f.type, f.newid); + f.callback(false); + } + }; + }, + + finishbuildSignal: function (e, f, box) { + + + document.onkeyup = function (e) { + if (!e) { + e = window.event; + } + if (e.keyCode === 27) { + smoke.destroy(f.type, f.newid); + if (typeof f.callback !== 'undefined') { + f.callback(); + } + } + }; + + smoke.smoketimeout[f.newid] = setTimeout(function () { + smoke.destroy(f.type, f.newid); + if (typeof f.callback !== 'undefined') { + f.callback(); + } + }, f.timeout); + }, + + destroy: function (type, id) { + + var box = document.getElementById('smoke-out-' + id); + + if (type !== 'quiz') { + var okButton = document.getElementById(type + '-ok-' + id); + } + + var cancelButton = document.getElementById(type + '-cancel-' + id); + box.className = 'smoke-base'; + + if (okButton) { + smoke.stoplistening(okButton, "click", function () {}); + document.onkeyup = null; + } + + if (type === 'quiz') { + var quiz_buttons = document.getElementsByClassName("quiz-button"); + for (var i = 0; i < quiz_buttons.length; i++) { + smoke.stoplistening(quiz_buttons[i], "click", function () {}); + document.onkeyup = null; + } + } + + if (cancelButton) { + smoke.stoplistening(cancelButton, "click", function () {}); + } + + smoke.i = 0; + document.body.removeChild(box); + }, + + alert: function (e, f, g) { + if (typeof g !== 'object') { + g = false; + } + + var id = smoke.newdialog(); + + smoke.build(e, { + type: 'alert', + callback: f, + params: g, + newid: id + }); + }, + + signal: function (e, f, g) { + if (typeof g !== 'object') { + g = false; + } + + var duration = 5000; + if (g.duration !== 'undefined') { + duration = g.duration; + } + + var id = smoke.newdialog(); + smoke.build(e, { + type: 'signal', + callback: f, + timeout: duration, + params: g, + newid: id + }); + }, + + confirm: function (e, f, g) { + if (typeof g !== 'object') { + g = false; + } + + var id = smoke.newdialog(); + smoke.build(e, { + type: 'confirm', + callback: f, + params: g, + newid: id + }); + }, + + quiz: function (e, f, g) { + if (typeof g !== 'object') { + g = false; + } + + var id = smoke.newdialog(); + smoke.build(e, { + type: 'quiz', + callback: f, + params: g, + newid: id + }); + }, + + prompt: function (e, f, g) { + if (typeof g !== 'object') { + g = false; + } + + var id = smoke.newdialog(); + return smoke.build(e, {type: 'prompt', callback: f, params: g, newid: id}); + }, + + listen: function (e, f, g) { + if (e.addEventListener) { + return e.addEventListener(f, g, false); + } + + if (e.attachEvent) { + return e.attachEvent('on' + f, g); + } + + return false; + }, + + stoplistening: function (e, f, g) { + if (e.removeEventListener) { + return e.removeEventListener(f, g, false); + } + + if (e.detachEvent) { + return e.detachEvent('on' + f, g); + } + + return false; + } + }; + + + smoke.init = true; + + if (typeof module != 'undefined' && module.exports) { + module.exports = smoke; + } else if (typeof define === 'function' && define.amd) { + define('smoke', [], function () { + return smoke; + }); + } else { + this.smoke = smoke; + } })(window, document); diff --git a/html/popup.php b/html/popup.php index 5bed03162..811841117 100644 --- a/html/popup.php +++ b/html/popup.php @@ -24,10 +24,11 @@ require_once NOALYSS_INCLUDE.'/lib/html_input.class.php'; require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; require_once NOALYSS_INCLUDE.'/class/dossier.class.php'; require_once NOALYSS_INCLUDE.'/lib/database.class.php'; +require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; require_once NOALYSS_INCLUDE.'/class/user.class.php'; require_once NOALYSS_INCLUDE.'/class/periode.class.php'; - +$http=new HttpInput(); /* * Check if the user is still connected */ @@ -66,8 +67,13 @@ $g_user->check_dossier(Dossier::id()); if ( basename($_GET['op']) == 'history' ) { $href=dossier::get(); + + $exercice=$http->get("exercice","number",0); + /* current year */ - $exercice=$g_user->get_exercice(); + if ($exercice == 0 ) { + $exercice=$g_user->get_exercice(); + } /* get date limit */ $periode=new Periode($cn); diff --git a/html/style-r692.css b/html/style-classic7.css similarity index 97% rename from html/style-r692.css rename to html/style-classic7.css index 95feecf81..6a5e501b5 100644 --- a/html/style-r692.css +++ b/html/style-classic7.css @@ -235,18 +235,13 @@ td.mtitle { padding: 0px; text-align:center; width:250px; - /*! height :30px; */ - border-radius:5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; + height:42px; + background-color: #5681B7; - /*! border-style: solid; */ - /*! border-width: 1px; */ border-color: darkblue; border-top-right-radius: 0px; border-bottom-left-radius: 0px; - /*! padding-top: 5px; */ - /*! padding-bottom: 5px; */ + } @media only screen and (max-width:955px) { td.mtitle { @@ -258,11 +253,14 @@ td.mtitle { td.mtitle a.mtitle { color : white; display:block; - /*! width:100%; */ - /*! height: 100%; */ font-size:1rem; - padding-top: 8px; - padding-bottom: 8px; + font-family:SansationLight; + width:100%; + padding:0px; + margin:0px; + height:100%; + padding:4px 0px 0px 0px; + } span.mtitle { @@ -307,21 +305,16 @@ td.cell{ } td.selectedcell{ -/* border-color:#0000FF;*/ - border-radius:5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; + border-radius:15px; + -moz-border-radius: 15px; + -webkit-border-radius: 15px; font-weight: bold; -/* background:#5D90CD ;*/ color:#FFFFFF; width:250px; text-align:center; - /*! height:30px; */ - background: #b8c6df; /* Old browsers */ - -border-top-right-radius: 0px; -border-bottom-left-radius: 0px; + border-top-right-radius: 0px; + border-bottom-left-radius: 0px; } .menu2 td.mtitle ,.menu2 td.selectedcell{ border-radius: 0px; @@ -349,6 +342,7 @@ a.mtitle:hover { background-color:#EFEBEB; color: blue; + /*! padding: 100px; */ } td.selectedcell a.mtitle,div.content td.selectedcell a.mtitle { text-decoration:none; @@ -1248,17 +1242,20 @@ div.menu2 a.mtitle{ font-size:1rem; font-weight: normal; color: darkblue; - padding-top: 4px; - padding-bottom: 4px; - padding-left: 10px; - padding-right: 10px; + padding:5px; + margin:0px; color: whitesmoke; + border-radius: 5px; } div.menu2 a.mtitle:hover,div.menu a.mtitle:hover,td.mtitle a.mtitle:hover { color:#5681B7; background-color: #EFEBEB; + /* padding:18px 0px 18px 0px; */ } +div.menu2 a.mtitle:hover { + border-radius: 0px 0px; +} div.menu3 { font-size:13.6px; font-size:0.80rem; @@ -2184,14 +2181,16 @@ div.select_box a:hover,div.select_box ul li:hover { * Menu second level */ div.menu2 td.mtitle, div.menu2 td.mtitle a{ - background-color: white; - color:darkblue; + border-style: solid; border-width: 0.1px; - border-color:lightgrey; + border-color:white; + height:25px; + border-radius: 0px 0px 0px 10px; } div.menu2 td.mtitle a{ border-width:0px; + padding:5px; } /** * For the icon (font-famillo fontello) @@ -2227,4 +2226,30 @@ div.bxbutton .icon:hover { background-color: white; color: blue; -} \ No newline at end of file +} +/** + * progressBar + */ +div.progressbar { + width:300px; + height:30px; + position:fixed; + top:5px; + left:40%; + background-color: white; + color:blue; + z-index:800; + border-color: #596a72; + border-width: 1px; + border-style: solid; +} +#progressValue { + display:block; + width: 0px; + height: 100%; + margin:0px; + padding: 0px; + background-color:darkblue; + color:antiquewhite; + font-weight: bolder; +} diff --git a/html/style-light.css b/html/style-light.css index 8875abe15..7e291e8bb 100644 --- a/html/style-light.css +++ b/html/style-light.css @@ -2200,4 +2200,30 @@ div.bxbutton .icon:hover { background-color: white; color: blue; +} +/** + * progressBar + */ +div.progressbar { + width:300px; + height:30px; + position:fixed; + top:5px; + left:40%; + background-color: white; + color:blue; + z-index:800; + border-color: #596a72; + border-width: 1px; + border-style: solid; +} +#progressValue { + display:block; + width: 0px; + height: 100%; + margin:0px; + padding: 0px; + background-color:darkblue; + color:antiquewhite; + font-weight: bolder; } \ No newline at end of file diff --git a/html/test.php b/html/test.php index d5a467e75..e45ddc264 100644 --- a/html/test.php +++ b/html/test.php @@ -23,7 +23,7 @@ * It is only a quick and dirty testing. You should use a tool as PHPUNIT for the unit testing * * - first do not forget to create the authorized_debug file in the html folder - * - secund the test must adapted to this page : if you do a post (or get) from a test, you won't get any result + * - secund the test must be adapted to this page : if you do a post (or get) from a test, you won't get any result * if the $_REQUEST[test_select] is not set, so set it . */ diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php index 128fc6da7..f3fb23bc7 100644 --- a/include/ajax/ajax_history.php +++ b/include/ajax/ajax_history.php @@ -53,8 +53,10 @@ if ( isset($_GET['f_id'])) $f_id=$http->get('f_id',"number"); $fiche=new Fiche($cn,$f_id); - $year=$http->get("exercice","string",$g_user->get_exercice()); - if ( $year == 0 ) + $year=$http->get("exercice","string",""); + if ( $year == "") $year=$g_user->get_exercice(); + + if ( $year == "" ) { $html=_("erreur aucune période par défaut, allez dans préférence pour en choisir une"); } @@ -137,7 +139,8 @@ if ( isset($_REQUEST['pcm_val'])) { $poste=new Acc_Account_Ledger($cn,$_REQUEST['pcm_val']); $poste->load(); - $year=$http->get("exercice","string",$g_user->get_exercice()); + $year=$http->get("exercice","string",""); + if ( $year == "") $year=$g_user->get_exercice(); if ( $year == 0 ) { $html=_("erreur aucune période par défaut, allez dans préférence pour en choisir une"); diff --git a/include/ajax/ajax_history_anc_account.php b/include/ajax/ajax_history_anc_account.php new file mode 100644 index 000000000..73036ae8a --- /dev/null +++ b/include/ajax/ajax_history_anc_account.php @@ -0,0 +1,69 @@ + + +if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief Display the history of an analytic account. + * Receives the parameters GET: + - gDossier integer + - act history_anc_account + - po_id integer poste_analytic.po_id + - div DOM ID of the box + - op history + - exercice integer + */ +require_once NOALYSS_INCLUDE."/class/anc_grandlivre.class.php"; + +try { + $po_id=$http->get("po_id","number"); + $exercice=$http->get("exercice","number"); + $div=$http->get("div"); +} catch (Exception $ex) { + echo $ex->getTraceAsString(); + throw $ex; +} +$poste_analytic=new Poste_analytique_SQL($cn, $po_id); + +$anc_grandlivre=new Anc_GrandLivre($cn); + +$anc_grandlivre->from_poste=$poste_analytic->po_name; +$anc_grandlivre->to_poste=$poste_analytic->po_name; + +// Find the first and last periode +$periode=new Periode($cn); +$a_periode_limit=$periode->limit_year($exercice); + +// Find the first day +$first_day=$periode->first_day($a_periode_limit['start']); + +// find the last day +$last_day=$periode->last_day($a_periode_limit['end']); + +$anc_grandlivre->from=$first_day; +$anc_grandlivre->to=$last_day; + +echo HtmlInput::title_box($poste_analytic->getp("po_name"), $div, "close", "", "n"); + +echo $anc_grandlivre->display_html(0); +$anc_grandlivre->pa_id=$poste_analytic->pa_id; +echo $anc_grandlivre->show_button(); \ No newline at end of file diff --git a/include/ajax/ajax_preference.php b/include/ajax/ajax_preference.php index 1b92a860f..07f62bf5e 100644 --- a/include/ajax/ajax_preference.php +++ b/include/ajax/ajax_preference.php @@ -27,6 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/iselect.class.php'; require_once NOALYSS_INCLUDE.'/lib/iperiod.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_report.class.php'; require_once NOALYSS_INCLUDE.'/class/periode.class.php'; +require_once NOALYSS_INCLUDE.'/class/exercice.class.php'; echo HtmlInput::title_box(_('Préférence'), 'preference_div'); echo '
'; echo '

'; @@ -105,21 +106,37 @@ if (isset($_REQUEST['gDossier']) && $_REQUEST['gDossier']<>0) $period->p_id = $l_user_per; $period->jrn_def_id = 0; + $selected_exercice=$period->get_exercice(); + $js=sprintf('onchange="updatePeriodePreference(%d);"',Dossier::id()); + $exercice=new Exercice($cn); + if ($period->is_closed($l_user_per) == 1) { $msg = _('Attention cette période est fermée, vous ne pourrez rien modifier dans le module comptable'); $msg = '

' . $msg . '

'; } - - $period = new IPeriod("period"); - $period->user = $g_user; - $period->cn = $cn; - $period->filter_year = false; - $period->value = $l_user_per; - $period->type = ALL; - $l_form_per = $period->input(); + + $iperiod = new IPeriod("period"); + $iperiod->id="setting_period"; + $iperiod->user = $g_user; + $iperiod->cn = $cn; + $iperiod->filter_year = true; + $iperiod->exercice=$selected_exercice; + $iperiod->value = $l_user_per; + $iperiod->type = ALL; + $l_form_per = $iperiod->input(); ?> - + + + + + + select("exercice_setting",$selected_exercice,$js)->input();?> + + + + + diff --git a/include/ajax/ajax_tva_parameter.php b/include/ajax/ajax_tva_parameter.php new file mode 100644 index 000000000..9dffd57c2 --- /dev/null +++ b/include/ajax/ajax_tva_parameter.php @@ -0,0 +1,78 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief + * @param type $name Descriptionara + */ +require_once NOALYSS_INCLUDE."/class/tva_rate_mtable.class.php"; + +if ( $g_user->check_module('CFGTVA') ==0 ) +{ + return; +} +try +{ + $table=$http->request('table'); + $action=$http->request('action'); + $p_id=$http->request('p_id', "number"); + $ctl_id=$http->request('ctl'); +} +catch (Exception $e) +{ + record_log($e->getTraceAsString()); + return; +} + +$tva_rate=new V_Tva_Rate_SQL($cn); +$p_id=$http->request('p_id', "number"); +$tva_rate->set_pk_value($p_id); +$tva_rate->load(); +$manage_table=new Tva_Rate_MTable($tva_rate); +$manage_table->set_callback("ajax_misc.php"); +$manage_table->add_json_param("op", "tva_parameter"); + +if ($action=="input") +{ + + $manage_table->set_object_name($ctl_id); + header('Content-type: text/xml; charset=UTF-8'); + echo $manage_table->ajax_input()->saveXML(); + return; +} +elseif ($action=="save") +{ + $manage_table->set_object_name($ctl_id); + header('Content-type: text/xml; charset=UTF-8'); + echo $manage_table->ajax_save()->saveXML(); + return; +} +elseif ($action=="delete") +{ + $manage_table->set_object_name($ctl_id); + header('Content-type: text/xml; charset=UTF-8'); + echo $manage_table->ajax_delete()->saveXML(); +} +return; diff --git a/include/anc_great_ledger.inc.php b/include/anc_great_ledger.inc.php index 0ecb747af..3cf291be7 100644 --- a/include/anc_great_ledger.inc.php +++ b/include/anc_great_ledger.inc.php @@ -34,10 +34,13 @@ if ($result != null) echo ''; echo _('Tout sélectionner')." ".ICheckBox::toggle_checkbox('export_pdf_bt1','export_anc_receipt_pdf'); echo ''; + $task_id=uniqid(); echo $grandLivre->show_button(); - printf ('
', - _("Le traitement est en cours , merci de patienter sans recharger la page")); - + printf ('', + $task_id, + _("Le traitement est en cours , merci de patienter sans recharger la page") + ); + echo HtmlInput::hidden("task_id",$task_id); echo $grandLivre->button_export_pdf(); echo $grandLivre->display_html(); echo $grandLivre->button_export_pdf(); diff --git a/include/anc_od.inc.php b/include/anc_od.inc.php index e07482d6e..fec76187f 100644 --- a/include/anc_od.inc.php +++ b/include/anc_od.inc.php @@ -51,9 +51,8 @@ if ( ! $m ) // show the left menu //---------------------------------------------------------------------- echo ' -
-
'; diff --git a/include/balance.inc.php b/include/balance.inc.php index 92db13bdc..ecca2ba1f 100644 --- a/include/balance.inc.php +++ b/include/balance.inc.php @@ -35,30 +35,31 @@ require_once NOALYSS_INCLUDE.'/class/periode.class.php'; require_once NOALYSS_INCLUDE.'/class/exercice.class.php'; global $g_user, $http; $gDossier=dossier::id(); -$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice(); +// Get the exercice +$exercice=$http->request("exercice","number",0); +if ($exercice == 0 ){ + $exercice=$g_user->get_exercice(); +} + bcscale(2); echo '
'; /* * Let you change the exercice */ -echo '
'._('Exercice').'';; echo ''; echo _('Choisissez un autre exercice')." : "; $ex=new Exercice($cn); -$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"'); +$js=sprintf("updatePeriode(%d,'%s','%s','%s',1)",Dossier::id(),'exercice','from_periode','to_periode'); +$wex=$ex->select('exercice',$exercice,' onchange="'.$js.'"'); echo $wex->input(); echo dossier::hidden(); echo HtmlInput::get_to_hidden(array('ac','type')); -echo ''; -echo '
'; // Show the form for period -echo '
'; echo HtmlInput::get_to_hidden(array('ac')); echo HtmlInput::hidden('type','bal'); -echo HtmlInput::get_to_hidden(array('exercice')); echo dossier::hidden(); @@ -66,6 +67,7 @@ echo dossier::hidden(); // filter on the current year $from=$http->get("from_periode", "number",0); $input_from=new IPeriod("from_periode",$from,$exercice); +$input_from->id="from_periode"; $input_from->show_end_date=false; $input_from->type=ALL; $input_from->cn=$cn; @@ -83,6 +85,7 @@ if( $to == 0) { $to=$per_min->p_id; } $input_to=new IPeriod("to_periode",$to,$exercice); +$input_to->id="to_periode"; $input_to->show_start_date=false; $input_to->filter_year=true; $input_to->type=ALL; @@ -288,7 +291,7 @@ if ( isset($_GET['view'] ) ) $previous=(isset($_GET['previous_exc']))?1:0; $from_periode=$http->get("from_periode","number"); $to_periode=$http->get("to_periode","number"); - $row=$bal->get_row($from_periode,$to_periode); + $row=$bal->get_row($from_periode,$to_periode,$previous); $previous= (isset ($row[0]['sum_cred_previous']))?1:0; $periode=new Periode($cn); @@ -300,26 +303,22 @@ if ( isset($_GET['view'] ) ) echo HtmlInput::filter_table("t_balance", "0,1","1"); echo ''; echo ''; - echo ''; - echo ''; + echo ''; + echo ''; if ( $previous == 1 ){ - echo ''; - echo ''; - echo ''; - echo ''; - if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) - echo ''; + echo ''; + echo ''; + echo ''; } echo ''; - echo ''; - echo ''; - echo ''; -// if ( isset($_GET['lvl1']) || isset($_GET['lvl2']) || isset($_GET['lvl3'])) -// echo ''; + echo ''; + echo ''; + echo ''; + $i=0; if ( $previous == 1) { - $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_cred_previous','sum_deb_previous','solde_deb_previous','solde_cred_previous'); + $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_deb_ope','sum_cred_ope','sum_cred_previous','sum_deb_previous','solde_previous'); } else { $a_sum=array('sum_cred','sum_deb','solde_deb','solde_cred','sum_deb_ope','sum_cred_ope') ; @@ -348,7 +347,9 @@ if ( isset($_GET['view'] ) ) else $tr="odd"; $view_history=HtmlInput::history_account($r['poste'], $r['poste'], "",$exercice); - + if ($previous == 1 ) { + $r['solde_previous']=bcsub($r['solde_deb_previous'],$r['solde_cred_previous']); + } /* * level x */ @@ -362,23 +363,22 @@ if ( isset($_GET['view'] ) ) echo ''; echo td(${'lvl'.$ind.'_old'},'style="font-weight:bold;"'); echo td(${'lvl'.$ind.'_old'}." "._("Total niveau")." ".$ind,'style="font-weight:bold;"'); + + // compare with previous exercice if ($previous==1) { echo td(nbm(${'lvl'.$ind}['sum_deb_previous']),'class="previous_year" style="font-weight:bold;"'); echo td(nbm(${'lvl'.$ind}['sum_cred_previous']),' class="previous_year" style="font-weight:bold;" '); - echo td(nbm(${'lvl'.$ind}['solde_deb_previous']),'class="previous_year" style="font-weight:bold;"'); - echo td(nbm(${'lvl'.$ind}['solde_cred_previous']),'class="previous_year" style="font-weight:bold;"'); - $delta_previous=bcsub(${'lvl'.$ind}['solde_cred_previous'],${'lvl'.$ind}['solde_deb_previous']); - $side_previous=($delta_previous > 0 ) ? "C":"D"; + $delta_previous=${'lvl'.$ind}['solde_previous']; + $side_previous=($delta_previous > 0 ) ? "D":"C"; echo td(nbm(abs($delta_previous))." $side_previous",'class="previous_year" style="text-align:right;font-weight:bold;" '); } - /*echo td(nbm(${'lvl'.$ind}['sum_deb']),'style="text-align:right;font-weight:bold;" '); - echo td(nbm(${'lvl'.$ind}['sum_cred']),'style="text-align:right;font-weight:bold;"');*/ + // Ouverture $solde3=bcsub(${'lvl'.$ind}['sum_deb_ope'],${'lvl'.$ind}['sum_cred_ope']); $side3=($solde3<0)?" C":" D"; $side3=($solde3==0)?" ":$side3; - echo td(nbm(abs($solde3)).$side3); + echo td(nbm(abs($solde3)).$side3,'style="text-align:right;font-weight:bold;"'); // Saldo debit $solde_deb=bcsub(${'lvl'.$ind}['sum_deb'],${'lvl'.$ind}['sum_deb_ope']); @@ -400,12 +400,12 @@ if ( isset($_GET['view'] ) ) } } - foreach($a_sum as $a) - { - $lvl1[$a]=bcadd($lvl1[$a],$r[$a]); - $lvl2[$a]=bcadd($lvl2[$a],$r[$a]); - $lvl3[$a]=bcadd($lvl3[$a],$r[$a]); - } + foreach($a_sum as $a) + { + $lvl1[$a]=bcadd($lvl1[$a],$r[$a]); + $lvl2[$a]=bcadd($lvl2[$a],$r[$a]); + $lvl3[$a]=bcadd($lvl3[$a],$r[$a]); + } // For the Total row , there is no accounting if ( $r['poste'] == "") { $tr="highlight"; @@ -420,12 +420,11 @@ if ( isset($_GET['view'] ) ) if ($previous == 1 ) { echo td(nbm($r['sum_deb_previous']),' class="previous_year"'); echo td(nbm($r['sum_cred_previous']),' class="previous_year" '); - echo td(nbm($r['solde_deb_previous']),' class="previous_year"'); - echo td(nbm($r['solde_cred_previous']),'class="previous_year" '); - if ( isset($_GET['lvl1']) || - isset($_GET['lvl2']) || - isset($_GET['lvl3'])) - echo ''; + $solde_previous=bcsub($r['solde_deb_previous'],$r['solde_cred_previous']); + $side=($solde_previous<0)?"D":"C"; + $side=($solde_previous==0)?"":$side; + $r['solde_previous']=$solde_previous; + echo td(nbm(abs($solde_previous))." ".$side,' class="previous_year"'); $summary_prev_tab=$bal->summary_add($summary_prev_tab, $r['poste'], diff --git a/include/class/acc_balance.class.php b/include/class/acc_balance.class.php index 0c65a2360..d0c956f9f 100644 --- a/include/class/acc_balance.class.php +++ b/include/class/acc_balance.class.php @@ -138,12 +138,17 @@ class Acc_Balance $per_sql_previous=sql_filter_per($this->db,$previous_start->p_id,$previous_end->p_id,'p_id','j_tech_per'); $sql=" with m as - ( select j_poste,sum(deb) as sdeb,sum(cred) as scred + ( select j_poste,sum(deb) as sdeb,sum(cred) as scred, + sum(deb_op) as sum_deb_ope , + sum(cred_op) as sum_cred_ope from (select j_poste, case when j_debit='t' then j_montant else 0 end as deb, - case when j_debit='f' then j_montant else 0 end as cred + case when j_debit='f' then j_montant else 0 end as cred , + case when j_debit='t' and jr_optype='OPE' then j_montant else 0 end as deb_op, + case when j_debit='f' and jr_optype='OPE' then j_montant else 0 end as cred_op from jrnx + join jrn on (j_grpt=jr_grpt_id) join tmp_pcmn on (j_poste=pcm_val) left join parm_periode on (j_tech_per = p_id) join jrn_def on (j_jrn_def=jrn_def_id) @@ -152,15 +157,11 @@ class Acc_Balance $and $filter_sql and $per_sql ) as sub_m group by j_poste order by j_poste ) , p as ( select j_poste,sum(deb) as sdeb, - sum(cred) as scred , - sum(deb_op) as sum_deb_ope , - sum(cred_op) as sum_cred_ope + sum(cred) as scred from (select j_poste, case when j_debit='t' then j_montant else 0 end as deb, - case when j_debit='f' then j_montant else 0 end as cred , - case when j_debit='t' and jr_optype='OPE' then j_montant else 0 end as deb_op, - case when j_debit='f' and jr_optype='OPE' then j_montant else 0 end as cred_op + case when j_debit='f' then j_montant else 0 end as cred from jrnx join tmp_pcmn on (j_poste=pcm_val) left join parm_periode on (j_tech_per = p_id) join jrn_def on (j_jrn_def=jrn_def_id) diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 8e5982b52..43a16b0eb 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -45,6 +45,7 @@ require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php'; require_once NOALYSS_INCLUDE.'/database/jrn_def_sql.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_payment.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_ledger_history.class.php'; +//require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; /** \file @@ -2634,6 +2635,11 @@ class Acc_Ledger extends jrn_def_sql if ( empty($pa_ledger) ) { $pa_ledger=[$this->id]; } + // if $pa_ledger == 0, it means we need to show all ledgers + if ( $pa_ledger == [0] ) { + $pa_ledger=Print_Ledger::available_ledger($p_from); + } + $alh_generic=new Acc_Ledger_History_Generic($this->db, $pa_ledger, $p_from, $p_to, "A"); $alh_generic->get_rowSimple($trunc,$p_limit,$p_offset); $data=$alh_generic->get_data(); diff --git a/include/class/acc_ledger_fin.class.php b/include/class/acc_ledger_fin.class.php index 2144b1f71..ca5da1a73 100644 --- a/include/class/acc_ledger_fin.class.php +++ b/include/class/acc_ledger_fin.class.php @@ -24,6 +24,7 @@ * \brief the class Acc_Ledger_Fin inherits from Acc_Ledger, this * object permit to manage the financial ledger */ +require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php'; require_once NOALYSS_INCLUDE.'/lib/idate.class.php'; require_once NOALYSS_INCLUDE.'/lib/icard.class.php'; require_once NOALYSS_INCLUDE.'/lib/ispan.class.php'; @@ -32,7 +33,6 @@ require_once NOALYSS_INCLUDE.'/lib/iconcerned.class.php'; require_once NOALYSS_INCLUDE.'/lib/ifile.class.php'; require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php'; require_once NOALYSS_INCLUDE.'/lib/iselect.class.php'; -require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php'; require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; require_once NOALYSS_INCLUDE.'/class/acc_reconciliation.class.php'; diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index c931a09da..7dfc93803 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -1262,6 +1262,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger $Tva->js="onblur=\"format_number(this);onChange=clean_tva($i);compute_ledger($i)\""; $Tva->in_table=true; $Tva->set_attribute('compute',$i); + $Tva->set_filter("purchase"); $Tva->value=$march_tva_id; $array[$i]['tva']=$Tva->input("e_march$i"."_tva_id"); diff --git a/include/class/acc_ledger_sold.class.php b/include/class/acc_ledger_sold.class.php index 6dbf6b105..b7e8d53df 100644 --- a/include/class/acc_ledger_sold.class.php +++ b/include/class/acc_ledger_sold.class.php @@ -1291,6 +1291,7 @@ EOF; $Tva = new ITva_Popup($this->db); $Tva->in_table = true; $Tva->set_attribute('compute', $i); + $Tva->set_filter("sale"); $Tva->js = 'onblur="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . ')"'; $Tva->value = $march_tva_id; diff --git a/include/class/anc_balance_double.class.php b/include/class/anc_balance_double.class.php index 67bd6524f..26fed20b0 100644 --- a/include/class/anc_balance_double.class.php +++ b/include/class/anc_balance_double.class.php @@ -352,12 +352,13 @@ class Anc_Balance_Double extends Anc_Print $r.=_('Entre le poste '); $r.=$poste->input("from_poste2",$this->from_poste2); $javascript="search_ca(".dossier::id().",'from_poste2','pa_id2')"; - $r.=HtmlInput::button_image($javascript, uniqid(), 'alt="'._('Recherche').'" title="'._('Recherche').'" class="image_search"',"image/magnifier13.png"); - + $r.=Icon_Action::icon_magnifier(uniqid(), $javascript); + $r.=_(" et le poste "); + $poste->id="to_poste2"; $r.=$poste->input("to_poste2",$this->to_poste2); - $r.=HtmlInput::button_image($javascript, uniqid(), 'alt="'._('Recherche').'" title="'._('Recherche').'" class="image_search"',"image/magnifier13.png"); $javascript="search_ca(".dossier::id().",'to_poste2','pa_id2')"; + $r.=Icon_Action::icon_magnifier(uniqid(), $javascript); $r.=''. _('Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche'). diff --git a/include/class/anc_grandlivre.class.php b/include/class/anc_grandlivre.class.php index 4139b9765..fdefa13ff 100644 --- a/include/class/anc_grandlivre.class.php +++ b/include/class/anc_grandlivre.class.php @@ -179,7 +179,7 @@ class Anc_GrandLivre extends Anc_Print * \return string */ - function display_html() + function display_html($p_with_ck=1) { $r = ""; //---Html @@ -250,7 +250,7 @@ class Anc_GrandLivre extends Anc_Print */ $str_ck = ""; $str_document = ""; - if ($row['jr_id'] != null) + if ($row['jr_id'] != null && $p_with_ck==1) { /* * Get receipt info diff --git a/include/class/anc_listing.class.php b/include/class/anc_listing.class.php index ff2869b06..999c2fc7c 100644 --- a/include/class/anc_listing.class.php +++ b/include/class/anc_listing.class.php @@ -97,7 +97,7 @@ class Anc_Listing extends Anc_Print ''. td($post_detail). td($card_detail). - ''. + ''. ''. td($row['jr_comment']). ''. diff --git a/include/class/anc_operation.class.php b/include/class/anc_operation.class.php index 1bbddc270..69f0f9817 100644 --- a/include/class/anc_operation.class.php +++ b/include/class/anc_operation.class.php @@ -213,32 +213,33 @@ class Anc_Operation $pa_id_cond= "pa_id=".$this->pa_id." and"; $sql=" - select oa_id, - po_name, - oa_description, - po_description, - oa_debit, - (case when jr_date is not null then to_char(jr_date,'DD.MM.YYYY') else to_char(oa_date,'DD.MM.YYYY') end ) as oa_date, - oa_amount, - oa_group, - j_id , - jr_internal, - jr_id, - coalesce(jr_comment,b.oa_description) as jr_comment, - case when j_poste is null and b.f_id is not null then - (select ad_value from fiche_detail where fiche_detail.f_id=b.f_id and ad_id=".ATTR_DEF_ACCOUNT.") - when j_poste is not null then - j_poste - end as j_poste - , - coalesce(jrnx.f_id,b.f_id) as f_id, - case when jrnx.f_id is not null then - (select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) - when b.f_id is not null then - (select ad_value from fiche_Detail where f_id=b.f_id and ad_id=23) - end - as qcode, - jr_pj_number + select B.po_id as po_id, + oa_id, + po_name, + oa_description, + po_description, + oa_debit, + (case when jr_date is not null then to_char(jr_date,'DD.MM.YYYY') else to_char(oa_date,'DD.MM.YYYY') end ) as oa_date, + oa_amount, + oa_group, + j_id , + jr_internal, + jr_id, + coalesce(jr_comment,b.oa_description) as jr_comment, + case when j_poste is null and b.f_id is not null then + (select ad_value from fiche_detail where fiche_detail.f_id=b.f_id and ad_id=".ATTR_DEF_ACCOUNT.") + when j_poste is not null then + j_poste + end as j_poste + , + coalesce(jrnx.f_id,b.f_id) as f_id, + case when jrnx.f_id is not null then + (select ad_value from fiche_Detail where f_id=jrnx.f_id and ad_id=23) + when b.f_id is not null then + (select ad_value from fiche_Detail where f_id=b.f_id and ad_id=23) + end + as qcode, + jr_pj_number 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) @@ -711,11 +712,12 @@ class Anc_Operation { $tot=bcadd($tot,$a_Anc_Operation[$i]->oa_amount); } - if ( $tot != $p_nd && count($a_Anc_Operation) > 0 ) - { - $diff= bcsub($tot, $p_nd); - $a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff); - } +// utilité ??? +// if ( $tot != $p_nd && count($a_Anc_Operation) > 0 ) +// { +// $diff= bcsub($tot, $p_nd); +// $a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff); +// } for ($i=0;$i<$nb_op;$i++) { $a_Anc_Operation[$i]->add(); diff --git a/include/class/anc_print.class.php b/include/class/anc_print.class.php index 78d0866a0..5e8ea00a1 100644 --- a/include/class/anc_print.class.php +++ b/include/class/anc_print.class.php @@ -127,11 +127,11 @@ class Anc_Print $plan_id->selected=$this->pa_id; $javascript="search_ca(".dossier::id().",'from_poste','pa_id')"; - $choose_from=HtmlInput::button_image($javascript, uniqid(), 'alt="'._('Recherche').'" title="'._('Recherche').'" class="image_search"',"image/magnifier13.png"); - + $choose_from=Icon_Action::icon_magnifier(uniqid(), $javascript); $javascript="search_ca(".dossier::id().",'to_poste','pa_id')"; - $choose_to=HtmlInput::button_image($javascript, uniqid(), 'alt="'._('Recherche').'" title="'._('Recherche').'" class="image_search"',"image/magnifier13.png"); - + $choose_to=Icon_Action::icon_magnifier(uniqid(), $javascript); + + $r.=HtmlInput::request_to_hidden(array('ac')); ob_start(); ?> diff --git a/include/class/document_export.class.php b/include/class/document_export.class.php index e0a96f35e..fea8edc71 100644 --- a/include/class/document_export.class.php +++ b/include/class/document_export.class.php @@ -19,6 +19,7 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu require_once NOALYSS_INCLUDE.'/class/pdf_operation.class.php'; +require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php'; /** * @brief Export DOCUMENT from Analytic accountancy, can transform into PDF * and add a stamp on each pages @@ -118,16 +119,20 @@ class Document_Export * a stamp. If an error occurs then $this->feedback won't be empty * @param $p_array contents all the jr_id */ - function export_all($p_array) + function export_all($p_array, Progress_Bar $progress) { $this->check_file(); + if ( count($p_array)==0) return; ob_start(); $cnt_feedback=0; global $cn; - + // follow progress + $step=round(16/count($p_array),2); + $cn->start(); foreach ($p_array as $value) { + $progress->increment($step); // For each file save it into the temp folder, $file = $cn->get_array('select jr_pj,jr_pj_name,jr_pj_number,jr_pj_type from jrn ' . ' where jr_id=$1', array($value)); @@ -173,7 +178,7 @@ class Document_Export continue; } - + $progress->increment($step); // // remove extension $ext = strrpos($filename, "."); @@ -210,6 +215,7 @@ class Document_Export } rename ($this->store_convert . '/' . $file_pdf.'.2',$this->store_convert . '/' . $file_pdf); } + $progress->increment($step); // output $output = $this->store_convert . '/stamp_' . $file_pdf; @@ -238,7 +244,8 @@ class Document_Export // concatenate detail operation with the output $stmt = PDFTK . " " . $detail_operation->get_pdf_filename()." ".$output. ' output ' . $output2; - + + $progress->increment($step); passthru($stmt, $status); if ($status <> 0) { @@ -259,12 +266,15 @@ class Document_Export $this->move_file($output, 'stamp_' . $file_pdf); } + $progress->set_value(93); // concatenate all pdf into one $this->concatenate_pdf(); + ob_clean(); $this->send_pdf(); + $progress->set_value(100); // remove files from "conversion folder" $this->clean_folder(); diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php index 957beb200..4108a8a34 100644 --- a/include/class/dossier.class.php +++ b/include/class/dossier.class.php @@ -281,7 +281,7 @@ class Dossier static function get_version($p_cn) { - return $p_cn->get_value('select val from version'); + return $p_cn->get_value('select max(val) from version'); } static function connect() diff --git a/include/class/exercice.class.php b/include/class/exercice.class.php index 991eea460..504876684 100644 --- a/include/class/exercice.class.php +++ b/include/class/exercice.class.php @@ -26,7 +26,7 @@ require_once NOALYSS_INCLUDE.'/lib/database.class.php'; require_once NOALYSS_INCLUDE.'/lib/iselect.class.php'; class Exercice { - function __construct(&$cn) + function __construct($cn) { $this->cn=$cn; } @@ -50,7 +50,7 @@ class Exercice function select($name,$selected='',$js='') { $iselect=new ISelect($name); - $iselect->value=$this->cn->make_array('select distinct p_exercice,p_exercice from parm_periode order by 1'); + $iselect->value=$this->cn->make_array('select distinct p_exercice,p_exercice from parm_periode order by 1 desc'); $iselect->selected=$selected; $iselect->javascript=$js; return $iselect; diff --git a/include/class/print_ledger.class.php b/include/class/print_ledger.class.php index d019f30c1..a8bcec27d 100644 --- a/include/class/print_ledger.class.php +++ b/include/class/print_ledger.class.php @@ -52,29 +52,38 @@ class Print_Ledger { if ($p_format_output == 'PDF') { switch ($p_type_export) { case 'D': - $own = new Noalyss_Parameter_Folder($cn); - $jrn_type = $p_ledger->get_type(); + $own=new Noalyss_Parameter_Folder($cn); + $jrn_type=$p_ledger->get_type(); //--------------------------------------------- // Detailled Printing (accounting ) //--------------------------------------------- - if ($jrn_type == 'ACH' || $jrn_type == 'VEN') { + if ($jrn_type=='ACH'||$jrn_type=='VEN') + { if ( - ($jrn_type == 'ACH' && $cn->get_value('select count(qp_id) from quant_purchase') == 0) || - ($jrn_type == 'VEN' && $cn->get_value('select count(qs_id) from quant_sold') == 0) - ) { - $pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger); + ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase') + ==0)|| + ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold') + ==0) + ) + { + $pdf=new Print_Ledger_Simple_without_vat($cn, + $p_ledger); $pdf->set_error(_('Ce journal ne peut être imprimé en mode simple')); return $pdf; } - if ($own->MY_TVA_USE == 'Y') { - $pdf = new Print_Ledger_Simple($cn, $p_ledger); + if ($own->MY_TVA_USE=='Y') + { + $pdf=new Print_Ledger_Simple($cn, $p_ledger); return $pdf; } - if ($own->MY_TVA_USE == 'N') { - $pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger); + if ($own->MY_TVA_USE=='N') + { + $pdf=new Print_Ledger_Simple_without_vat($cn, + $p_ledger); return $pdf; } - }else + } + else return new Print_Ledger_Detail($cn, $p_ledger); break; @@ -82,76 +91,139 @@ class Print_Ledger { //---------------------------------------------------------------------- // Simple Printing Purchase Ledger //--------------------------------------------------------------------- - $own = new Noalyss_Parameter_Folder($cn); - $jrn_type = $p_ledger->get_type(); + $own=new Noalyss_Parameter_Folder($cn); + $jrn_type=$p_ledger->get_type(); - if ($jrn_type == 'ACH' || $jrn_type == 'VEN') { + if ($jrn_type=='ACH'||$jrn_type=='VEN') + { if ( - ($jrn_type == 'ACH' && $cn->get_value('select count(qp_id) from quant_purchase') == 0) || - ($jrn_type == 'VEN' && $cn->get_value('select count(qs_id) from quant_sold') == 0) - ) { - $pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger); + ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase') + ==0)|| + ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold') + ==0) + ) + { + $pdf=new Print_Ledger_Simple_without_vat($cn, + $p_ledger); $pdf->set_error(_('Ce journal ne peut être imprimé en mode simple')); return $pdf; } - if ($own->MY_TVA_USE == 'Y') { - $pdf = new Print_Ledger_Simple($cn, $p_ledger); + if ($own->MY_TVA_USE=='Y') + { + $pdf=new Print_Ledger_Simple($cn, $p_ledger); return $pdf; } - if ($own->MY_TVA_USE == 'N') { - $pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger); + if ($own->MY_TVA_USE=='N') + { + $pdf=new Print_Ledger_Simple_without_vat($cn, + $p_ledger); return $pdf; } } - if ($jrn_type == 'FIN') { - $pdf = new Print_Ledger_Financial($cn, $p_ledger); + if ($jrn_type=='FIN') + { + $pdf=new Print_Ledger_Financial($cn, $p_ledger); return $pdf; } - if ($jrn_type == 'ODS' || $p_ledger->id == 0) { - $pdf = new Print_Ledger_Misc($cn, $p_ledger); + if ($jrn_type=='ODS'||$p_ledger->id==0) + { + $pdf=new Print_Ledger_Misc($cn, $p_ledger); return $pdf; } break; case 'E': /********************************************************** * Print Detail Operation + Item - ********************************************************** */ - $own = new Noalyss_Parameter_Folder($cn); - $jrn_type = $p_ledger->get_type(); - if ($jrn_type == 'FIN') { - $pdf = new Print_Ledger_Financial($cn, $p_ledger); + * ********************************************************* */ + $own=new Noalyss_Parameter_Folder($cn); + $jrn_type=$p_ledger->get_type(); + if ($jrn_type=='FIN') + { + $pdf=new Print_Ledger_Financial($cn, $p_ledger); return $pdf; ; } - if ($jrn_type == 'ODS' || $p_ledger->id == 0) { - $pdf = new Print_Ledger_Detail($cn, $p_ledger); + if ($jrn_type=='ODS'||$p_ledger->id==0) + { + $pdf=new Print_Ledger_Detail($cn, $p_ledger); return $pdf; } if ( - ($jrn_type == 'ACH' && $cn->get_value('select count(qp_id) from quant_purchase') == 0) || - ($jrn_type == 'VEN' && $cn->get_value('select count(qs_id) from quant_sold') == 0) - ) { - $pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger); + ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase') + ==0)|| + ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold') + ==0) + ) + { + $pdf=new Print_Ledger_Simple_without_vat($cn, $p_ledger); $pdf->set_error('Ce journal ne peut être imprimé en mode simple'); return $pdf; } - $pdf = new Print_Ledger_Detail_Item($cn,$p_ledger); + $pdf=new Print_Ledger_Detail_Item($cn, $p_ledger); return $pdf; case 'A': /*********************************************************** * Accounting */ - $pdf = new Print_Ledger_Detail($cn, $p_ledger); + $pdf=new Print_Ledger_Detail($cn, $p_ledger); return $pdf; break; - } // end switch } // end $p_format == PDF } // end function + /** + * @brief find all the active ledger for the exerice of the periode + * and readable by the current user + * @global type $g_user + * @param int $get_from_periode + * @return array of ledger id + */ + static function available_ledger($get_from_periode) + { + global $g_user; + $cn=Dossier::connect(); + // Find periode + $periode=new Periode($cn, $get_from_periode); + $exercice=$periode->get_exercice($get_from_periode); + + if ($g_user->Admin()==0&&$g_user->is_local_admin()==0&&$g_user->get_status_security_ledger() + ==1) + { + $sql="select jrn_def_id + from jrn_def join jrn_type on jrn_def_type=jrn_type_id + join user_sec_jrn on uj_jrn_id=jrn_def_id + where + uj_login=$1 + and uj_priv in ('R','W') + order by jrn_def_name + and ( jrn_enable=1 + or + exists (select 1 from jrn where jr_tech_per in (select p_id from parm_periode where p_exercice=$2)) + "; + $a_jrn=$cn->get_array($sql, array($g_user->login, $exercice)); + } + else + { + $a_jrn=$cn->get_array("select jrn_def_id + from jrn_def join jrn_type on jrn_def_type=jrn_type_id + where + jrn_enable=1 or exists(select 1 from jrn where jr_tech_per in (select p_id from parm_periode where p_exercice=$1)) + order by jrn_def_name + ", [$exercice]); + } + $a=[]; + $nb_jrn=count($a_jrn); + for ($i=0; $i<$nb_jrn; $i++) + { + $a[]=$a_jrn[$i]['jrn_def_id']; + } + return $a; + } + } ?> diff --git a/include/class/tva_rate_mtable.class.php b/include/class/tva_rate_mtable.class.php new file mode 100644 index 000000000..19c047fce --- /dev/null +++ b/include/class/tva_rate_mtable.class.php @@ -0,0 +1,278 @@ + + +/** + * @file + * @brief Configure the tva : code , rate, label ... + */ +require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php"; +require_once NOALYSS_INCLUDE."/lib/icon_action.class.php"; +require_once NOALYSS_INCLUDE."/database/v_tva_rate_sql.class.php"; +require_once NOALYSS_INCLUDE."/database/tva_rate_sql.class.php"; + +/** + * @class + * @brief Configure the tva : code , rate, label ... + * When using Manage_Table_SQL + */ +class Tva_Rate_MTable extends Manage_Table_SQL +{ + + /** + * + * @param V_Tva_rate_SQL $p_table + * @example tva_parameter.php + */ + function __construct(V_Tva_rate_SQL $p_table) + { + parent::__construct($p_table); + $this->set_col_label("tva_id", _("id")); + $this->set_col_label("tva_label", _("label")); + $this->set_col_label("tva_rate", _("taux")); + $this->set_col_label("tva_comment", _("Description")); + $this->set_col_label("tva_both_side", _("Autoliquidation")); + $this->set_col_label("tva_sale", _("TVA Vente (C)")); + $this->set_col_label("tva_purchase", _("TVA Achat (D)")); + $this->set_col_type("tva_both_side", "select", + array( + ["value"=>0, "label"=>_("Normal")], + ["value"=>1, "label"=>_("Autoliquidation")] + )); + $this->set_property_updatable("tva_id", FALSE); + $this->a_info=["tva_purchase"=>44,"tva_both_side"=>43,"tva_sale"=>45]; + } + + /** + * @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 + */ + function input() + { + $nb_order=count($this->a_order); + echo "
Poste ComptableLibellé'._("Poste Comptable").''._("Libellé").'Débit N-1Crédit N-1Solde Débiteur N-1Solde Créditeur N-1Solde N-1'._("Débit N-1").''._('Crédit N-1').''._('Solde N-1').''._('Ouverture').'DébitCréditSoldeSolde'._('Débit').''._('Crédit').''._('Solde').'
'.$row['oa_date'].''.h($row['po_name']).''.HtmlInput::history_anc_account($row['po_id'],h($row['po_name'])).''.h($row['oa_description']).''.$detail.'
"; + for ($i=0; $i<$nb_order; $i++) + { + echo ""; + $key=$this->a_order[$i]; + $label=$this->a_label_displaid[$key]; + $value=$this->table->get($key); + $error=$this->get_error($key); + $error=($error=="")?"":HtmlInput::errorbulle($error); + if ($this->get_property_visible($key)===TRUE) + { + $info=""; + if ( isset($this->a_info[$key])) { + $info=Icon_Action::infobulle($this->a_info[$key]); + } + // Label + echo ""; + + if ($this->get_property_updatable($key)==TRUE) + { + echo ""; + } + else + { + printf('', h($value), + HtmlInput::hidden($key, $value) + ); + } + } + echo ""; + } + echo "
{$label} {$info} {$error}"; + if ($this->a_type[$key]=="select") + { + $select=new ISelect($key); + $select->value=$this->a_select[$key]; + $select->selected=$value; + echo $select->input(); + } + elseif ($key=="tva_rate") + { + $text=new INum($key); + $text->value=$value; + $text->prec=4; + $min_size=(strlen($value)<10)?10:strlen($value)+1; + $text->size=$min_size; + echo $text->input(); + } + elseif ($key=='tva_purchase') + { + $text=new IPoste("tva_purchase"); + $text->value=$value; + $min_size=10; + $text->size=$min_size; + $text->set_attribute('gDossier', Dossier::id()); + $text->set_attribute('jrn', 0); + $text->set_attribute('account', 'tva_purchase'); + echo $text->input(); + //@todo ajout infobulle pour prévenir que compte doit exister + } + elseif ($key=='tva_sale') + { + $text=new IPoste("tva_sale"); + $text->value=$value; + $min_size=10; + $text->set_attribute('gDossier', Dossier::id()); + $text->set_attribute('jrn', 0); + $text->set_attribute('account', 'tva_sale'); + $text->size=$min_size; + echo $text->input(); + } + elseif ($this->a_type[$key]=="text") + { + $text=new IText($key); + $text->value=$value; + $min_size=(strlen($value)<30)?30:strlen($value)+5; + $text->size=$min_size; + echo $text->input(); + } + echo "%s %s
"; + } + + /** + * @brief save the data in TVA_RATE + * if tva_both_side is 1 and tva_purchase or tva_sale is empty then + it is equal to the other value + * + */ + function save() + { + $cn=Dossier::connect(); + // if tva_both_side is 1 and tva_purchase or tva_sale is empty then + // it is equal to the other value + if ($this->table->tva_both_side==1) + { + if ($this->table->tva_purchase=="#"||trim($this->table->tva_purchase) + =="#") + { + $this->table->tva_purchase=$this->table->tva_sale; + } + if ($this->table->tva_sale=="#"||trim($this->table->tva_sale)=="#") + { + $this->table->tva_sale=$this->table->tva_purchase; + } + } + $tva_rate=new Tva_rate_SQL($cn, $this->table->tva_id); + $tva_rate->setp("tva_rate", $this->table->tva_rate); + $tva_rate->setp("tva_label", $this->table->tva_label); + $tva_rate->setp("tva_comment", $this->table->tva_comment); + $tva_rate->setp("tva_both_side", $this->table->tva_both_side); + + // TVA accounting must be joined and separated with a comma + $tva_purchase=(trim($this->table->tva_purchase)=="")?"#":$this->table->tva_purchase; + $tva_sale=(trim($this->table->tva_sale)=="")?"#":$this->table->tva_sale; + $tva_rate->setp("tva_poste", $tva_purchase.",".$tva_sale); + $tva_rate->save(); + + // reload the row + $this->table->set_pk_value($tva_rate->tva_id); + $this->table->load(); + } + /** + * Check data are valid + * 1. tva_rate between 0 & 1 + * 2. label is uniq + * 3. accounting must exist + * @return boolean + */ + function check() + { + $cn=Dossier::connect(); + + // both accounting can not be empty + if (trim($this->table->tva_purchase)==""&&trim($this->table->tva_sale)=="") + { + $this->set_error("tva_purchase", + _("Les 2 postes comptables ne peuvent être nuls")); + $this->set_error("tva_sale", + _("Les 2 postes comptables ne peuvent être nuls")); + } + + // Check the tva rate + if (trim($this->table->tva_rate)==""||isNumber($this->table->tva_rate)==0||$this->table->tva_rate>1) + { + $this->set_error("tva_rate", _("Taux de TVA invalide")); + } + + //Check the label must be unique + $count=$cn->get_value("select count(*) from tva_rate where tva_id<>$1 and lower(tva_label)=lower($2)", + [$this->table->tva_id, $this->table->tva_label]); + if ($count>0) + { + $this->set_error("tva_label", _("Ce nom est déjà utilisé")); + } + + // Check accounting exists for purchase + if (trim($this->table->tva_purchase)!=""&&$this->table->tva_purchase!="#") + { + $count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1", + [$this->table->tva_purchase]); + if ($count==0) + { + $this->set_error("tva_purchase", _("Poste comptable inexistant")); + } + } + // Check accounting exists for sale + if (trim($this->table->tva_sale)!=""&&$this->table->tva_sale!="#") + { + $count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1", + [$this->table->tva_sale]); + if ($count==0) + { + $this->set_error("tva_sale", _("Poste comptable inexistant")); + } + } + + // check if tva_both_side is valid + if ($this->table->tva_both_side!=0&&$this->table->tva_both_side!=1) + { + $this->set_error("tva_both_side", _("Choix incorrect")); + } + + + if ($this->count_error()!=0) + return false; + return true; + } + /** + * delete if not used anywhere + */ + function delete() + { + $cn=Dossier::connect(); + $count_purchase=$cn->get_value("select count(*) from quant_purchase where qp_vat_code = $1",[$this->table->tva_id]); + $count_sale=$cn->get_value("select count(*) from quant_sold where qs_vat_code = $1",[$this->table->tva_id]); + if ( $count_purchase > 0 || $count_sale > 0) { + throw new Exception(_("Effacement interdit : TVA utilisée")); + } + + // Forbid to remove all tva + $count=$cn->get_value("select count(*) from tva_rate"); + if ( $count < 2) { + throw new Exception(_("Vous ne pouvez pas effacer tous les taux. Si votre société n'utilise pas la TVA, changer dans le menu société")); + } + + } + +} diff --git a/include/class/user.class.php b/include/class/user.class.php index 05c5da09d..6fc3b7f6a 100644 --- a/include/class/user.class.php +++ b/include/class/user.class.php @@ -554,6 +554,7 @@ class User * record in audit log * This function works only if user is connected to a Folder * @param string $p_module menu_ref.me_code + * @returns 0 for FORBIDDEN, 1 for GRANTED */ function check_module($p_module) { diff --git a/include/constant.php b/include/constant.php index 9a3153b67..31b88012f 100644 --- a/include/constant.php +++ b/include/constant.php @@ -88,7 +88,7 @@ define ('SMALLX','ⵝ'); define ('BUTTONADD',"✚"); -define ('SVNINFO',6919+8); +define ('SVNINFO',7000); if ( ! defined ('DEBUG')) { define ("DEBUG",false); } @@ -108,9 +108,9 @@ if ( !defined("SITE_UPDATE_PLUGIN")) if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",125); +define ("DBVERSION",128); define ("MONO_DATABASE",25); -define ("DBVERSIONREPO",17); +define ("DBVERSIONREPO",18); define ('NOTFOUND','--not found--'); define ("MAX_COMPTE",4); define ('MAX_ARTICLE',5); @@ -309,5 +309,5 @@ define ('EMAIL_LIMIT',1002); define ('EXC_PARAM_VALUE',1005); define ('EXC_PARAM_TYPE',1006); define ('EXC_DUPLICATE',1200); -define ("PINDG",""); -define ("UNPINDG",""); +define ("UNPINDG",""); +define ("PINDG",""); diff --git a/include/database/tva_rate_sql.class.php b/include/database/tva_rate_sql.class.php new file mode 100644 index 000000000..94e9b0338 --- /dev/null +++ b/include/database/tva_rate_sql.class.php @@ -0,0 +1,70 @@ +table="public.tva_rate"; + $this->primary_key="tva_id"; + /* + * List of columns + */ + $this->name=array( + "tva_id"=>"tva_id" + , "tva_label"=>"tva_label" + , "tva_rate"=>"tva_rate" + , "tva_comment"=>"tva_comment" + , "tva_poste"=>"tva_poste" + , "tva_both_side"=>"tva_both_side" + ); + /* + * Type of columns + */ + $this->type=array( + "tva_id"=>"numeric" + , "tva_label"=>"text" + , "tva_rate"=>"numeric" + , "tva_comment"=>"text" + , "tva_poste"=>"text" + , "tva_both_side"=>"numeric" + ); + + + $this->default=array( + "tva_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} diff --git a/include/database/v_tva_rate_sql.class.php b/include/database/v_tva_rate_sql.class.php new file mode 100644 index 000000000..0bad2214c --- /dev/null +++ b/include/database/v_tva_rate_sql.class.php @@ -0,0 +1,72 @@ +table="public.v_tva_rate"; + $this->primary_key="tva_id"; + /* + * List of columns + */ + $this->name=array( + "tva_id"=>"tva_id" + , "tva_label"=>"tva_label" + , "tva_rate"=>"tva_rate" + , "tva_comment"=>"tva_comment" + , "tva_purchase"=>"tva_purchase" + , "tva_sale"=>"tva_sale" + , "tva_both_side"=>"tva_both_side" + ); + /* + * Type of columns + */ + $this->type=array( + "tva_id"=>"numeric" + , "tva_label"=>"text" + , "tva_rate"=>"numeric" + , "tva_comment"=>"text" + , "tva_purchase"=>"text" + , "tva_sale"=>"text" + , "tva_both_side"=>"numeric" + ); + + + $this->default=array( + "tva_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} \ No newline at end of file diff --git a/include/dossier.inc.php b/include/dossier.inc.php index d754b1a95..4b0865185 100644 --- a/include/dossier.inc.php +++ b/include/dossier.inc.php @@ -54,7 +54,7 @@ if ( isset ($_POST["DATABASE"]) ) $repo=new Database(); try { $dos=$http->post('DATABASE'); - $template=$http->post("FMOD_ID","numnber"); + $template=$http->post("FMOD_ID","number"); } catch (Exception $ex) { echo $ex->getMessage(); return; diff --git a/include/export/export_anc_receipt_pdf.php b/include/export/export_anc_receipt_pdf.php index 9783917f4..d6d6b475b 100644 --- a/include/export/export_anc_receipt_pdf.php +++ b/include/export/export_anc_receipt_pdf.php @@ -23,19 +23,22 @@ if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); - +// unlock session +session_write_close(); /** * export all the selected documents for Ana Accountancy in PDF */ require_once NOALYSS_INCLUDE.'/class/document_export.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; +require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php'; $http=new HttpInput(); $ck = $http->get('ck',"string", 0); if ($ck == 0) { - echo "Aucune sélection"; + echo _("Aucune sélection"); exit(); } $anc=new Document_Export(); - -$anc->export_all($ck); +$task_id=$http->request("task_id"); +$progress=new Progress_Bar($task_id); +$anc->export_all($ck,$progress); diff --git a/include/export/export_balance_pdf.php b/include/export/export_balance_pdf.php index 4879bca99..bc0d4eac7 100644 --- a/include/export/export_balance_pdf.php +++ b/include/export/export_balance_pdf.php @@ -110,11 +110,15 @@ $pPeriode=new Periode($cn); $a=$pPeriode->get_date_limit($from_periode); $b=$pPeriode->get_date_limit($to_periode); $per_text=" du ".$a['p_start']." au ".$b['p_end']; + +// If compare with previous exercice , +// we use the landscape mode if ($previous == 1 ) { $pdf=new PDFLand($cn); } else { $pdf= new PDF($cn); } + $pdf->setDossierInfo(" Balance ".$per_text); $pdf->AliasNbPages(); $pdf->AddPage(); @@ -129,9 +133,9 @@ if ($previous == 1 ){ $pdf->write_cell(20,6,'Solde N-1',0,0,'R'); } $pdf->write_cell(25,6,_('Ouverture'),0,0,'R'); -$pdf->write_cell(25,6,'Total Débit',0,0,'R'); -$pdf->write_cell(25,6,'Total Crédit',0,0,'R'); -$pdf->write_cell(25,6,'Solde Débiteur',0,0,'R'); +$pdf->write_cell(25,6,_('Total Débit'),0,0,'R'); +$pdf->write_cell(25,6,_('Total Crédit'),0,0,'R'); +$pdf->write_cell(25,6,_('Solde Débiteur'),0,0,'R'); $pdf->line_new(); $pdf->SetFont('DejaVuCond','',8); @@ -185,20 +189,19 @@ if (! empty($array)) if ($previous == 1 ) { $delta_previous=bcsub(${'nlvl'.$ind}['solde_cred_previous'],${'nlvl'.$ind}['solde_deb_previous']); $side_previous=($delta_previous < 0) ? "D":"C"; - $pdf->write_cell(30,6,"n-1 : " .nbm($delta_previous)." $side_previous",0,0,'R'); - $pdf->write_cell(30,6," n : ".nbm($delta)." $side",0,0,'R'); + $pdf->write_cell(60,6," ",0,0,'R'); $pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['sum_deb_previous']),0,0,'R'); $pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['sum_cred_previous']),0,0,'R'); - $pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['solde_deb_previous']),0,0,'R'); - $pdf->write_cell(22,6,nbm(${'nlvl'.$ind}['solde_cred_previous']),0,0,'R'); + $pdf->write_cell(22,6,nbm(abs($delta_previous))." $side_previous",0,0,'R'); + } else { $pdf->write_cell(60,6," ",0,0,'R'); - $solde_lv=bcsub(${'nlvl'.$ind}['sum_deb_ope'],${'nlvl'.$ind}['sum_cred_ope']); - $side_lv=($solde_lv<0)?" D":" C"; - $side_lv=($solde_lv==0)?" ":$side_lv; - $pdf->write_cell(25,6,nbm(abs($solde_lv)).$side_lv,0,0,'R'); } + $solde_lv=bcsub(${'nlvl'.$ind}['sum_deb_ope'],${'nlvl'.$ind}['sum_cred_ope']); + $side_lv=($solde_lv<0)?" C":" D"; + $side_lv=($solde_lv==0)?" ":$side_lv; + $pdf->write_cell(25,6,nbm(abs($solde_lv)).$side_lv,0,0,'R'); $pdf->write_cell(25,6,nbm(bcsub(${'nlvl'.$ind}['sum_deb'],${'nlvl'.$ind}['sum_deb_ope'])),0,0,'R'); $pdf->write_cell(25,6,nbm(bcsub(${'nlvl'.$ind}['sum_cred'],${'nlvl'.$ind}['sum_cred_ope'])),0,0,'R'); $solde_lv=bcsub(${'nlvl'.$ind}['solde_deb'],${'nlvl'.$ind}['solde_cred']); @@ -240,8 +243,15 @@ if (! empty($array)) if ($previous == 1 ) { $pdf->write_cell(22,6,nbm($value['sum_deb_previous']),0,0,'R',$fill); $pdf->write_cell(22,6,nbm($value['sum_cred_previous']),0,0,'R',$fill); - $pdf->write_cell(22,6,nbm($value['solde_deb_previous']),0,0,'R',$fill); - $pdf->write_cell(22,6,nbm($value['solde_cred_previous']),0,0,'R',$fill); + +// $pdf->write_cell(22,6,nbm($value['solde_deb_previous']),0,0,'R',$fill); +// $pdf->write_cell(22,6,nbm($value['solde_cred_previous']),0,0,'R',$fill); + $solde_previous=bcsub($value['solde_cred_previous'],$value['solde_deb_previous']); + $side_previous=($solde_previous<0)?" D":" C"; + $side_previous=($solde_previous==0)?"":$side_previous; + + $pdf->write_cell(22,6,nbm(abs($solde_previous)).$side_previous,0,0,'R',$fill); + $tp_deb_previous=bcadd($tp_deb_previous,$value['sum_deb_previous']); $tp_cred_previous=bcadd($tp_cred_previous,$value['sum_cred_previous']); $tp_sold_previous=bcadd($tp_sold_previous,$value['solde_deb_previous']); diff --git a/include/export/export_ledger_csv.php b/include/export/export_ledger_csv.php index 36689fbda..73e8008cd 100644 --- a/include/export/export_ledger_csv.php +++ b/include/export/export_ledger_csv.php @@ -32,6 +32,7 @@ include_once NOALYSS_INCLUDE."/lib/ac_common.php"; require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_ledger_sold.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_ledger_purchase.class.php'; +require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php'; require_once NOALYSS_INCLUDE.'/class/dossier.class.php'; $gDossier=dossier::id(); @@ -83,45 +84,12 @@ global $g_user; */ if ($get_jrn==0) { - // Find periode - $periode=new Periode($cn, $get_from_periode); - $exercice=$periode->get_exercice($get_from_periode); - - if ($g_user->Admin()==0&&$g_user->is_local_admin()==0&&$g_user->get_status_security_ledger() - ==1) - { - $sql="select jrn_def_id - from jrn_def join jrn_type on jrn_def_type=jrn_type_id - join user_sec_jrn on uj_jrn_id=jrn_def_id - where - uj_login=$1 - and uj_priv in ('R','W') - order by jrn_def_name - and ( jrn_enable=1 - or - exists (select 1 from jrn where jr_tech_per in (select p_id from parm_periode where p_exercice=$2)) - "; - $a_jrn=$cn->get_array($sql, array($g_user->login, $exercice)); - } - else - { - $a_jrn=$cn->get_array("select jrn_def_id - from jrn_def join jrn_type on jrn_def_type=jrn_type_id - where - jrn_enable=1 or exists(select 1 from jrn where jr_tech_per in (select p_id from parm_periode where p_exercice=$1)) - order by jrn_def_name - ", [$exercice]); - } - $a=[]; - $nb_jrn=count($a_jrn); - for ($i=0;$i< $nb_jrn;$i++){ - $a[]=$a_jrn[$i]['jrn_def_id']; - } - $a_jrn=$a; + // find out all the available ledgers for the current user + $a_jrn=Print_Ledger::available_ledger($get_from_periode); } else { - $a_jrn=$Jrn->id; + $a_jrn=$get_jrn; } $Jrn=new Acc_Ledger($cn, $get_jrn); @@ -134,7 +102,7 @@ $jrn_type=$Jrn->get_type(); // ODS or all ledgers becomes A // Extended but no FIN becomes L // -if ($get_option=='D'||($jrn_type=='ODS'||$Jrn->id==0)&&$get_option=="E") +if ( $get_option=="E") { if ($jrn_type=='FIN') { @@ -198,9 +166,15 @@ if ($get_option=='D'||($jrn_type=='ODS'||$Jrn->id==0)&&$get_option=="E") //----------------------------------------------------------------------------- if ($get_option=='A') { - - $acc_ledger_history=new Acc_Ledger_History_Generic($cn, $a_jrn, + if ($get_jrn == 0 ) + { + $acc_ledger_history=new Acc_Ledger_History_Generic($cn, $a_jrn, $get_from_periode, $get_to_periode, 'A'); + } else { + $acc_ledger_history=new Acc_Ledger_History_Generic($cn, array($a_jrn), + $get_from_periode, $get_to_periode, 'A'); + + } $acc_ledger_history->export_csv(); exit; } @@ -209,7 +183,7 @@ if ($get_option=='A') // for Misc the amount // For Financial only the tiers and the sign of the amount //----------------------------------------------------------------------------- -if ($get_option=="L") +if ($get_option=="L" || $get_option == 'D') { //----------------------------------------------------- diff --git a/include/export/export_poste_detail_csv.php b/include/export/export_poste_detail_csv.php index 66e15dc5f..a7d019869 100644 --- a/include/export/export_poste_detail_csv.php +++ b/include/export/export_poste_detail_csv.php @@ -75,6 +75,7 @@ if ( ! isset ($_REQUEST['oper_detail'])) continue; $title=array(); + $title[]=_("Date"); $title[]=_("Poste"); $title[]=_("n° pièce"); $title[]=_("Code journal"); @@ -82,7 +83,6 @@ if ( ! isset ($_REQUEST['oper_detail'])) $title[]=_("QuickCode"); $title[]=_("Lib."); $title[]=_("Interne"); - $title[]=_("Date"); $title[]=_("Tiers"); $title[]=_("Description"); $title[]=_("Débit"); @@ -134,6 +134,7 @@ if ( ! isset ($_REQUEST['oper_detail'])) $tot_cred=bcadd($tot_cred,$op['cred_montant']); $diff=bcsub($op['deb_montant'],$op['cred_montant']); $prog=bcadd($prog,$diff); + $export->add($op['j_date_fmt']); $export->add($pos['pcm_val']); $export->add($op['jr_pj_number']); $export->add($op['jrn_def_code']); @@ -141,7 +142,6 @@ if ( ! isset ($_REQUEST['oper_detail'])) $export->add($op['j_qcode']); $export->add($name); $export->add($op['jr_internal']); - $export->add($op['j_date_fmt']); $export->add($tiers); $export->add($op['description']); $export->add($op['deb_montant'],"number"); diff --git a/include/history_operation.inc.php b/include/history_operation.inc.php index 72ae7c0c8..6fb364684 100644 --- a/include/history_operation.inc.php +++ b/include/history_operation.inc.php @@ -77,7 +77,8 @@ $Ledger->id = $p_jrn; //------------------------------ if (isset($_GET ['paid'])) { - $Ledger->update_paid($_GET); + $ledger_paid=new Acc_Ledger($cn,$p_jrn); + $ledger_paid->update_paid($_GET); } diff --git a/include/lib/database.class.php b/include/lib/database.class.php index d217139f4..17a6bac59 100644 --- a/include/lib/database.class.php +++ b/include/lib/database.class.php @@ -385,7 +385,7 @@ class Database function get_version() { - $Res=$this->get_value("select val from version"); + $Res=$this->get_value("select max(val) from version"); return $Res; } diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 31f28b3b8..a90af4d41 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; +require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; // Copyright Author Dany De Bontridder danydb@aevalys.eu @@ -321,6 +322,9 @@ class HtmlInput /** * display a div with the history of the card + * @param int $f_id fiche.f_id + * @param string $p_mesg string to display + * @param int $p_exercice exercice of the history */ static function history_card_button($f_id, $p_mesg,$p_exercice="") { @@ -338,6 +342,10 @@ class HtmlInput /** * display a div with the history of the account + * @param string $p_account accounting + * @param string $p_mesg string to display + * @param string $p_style extra code for HTML + * @param int $p_exercice exercice of the history */ static function history_account($p_account, $p_mesg, $p_style="",$p_exercice="") { @@ -349,6 +357,23 @@ class HtmlInput $p_style, $p_account, dossier::id(),$p_exercice, $p_mesg); return $view_history; } + /** + * display a div with the history of the analytic account + * @param int $p_account po_id + * @param string $p_mesg string to display + * @param string $p_style extra code for HTML + * @param int $p_exercice exercice of the history + */ + static function history_anc_account($p_account, $p_mesg, $p_style="",$p_exercice="") + { + global $g_user; + if ( $p_exercice=="") { + $p_exercice=$g_user->get_exercice(); + } + $view_history=sprintf('%s', + $p_style, $p_account, dossier::id(),$p_exercice, $p_mesg); + return $view_history; + } /** * create a hidden plus button to select the cat of ledger diff --git a/include/lib/ianccard.class.php b/include/lib/ianccard.class.php index 42cbe60b4..c6edf66cb 100644 --- a/include/lib/ianccard.class.php +++ b/include/lib/ianccard.class.php @@ -76,7 +76,7 @@ class IAncCard extends HtmlInput public function input($p_name=null,$p_value=null) { if ( $p_name == null && $this->name == "") - throw (new Exception('Le nom d une icard doit être donne')); + throw (new Exception(_('Le nom d une icard doit être donné'))); $this->value=($p_value==null)?$this->value:$p_value; if ( $this->readOnly==true) return $this->display(); diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php index 9a9bf50a2..057a739e5 100644 --- a/include/lib/icon_action.class.php +++ b/include/lib/icon_action.class.php @@ -126,8 +126,8 @@ class Icon_Action static function close($p_div) { $r=''; - $r.=sprintf('', - $p_div, $p_div); + $r.=sprintf('', + $p_div); return $r; } @@ -153,7 +153,7 @@ class Icon_Action static function zoom($p_div, $p_javascript) { $r=sprintf(' - ⬜', $p_div, $p_javascript); + ', $p_div, $p_javascript); return $r; } diff --git a/include/lib/impress.class.php b/include/lib/impress.class.php index d9f59b6b7..ea413a211 100644 --- a/include/lib/impress.class.php +++ b/include/lib/impress.class.php @@ -251,41 +251,45 @@ class Impress * @param type $aheader double array, each item of the array contains * a key type (num) and a key title */ - static function array_to_csv($array,$aheader,$p_filename) + static function array_to_csv($array, $aheader, $p_filename) { $file_csv=new Noalyss_Csv($p_filename); - for ($i=0;$iadd($aheader[$i]['title']); + $file_csv->add($aheader[$i]['title']); } $file_csv->write(); // fetch all the rows - for ($i=0;$i$value) + foreach ($array[$i] as $key=> $value) { - if ($e > count($aheader)) $e=0; + if ($e>count($aheader)) + continue; - if ( isset ($aheader[$e]['type'])) - { - switch ($aheader[$e]['type']) - { - case 'num': - $file_csv->add($value, "number"); - break; - default: - $file_csv->add($value); - } - } else { - $file->add($value); - } + if (isset($aheader[$e]['type'])) + { + switch ($aheader[$e]['type']) + { + case 'num': + $file_csv->add($value, "number"); + break; + default: + $file_csv->add($value); + } + } + else + { + $file_csv->add($value); + } + $e++; } $file_csv->write(); - $e++; } } + } \ No newline at end of file diff --git a/include/lib/inplace_edit.class.php b/include/lib/inplace_edit.class.php index e807373df..8f892dd2f 100644 --- a/include/lib/inplace_edit.class.php +++ b/include/lib/inplace_edit.class.php @@ -85,7 +85,7 @@ class Inplace_Edit inplace_edit_ok{$this->input->id}.onclick= function () { var json={$this->json}; json['ieaction']='ok'; - json['value']=$({$this->input->id}).value; + json['value']=$('{$this->input->id}').value; new Ajax.Updater('{$this->input->id}edit' ,'{$this->callback}', {parameters: json ,evalScripts:true});} diff --git a/include/lib/inplace_switch.class.php b/include/lib/inplace_switch.class.php index 558ffdaea..8120a8f9e 100644 --- a/include/lib/inplace_switch.class.php +++ b/include/lib/inplace_switch.class.php @@ -55,19 +55,23 @@ class Inplace_Switch function input() { - printf('', $this->name); if ($this->value==1) { - echo $this->iconon; + $icon=$this->iconon; + $color="green"; } elseif ($this->value==0) { - echo $this->iconoff; + $icon=$this->iconoff; + $color="red"; } else { throw new Exception(_("Invalide value")); } + + printf('', $color,$this->name); + echo $icon; echo ''; echo << diff --git a/include/lib/inum.class.php b/include/lib/inum.class.php index 59e01d088..e6375fe41 100644 --- a/include/lib/inum.class.php +++ b/include/lib/inum.class.php @@ -1,4 +1,5 @@ size=9; $this->style='class="inum"'; - $this->javascript= 'onchange="format_number(this,2);"'; + $this->javascript='onchange="format_number(this,2);"'; } - /*!\brief print in html the readonly value of the widget*/ + + /* !\brief print in html the readonly value of the widget */ + public function display() { $readonly=" readonly "; - $this->id=($this->id=="")?$this->name:$this->id; + $this->id=($this->id=="")?$this->name:$this->id; - //$style='style="border:solid 1px blue;color:black;background:#EDEDED;text-align:right"'; $style=' class="inum input_text_ro"'; - $this->value=str_replace('"','',$this->value); + $this->value=str_replace('"', '', $this->value); $r='javascript." $readonly $this->extra >"; + $this->id.'"'. + 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '. + 'SIZE="'.$this->size.'" '.$this->javascript." $readonly $this->extra >"; /* add tag for column if inside a table */ - if ( $this->table == 1 ) $r=''.$r.''; + if ($this->table==1) + $r=''.$r.''; return $r; - } - /*!\brief show the html input of the widget*/ - public function input($p_name=null,$p_value=null) + + /* !\brief show the html input of the widget */ + + public function input($p_name=null, $p_value=null) { - if ( isset ($this->prec)) { - $this->javascript= 'onchange="format_number(this,'.$this->prec.');"'; - } + if (isset($this->prec)) + { + $this->javascript='onchange="format_number(this,'.$this->prec.');"'; + } $this->name=($p_name==null)?$this->name:$p_name; $this->value=($p_value==null)?$this->value:$p_value; - $this->id=($this->id=="")?$this->name:$this->id; + $this->id=($this->id=="")?$this->name:$this->id; - if ( $this->readOnly==true) return $this->display(); + if ($this->readOnly==true) + return $this->display(); - $t= ((isset($this->title)))?'title="'.$this->title.'" ':' '; + $t=((isset($this->title)))?'title="'.$this->title.'" ':' '; $extra=(isset($this->extra))?$this->extra:""; - $this->value=str_replace('"','',$this->value); - if ( ! isset ($this->css_size)) + $this->value=str_replace('"', '', $this->value); + if (!isset($this->css_size)) { - $r='style.' TYPE="TEXT" id="'. - $this->id.'"'.$t. - 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '. - 'SIZE="'.$this->size.'" '.$this->javascript." $this->extra >"; - /* add tag for column if inside a table */ - } else { - $r='style.' TYPE="TEXT" id="'. - $this->id.'"'.$t. - 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '. - ' style="width:'.$this->css_size.';" '.$this->javascript." $this->extra >"; - + $r='style.' TYPE="TEXT" id="'. + $this->id.'"'.$t. + 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '. + 'SIZE="'.$this->size.'" '.$this->javascript." $this->extra >"; + /* add tag for column if inside a table */ + } + else + { + $r='style.' TYPE="TEXT" id="'. + $this->id.'"'.$t. + 'NAME="'.$this->name.'" VALUE="'.$this->value.'" '. + ' style="width:'.$this->css_size.';" '.$this->javascript." $this->extra >"; } - if ( $this->table == 1 ) $r=''.$r.''; + if ($this->table==1) + $r=''.$r.''; return $r; - } } - - diff --git a/include/lib/iperiod.class.php b/include/lib/iperiod.class.php index 6b70d08d5..a4f1b6edd 100644 --- a/include/lib/iperiod.class.php +++ b/include/lib/iperiod.class.php @@ -55,7 +55,8 @@ class IPeriod extends HtmlInput $this->extra2="all"; $this->show_start_date=true; $this->show_end_date=true; - $this->exercice=$p_exercice; + $this->exercice=$p_exercice; + $this->id=$p_name; } /*! * \brief show the input html for a periode @@ -121,7 +122,11 @@ class IPeriod extends HtmlInput $Res=$this->cn->exec_sql($sql); $Max=$this->cn->size($Res); if ( $Max == 0 ) throw new Exception(_('Aucune periode trouvée'),1); - $ret='', + $this->name, + $this->id, + $this->javascript) + ; for ( $i = 0; $i < $Max;$i++) { $l_line=$this->cn->fetch($i); diff --git a/include/lib/iposte.class.php b/include/lib/iposte.class.php index 3bdd0dd42..cb7460f84 100644 --- a/include/lib/iposte.class.php +++ b/include/lib/iposte.class.php @@ -130,7 +130,6 @@ class IPoste extends HtmlInput { $this->id=($this->id=="")?$this->name:$this->id; $javascript='search_poste(this)'; - //$button=HtmlInput::button_image($javascript,$this->id."_bt", 'alt="'._('Recherche').'" class="image_search"',"image/magnifier13.png"); $button=Icon_Action::icon_magnifier($this->id."_bt", $javascript); /* add the property */ $sc=$this->get_js_attr(); diff --git a/include/lib/itva_popup.class.php b/include/lib/itva_popup.class.php index f4731a311..948dddacc 100644 --- a/include/lib/itva_popup.class.php +++ b/include/lib/itva_popup.class.php @@ -54,13 +54,15 @@ class ITva_Popup extends HtmlInput * to have its own javascript for the button you can use this->but_javascript) * by default it is 'popup_select_tva(this)'; */ + private $filter; //!< filter the VAT by ledger PURCHASE or SALE or NO FILTER, default=NO public function __construct($p_name=null,$p_value="",$p_id="") { $this->name=$p_name; $this->button=true; $this->in_table=false; - $this->value=$p_value; - $this->id=$p_id; + $this->value=$p_value; + $this->id=$p_id; + $this->filter='none'; } function with_button($p) { @@ -113,6 +115,18 @@ class ITva_Popup extends HtmlInput return $r; } + /** + * Set a filter to limit the choice of VAT ; + * possible values are : + * - sale if there is an accounting for sale + * - purchase if there is an accounting for purchase + * - none : show VAT + * + */ + function set_filter($p_filter) + { + $this->filter=$p_filter; + } /** *@brief show a button, if it is pushed show a popup to select the need vat *@note @@ -136,6 +150,7 @@ class ITva_Popup extends HtmlInput $bt->set_attribute('jcode',$this->code->name); if ( isset($this->compute)) $bt->set_attribute('compute',$this->compute); + $bt->set_attribute("filter", $this->filter); $bt->javascript=(isset($this->but_javascript))?$this->but_javascript:'popup_select_tva(this)'; $r=$bt->input(); return $r; diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index 9ff6e5719..24daa4b27 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -77,6 +77,7 @@ class Manage_Table_SQL protected $json_parameter; //!< Default parameter to add (gDossier...) protected $aerror; //!< Array containing the error of the input data protected $col_sort; //!< when inserting, it is the column to sort,-1 to disable it and append only + protected $a_info; //!< Array with the infotip const UPDATABLE=1; const VISIBLE=2; @@ -132,6 +133,18 @@ class Manage_Table_SQL function get_col_sort() { return $this->col_sort; } + /** + * Set the info for a column, use Icon_Action::infobulle + * the message are in message_javascript.php + * @param string $p_key Column name + * @param integer $p_comment comment idx + * + * @see message_javascript.php + * @see Icon_Action::infobulle() + */ + function set_col_tips($p_key,$p_comment) { + $this->a_info[$p_key]=$p_comment; + } /** * When adding an element ,we place it thanks the DOM Attribute sort_value * set it to -1 if you want one to append @@ -179,7 +192,13 @@ class Manage_Table_SQL { $this->aerror[$p_col]=$p_message; } - + /** + * returns the nb of errors found + */ + function count_error() + { + return count($this->aerror); + } /** * @brief retrieve the error message * @param $p_col column name @@ -195,8 +214,14 @@ class Manage_Table_SQL /** * This function can be overrided to check the data before - * inserting , updating or removing, above an example of an overidden check - * @see set_error get_error + * inserting , updating or removing, above an example of an overidden check. + * + * Usually , you get the row of the table (get_table) , you check the conditions + * if an condition is not met then you set the error with $this->set_error + * + * if there are error (returns false otherwise true + * + * @see set_error get_error count_error * @return boolean * @code function check() @@ -752,7 +777,14 @@ function check() } else { - echo td($p_row[$v]); + if ( $this->get_col_type($v)=="select") + { + $idx=$p_row[$v]; + echo td($this->a_select[$v][$idx]["label"]); + + }else { + echo td($p_row[$v]); + } } } if ($this->icon_mod=="right") @@ -785,7 +817,12 @@ function check() if ($this->get_property_visible($key)===TRUE) { // Label - echo " {$label} {$error}"; + $info=""; + if ( isset($this->a_info[$key])) { + $info=Icon_Action::infobulle($this->a_info[$key]); + } + // Label + echo " {$label} {$info} {$error}"; if ($this->get_property_updatable($key)==TRUE) { diff --git a/include/lib/message_javascript.php b/include/lib/message_javascript.php index 560cf0687..1d88aec14 100644 --- a/include/lib/message_javascript.php +++ b/include/lib/message_javascript.php @@ -71,5 +71,7 @@ content[39]=""; content[41]=" à zéro pour effacer la ligne")?>"; content[42]=""; - +content[43]=""; +content[44]=""; +content[45]=""; \ No newline at end of file diff --git a/include/lib/progress_bar.class.php b/include/lib/progress_bar.class.php new file mode 100644 index 000000000..f459fc1ea --- /dev/null +++ b/include/lib/progress_bar.class.php @@ -0,0 +1,128 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +/** + * @file + * @brief Manage the progress bar and display it with javascript + * + */ + +/** + * @brief Use one db for tracking progress bar value, the task id must be unique + * and let you follow the progress of a task. + * how it works : when calling an ajax , you have to create the task id and start + * the monitoring of it (js function = progress_bar_start). + * In your php script called by ajax you call Progress_Bar->set_value to show + * the progress. The timer created by progress_bar_start will check regularly the + * progress in the db. + * The ajax parameter for following the task is task_id + * + *@note you have to use session_write_close(); in the ajax file , otherwise, + * the function progress_bar_check will be blocked and won't update the progress + * bar + * + *@see progress_bar_start + *@see progress_bar_check + * + * + */ +class Progress_Bar +{ + private $db ; //!< database connexion + private $task_id ; //! task id (progress_bar.p_id) + private $value; //!< value of progress (between 0 & 100) + /** + * @example progress-bar.test.php test of this class + * @param type $p_task_id + */ + function __construct($p_task_id) + { + $this->db=new Database(); + $this->task_id=$p_task_id; + // Find value from db + $this->value = $this->db->exec_sql("select p_value from progress where p_id=$1", + [$p_task_id]); + + // if task doesn't exists, create it + if ( $this->db->size()==0) + { + $this->value=0; + $this->db->exec_sql("insert into progress(p_id,p_value) values ($1,0)", + [$p_task_id]); + $this->db->exec_sql("delete from progress where p_created < now() - interval '3 hours' "); + } + } + /** + * Store the progress value into the db + * @param integer $p_value value of the progress between 0 & 100 + *@exceptions code 1005 - if p_value is not in between 0 & 100 + */ + function set_value($p_value) + { + if ( $p_value > 100 || $p_value < 0 ) { + throw new Exception("Invalid value",EXC_PARAM_VALUE); + } + $this->value=$p_value; + $this->db->start(); + $this->db->exec_sql("update progress set p_value=$1 where p_id=$2", + [$this->value,$this->task_id]); + $this->db->commit(); + } + /** + * Get the progress value from db + * @return integer between 0 & 100 + */ + function get_value() + { + $this->value = $this->db->get_value("select p_value from progress where p_id=$1", + [$this->task_id]); + + return $this->value; + } + /** + * Json answer of the task progressing + * if value is equal or greater than 100 , delete the row + * @return type + */ + function answer() + { + $this->get_value(); + + header('Content-Type: application/json'); + echo json_encode(["value"=>$this->value]); + if ($this->value>=100) { + $this->db->exec_sql("delete from progress where p_id=$1",[$this->task_id]); + } + return; + } + /** + * increment value with $p_step + * @param int $p_step + */ + function increment($p_step) + { + if ($this->value+$p_step > 100 ) { + $this->set_value(100); + return; + } + $this->set_value($this->value+$p_step); + } +} diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php index 496a49a03..8da1c483f 100644 --- a/include/param_pcmn.inc.php +++ b/include/param_pcmn.inc.php @@ -76,10 +76,9 @@ echo $mtable->display_table(" where pcm_val::text like '{$g_start}%' order by pc */ ?> -