Merge branch 'enterprise' into entreprise

This commit is contained in:
sparkyx 2020-11-17 12:26:10 +01:00
commit 66cdd21f7b
73 changed files with 1065 additions and 277 deletions

View file

@ -19,8 +19,8 @@ div.calendar { position: relative; z-index:13; }
border-radius: 0px;
}
.calendar .nav {
background: #778 url(menuarrow.gif) no-repeat 100% 100%;
.calendar .nav1 {
#background: #778 url(menuarrow.gif) no-repeat 100% 100%;
}
.calendar thead .title { /* This holds the current "month, year" */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before After
Before After

BIN
html/image/logo7400.xcf Normal file

Binary file not shown.

View file

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

View file

@ -79,7 +79,7 @@
</head>
<body>
<p align="center">
<IMG SRC="image/logo7300.png" style="width: 400px;z-index:-1;position:fixed;top:30px;rigth:50px;opacity: 0.2" alt="NOALYSS">
<IMG SRC="image/logo7400.png" style="width: 400px;z-index:-1;position:fixed;top:30px;rigth:50px;opacity: 0.2" alt="NOALYSS">
</p>
<h1>NOALYSS : comptabilité - accountancy </h1>
@ -601,7 +601,7 @@ if ($account == 0 ) {
if ( ! DEBUG) ob_end_clean();
echo '<h1>'._('Important').'</h1>';
echo '<p>'._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'</p>';
echo '<p>',_('Mot de passe'),' phpcompta','</p>';
echo '<p>',_('Mot de passe')," ",NOALYSS_ADMIN_PASSWORD,'</p>';
}// end if
// Add a french accountancy model
//--

View file

@ -879,7 +879,6 @@ function reverseOperation(obj)
{
var qs = $(obj).serialize()+ "&op=ledger";
g('ext' + obj.divname).style.display = 'none';
g('bext' + obj.divname).style.display = 'none';
waiting_box();
new Ajax.Request(
"ajax_misc.php",
@ -1473,4 +1472,44 @@ function reset_filter(p_div) {
// By default , unpaid is uncked
$(p_div+"operation_filter").value="all";
}
/**
* propose to duplicate an operation
*/
function duplicate_operation(p_dossier,p_jr_id) {
waiting_box();
var duplicate_div=create_div({id:"duplicate_operation_div",cssclass:"inner_box"});
new Ajax.Request("ajax_misc.php", {
parameters : {
"op":"ledger",
"gDossier":p_dossier,
"jr_id":p_jr_id,
"act":"duplicateop",
"div":"duplicate_operation_div"
},
onSuccess:function(req) {
remove_waiting_box();
console.debug("success");
var xml=req.responseXML;
console.debug ("received"+xml);
if ( xml.getElementsByTagName("ctl").length==0) {
console.log("erreur"+req.responseText);
}
console.debug("ok we display");
add_div(duplicate_div);
console.debug (getNodeText(xml.getElementsByTagName("code")[0]));
console.debug("fill div");
duplicate_div.setStyle({"position":"fixed","top":"15%","z-index":"999",
"min-width":"30rem",
"left":"30%",
"width":"40%"});
duplicate_div.innerHTML=getNodeText(xml.getElementsByTagName("code")[0]);
duplicate_div.setStyle({display:"block"});
}
}
);
}

View file

@ -663,13 +663,16 @@ function dis_blank_card(obj)
} else {
var dossier=obj.gDossier;
}
var queryString='gDossier='+dossier;
queryString+='&ctl='+content;
queryString+='&fd_id='+fd_id;
queryString+=ref;
queryString+='&op2=bc'; // bc for blank card
queryString+='&op=card'; // bc for blank card
if (obj.after_save) {
queryString+='&after_save='+obj.after_save;
}
if ( obj.elementId) queryString+="&eltid="+obj.elementId;
var action=new Ajax.Request ( 'ajax_misc.php',
{
@ -748,16 +751,42 @@ function save_card(obj)
parameters:queryString,
onFailure:errorFid,
onSuccess:function (req,json) {
var elt=req.responseXML.getElementsByTagName("eltid");
var status=req.responseXML.getElementsByTagName("status");
var status_value='OK';
var after_savetag=req.responseXML.getElementsByTagName("after_save");
var after_save=0;
if ( status.length !=0) {
status_value=getNodeText(status[0]);
}
if ( status_value == 'OK') {
if ( after_savetag.length !=0 ) {
after_save=getNodeText(after_savetag[0]);
}
// if status == OK and after_save == 0
// then update the box
if ( status_value == 'OK' && after_save == 0) {
fill_box(req,json);
}
// if status == OK and after_save == 1
// then add a row to the table
if ( status_value == 'OK' && after_save == 1) {
var table_card=$('fiche_tb_id');
f_id=getNodeText(req.responseXML.getElementsByTagName("f_id")[0]);
var row=new Element('tr');
row.id="row_card"+f_id;
row.innerHTML=getNodeText(req.responseXML.getElementsByTagName("code")[0]);
table_card.tBodies[0].appendChild(row);
new Effect.Highlight(row.id ,{startcolor: '#FAD4D4',endcolor: '#F78082' });
//
if ( table_card.tBodies[0].rows.length % 2 == 0 ) {
row.addClassName("odd");
} else {
row.addClassName("even");
}
}
remove_waiting_box();
if ( elt.length != 0) {
var eltid=getNodeText(elt[0]);
@ -1022,3 +1051,169 @@ function delete_card(obj) {
}
});
}
/**
* Display a card , modify it , redraw the row
* before calling this function , it it neeed to have in the web page a hidden card_gdossier with the dossier id
* @param {type} p_fiche_id
* @returns {undefined}
*/
function modify_card(p_fiche_id)
{
/* window with result */
card_layer++;
var content = 'card_' + card_layer;
var nTop = 170 + card_layer;
if (nTop > 300) {
nTop = 170;
}
var str_top = fixed_position(250, nTop)
var str_style = str_top + ";width:45em;height:auto;position:absolute";
var popup = {'id': content, 'cssclass': 'inner_box', 'style': str_style, 'html': loading(), 'drag': false};
add_div(popup);
/* dossier id */
if ( ! document.getElementById("card_gdossier")) {
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
var dossier = $('card_gdossier').value;
var action = new Ajax.Request('ajax_misc.php',
{
method: 'get',
parameters: {'gDossier':dossier,"op":'card',"op2":"dc","f_id":p_fiche_id,'ctl':content,after_save:2} ,
onFailure: errorFid,
onSuccess: function (respTxt) {
fill_box(respTxt);
}
}
);
}
/**
* Delete a card and remove the row
* before calling this function , it it neeed to have in the web page a hidden card_gdossier with the dossier id
* @param {type} p_fiche_id
* @returns {undefined}
*/
function delete_card_id(p_fiche_id)
{
var row="row_card"+p_fiche_id;
if ( ! document.getElementById("card_gdossier")) {
console.error("card_gdossier error");
throw ("card_gdossier not set");
}
$(row).addClassName("background-selected");
var dossier = $('card_gdossier').value;
smoke.confirm(content[47], function (e) {
if (e) {
waiting_box();
new Ajax.Request("ajax_misc.php", {
"method": "get",
parameters: {'gDossier':dossier,"op":'card',"op2":"rm_card","f_id":p_fiche_id,'ctl':row} ,
onSuccess: function (req) {
remove_waiting_box();
var table_card=$('fiche_tb_id');
var answer = req.responseXML;
var a = answer.getElementsByTagName('ctl');
if (a.length == 0)
{
var rec = req.responseText;
alert_box('erreur :' + rec);
}
var html = answer.getElementsByTagName('code');
var namectl = a[0].firstChild.nodeValue;
var nodeXml = html[0];
var code_html = getNodeText(nodeXml);
code_html = unescape_xml(code_html);
if ((code_html) == "OK") {
Effect.Fade(row, {duration: 0.1});
table_card.tBodies[0].removeChild($(row));
alternate_row_color("fiche_tb_id");
} else {
smoke.alert(code_html);
}
}
});
} else{
$(row).removeClassName("background-selected");
}
});
}
/**
* update a card in ajax , and update a row
*
*/
function card_update_row(obj)
{
try {
var name = obj.id;
var qs = Form.serialize(name) + '&op2=upr&op=card';
var action = new Ajax.Request('ajax_misc.php',
{
method: 'get',
parameters: qs,
onFailure: errorFid,
onSuccess: function (req) {
try {
remove_waiting_box();
var answer = req.responseXML;
var a = answer.getElementsByTagName('ctl');
var html = answer.getElementsByTagName('code');
if (a.length === 0) {
var rec = req.responseText;
alert_box('erreur :' + rec);
}
var name_ctl = "row_card" + obj.f_id.value;
var code_html = getNodeText(html[0]); // Firefox ne prend que les 4096 car.
code_html = unescape_xml(code_html);
if ( document.getElementById(name_ctl)) {
// update the row
$(name_ctl).innerHTML = code_html;
new Effect.Highlight(name_ctl ,{startcolor: '#FAD4D4',endcolor: '#F78082' });
}
$(a[0].firstChild.nodeValue).remove();
} catch (e) {
alert_box(e.message);
if (console) {
console.error(e);
console.error("log answer = " + req.responseText);
}
}
try {
code_html.evalScripts();
} catch (e) {
if (console) {
console.error(e);
console.error("log answer = " + req.responseText);
}
alert_box(content[53] + "\n" + e.message);
}
}
}
);
} catch (e) {
alert_box(e.message);
return false;
}
}

View file

@ -39,7 +39,7 @@ Calendar._SDN = new Array
("Dim",
"Lun",
"Mar",
"Mar",
"Mer",
"Jeu",
"Ven",
"Sam",
@ -48,17 +48,17 @@ Calendar._SDN = new Array
// full month names
Calendar._MN = new Array
("Janvier",
"Février",
"Février",
"Mars",
"Avril",
"Mai",
"Juin",
"Juillet",
"Août",
"Août",
"Septembre",
"Octobre",
"Novembre",
"Décembre");
"Décembre");
// short month names
Calendar._SMN = new Array
@ -83,7 +83,7 @@ Calendar._TT["ABOUT"] =
"DHTML Date/Heure Selecteur\n" +
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
"Pour la derniere version visitez : http://www.dynarch.com/projects/calendar/\n" +
"Distribué par GNU LGPL. Voir http://gnu.org/licenses/lgpl.html pour les details." +
"Distribué par GNU LGPL. Voir http://gnu.org/licenses/lgpl.html pour les details." +
"\n\n" +
"Selection de la date :\n" +
"- Utiliser les bouttons \xab, \xbb pour selectionner l\'annee\n" +
@ -95,13 +95,13 @@ Calendar._TT["ABOUT_TIME"] = "\n\n" +
"- ou Maj-clic pour decrementer\n" +
"- ou clic et glisser-deplacer pour une selection plus rapide";
Calendar._TT["PREV_YEAR"] = "Année préc. (maintenir pour menu)";
Calendar._TT["PREV_MONTH"] = "Mois préc. (maintenir pour menu)";
Calendar._TT["PREV_YEAR"] = "Année préc. (maintenir pour menu)";
Calendar._TT["PREV_MONTH"] = "Mois préc. (maintenir pour menu)";
Calendar._TT["GO_TODAY"] = "Atteindre la date du jour";
Calendar._TT["NEXT_MONTH"] = "Mois suiv. (maintenir pour menu)";
Calendar._TT["NEXT_YEAR"] = "Année suiv. (maintenir pour menu)";
Calendar._TT["SEL_DATE"] = "Sélectionner une date";
Calendar._TT["DRAG_TO_MOVE"] = "Déplacer";
Calendar._TT["NEXT_YEAR"] = "Année suiv. (maintenir pour menu)";
Calendar._TT["SEL_DATE"] = "Sélectionner une date";
Calendar._TT["DRAG_TO_MOVE"] = "Déplacer";
Calendar._TT["PART_TODAY"] = " (Aujourd'hui)";
// the following is to inform that "%s" is to be the first day of week

View file

@ -257,7 +257,8 @@ function set_value(p_ctl, p_value, p_add)
function compute_number(value)
{
var retval = 0;
var exp = new RegExp("^[0-9/*+-.]+$", "g");
var exp = new RegExp("^[0-9/*+-.()]+$", "g");
/*pour éviter un eval() mal intentionné*/
var res = exp.test(value);
if (res)
@ -2971,6 +2972,8 @@ function init_scroll()
up.innerHTML = '<a class="icon" onclick="document.getElementById(\'go_up\').hide()" style="float:right;font-size:70%">&#xe816;</a> <a class="icon" href="#up_top" >&#xe81a;</a><a href="javascript:show_calc()" class="icon">&#xf1ec;</a>';
document.body.appendChild(up);
window.onscroll = function () {
if ( document.getElementById("select_box_content") )
{ document.getElementById("select_box_content").setStyle({display:"none"})};
if (document.viewport.getScrollOffsets().top > 0) {
if ($('go_up').visible() == false) {
$('go_up').setOpacity(0.65);
@ -2981,6 +2984,7 @@ function init_scroll()
$('go_up').hide();
}
}
}
/**
* Confirm a form thanks a modal dialog Box, it returns true if we agree otherwise
@ -3047,28 +3051,21 @@ function alert_box(p_message)
*/
function alternate_row_color(p_table)
{
var len = $(p_table).tBodies[0].rows.length;
var table_colored=$(p_table);
var len = table_colored.tBodies[0].rows.length;
var i = 0;
var localClass = "";
for (i = 1; i < len; i++) {
localClass = (i % 2 == 0) ? "even" : "odd";
if (localClass == "even" && $(p_table).tBodies[0].rows[i].hasClassName("odd"))
if ( table_colored.tBodies[0].rows[i].hasClassName("odd"))
{
$(p_table).tBodies[0].rows[i].removeClassName("odd");
table_colored.tBodies[0].rows[i].removeClassName("odd");
}
if (localClass == "even" && !$(p_table).tBodies[0].rows[i].hasClassName("even"))
if (table_colored.tBodies[0].rows[i].hasClassName("even"))
{
$(p_table).tBodies[0].rows[i].addClassName("even");
}
if (localClass == "odd" && $(p_table).tBodies[0].rows[i].hasClassName("even"))
{
$(p_table).tBodies[0].rows[i].removeClassName("even");
}
if (localClass == "odd" && !$(p_table).tBodies[0].rows[i].hasClassName("odd"))
{
$(p_table).tBodies[0].rows[i].addClassName("odd");
table_colored.tBodies[0].rows[i].removeClassName("even");
}
table_colored.tBodies[0].rows[i].addClassName(localClass);
}
}
@ -3685,4 +3682,4 @@ function toggle_row_warning_enable(p_enable, p_row)
} else {
$(p_row).hide();
}
}
}

View file

@ -28,6 +28,11 @@ require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php';
require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
if ( ! isset ($_SESSION['g_theme']))
{
echo "<h2>"._('Vous êtes déconnecté')."</h2>";
die();
}
html_page_start($_SESSION['g_theme']);
@ -69,7 +74,7 @@ window.onload=function ()
{
create_anchor_up();
init_scroll();
sorttable.init
sorttable.init();
}
</script>
<?php
@ -118,10 +123,17 @@ if ( isset ($_GET['viewsearch']))
/*
* Export to csv
*/
$r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type'));
$r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max',
'qcode','accounting','unpaid','gDossier','ledger_type'));
if (isset($_GET['r_jrn'])) {
foreach ($_GET['r_jrn'] as $k=>$v)
$r.=HtmlInput::hidden('r_jrn['.$k.']',$v);
$http=new HttpInput();
$a_rjrn=$http->get("r_jrn","array");
foreach ($a_rjrn as $k=>$v) {
// Protect : check that $k and $v are numeric
if (isNumber($k)&&isNumber($v)) {
$r.=HtmlInput::hidden('r_jrn['.$k.']',$v);
}
}
}
echo '<form action="export.php" method="get">';
echo $r;

View file

@ -2426,4 +2426,11 @@ span.tab_row {
}
span.title_tab_row {
}
/* Selected row in a table */
.background-selected {
background-color: #000066 !important;
color : white !important;
}

View file

@ -1539,6 +1539,7 @@ div.box {
float:left;
font-size:14px;
font-size:0.90rem;
border-radius:5px;
}
@media only screen and (max-width: 1426px) {
div.box {
@ -2465,4 +2466,10 @@ span.title_tab_row {
background-color: darkblue;
color:white;
padding : 3px;
}
}
/* Selected row in a table */
.background-selected {
background-color: #000066 !important;
color : white !important;
}

View file

@ -2359,4 +2359,10 @@ span.title_tab_row {
color:white;
padding : 3px;
}
/* Selected row in a table */
.background-selected {
background-color: #000066 !important;
color : white !important;
}

View file

@ -129,7 +129,7 @@ if ( $User->admin == 0 || (defined("MULTI")&& MULTI == 0 ) )
$folder=$User->get_available_folder();
if ( $folder != null && count($folder) == 1 )
{
echo _("Si la redirection ne fonctionne pas, vous devez changer la valeur de NOALYSS_URL ");
redirect(NOALYSS_URL.'/do.php?gDossier='.$folder[0]['dos_id']);
exit();
}

View file

@ -149,7 +149,7 @@ if ($sub_action == "update")
$act->get();
$act->fromArray($_POST);
$error_id=$e->getCode();
record_log($e->getTraceAsString());
record_log($e);
}
}
//----------------------------------------------------------------------
@ -296,7 +296,7 @@ if ($sub_action == "save_action_st2")
echo '</span>';
$sub_action="add_action";
$error_id=$e->getCode();
record_log($e->getTraceAsString());
record_log($e);
}
}
//--------------------------------------------------------------------------------

View file

@ -77,7 +77,7 @@ foreach ($var as $v)
$cont=1;
}
}
extract($_REQUEST, EXTR_SKIP );
extract($_REQUEST, EXTR_SKIP );
if ( $cont != 0 ) exit();
@ -118,7 +118,7 @@ case 'rmfa':
{
$cn->rollback();
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
echo $e->getMessage();
}
$html=ob_get_contents();
@ -132,6 +132,29 @@ case 'dc':
$f=new Fiche($cn);
/* add title + close */
$html=HtmlInput::title_box(_("Détail fiche"), $ctl,"close","","y");
// if there is no qcode then try to find it thanks the card id
if ( ! isset ($qcode) ){
$f->id=$http->get("f_id","number");
$qcode=$f->get_quick_code();
}
// after save , we can either show a card in readonly or update a row
$safter_save=$http->request("after_save","string","1");
switch ($safter_save)
{
case "1":
// show a card it readonly and fade it
$after_save="update_card(this)";
break;
case "2":
// update a row in the table X
$after_save="card_update_row(this)";
break;
default:
break;
}
if ( $qcode != '')
{
$f->get_by_qcode($qcode);
@ -153,7 +176,7 @@ case 'dc':
if ($can_modify==1)
{
$html.='<form id="form_'.$ctl.'" method="get" onsubmit="update_card(this);return false;">';
$html.='<form id="form_'.$ctl.'" method="get" onsubmit="'.$after_save.';return false;">';
$html.=dossier::hidden();
$html.=HtmlInput::hidden('f_id',$f->id);
$html.=HtmlInput::hidden('ctl',$ctl);
@ -207,6 +230,9 @@ case 'bc':
if ( isset ($eltid)) {
$r.=HtmlInput::hidden("eltid", $eltid);
}
// Action after save = 0, the card is display one second and fade out
$after_save=$http->get("after_save","number",0);
$r.=HtmlInput::hidden("after_save",$after_save);
$r.='</form>';
$html=$r;
}
@ -336,7 +362,7 @@ return;
*
----------------------------------------------------------------------*/
case 'sc':
$html=HtmlInput::title_box(_("Choix de la catégorie"), $ctl);
if ( $g_user->check_action(FICADD)==1 )
{
$f=new Fiche($cn);
@ -344,19 +370,46 @@ case 'sc':
try {
$f->insert($fd_id,$_POST);
$f->Get();
$html.='<h2 class="notice">'._('Fiche sauvée').'</h2>';
$html.=$f->Display(true);
$js="";
if ( isset( $_POST['ref'])) $js=create_script(' window.location.reload()');
$html.=$js;
if ( isset ($eltid)) {
// after adding a new card, we update some field
$extra="<eltid>$eltid</eltid>".
"<elt_value>{$f->get_quick_code ()}</elt_value>";
$after_save=$http->post("after_save","number",0);
// Action after save = 0, the card is display one second and fade out
//
if ( $after_save == 0 ) {
$html=HtmlInput::title_box(_("Choix de la catégorie"), $ctl);
$html.='<h2 class="notice">'._('Fiche sauvée').'</h2>';
$html.=$f->Display(true);
$js="";
if ( isset( $_POST['ref'])) $js=create_script(' window.location.reload()');
$html.=$js;
if ( isset ($eltid)) {
// after adding a new card, we update some field
$extra="<eltid>$eltid</eltid>".
"<elt_value>{$f->get_quick_code ()}</elt_value>";
}
$extra.=$status;
$extra.="<after_save>0</after_save>";
}
// Action after save = 1 ; after adding a card the table must be updated
// see fiche.inc.php
//
if ( $after_save == 1 ){
$f_id=$f->id;
ob_start();
$detail=Icon_Action::modify("mod".$f_id, sprintf("modify_card('%s')",$f_id)).
"&nbsp;".
Icon_Action::trash("del".$f_id, sprintf("delete_card_id('%s')",$f_id));
$html = td($detail);
$html .= $f->display_row();
$html.=ob_get_contents();
ob_clean();
$extra="<f_id>".$f_id."</f_id>";
$ctl="row_card".$f_id;
$extra.="<after_save>1</after_save>";
}
$extra.=$status;
$html.=HtmlInput::button_close($ctl);
} catch (Exception $exc) {
$html="<h2 class=\"error\">"._("Erreur sauvegarde")."</h2>";
$html.=$exc->getMessage();
@ -592,6 +645,9 @@ case 'scc':
$ctl="info_div";
}
break;
// Update a card and then display the result
// in a readonly box
case 'upc':
$html=HtmlInput::title_box("Détail fiche", $ctl);
@ -619,17 +675,52 @@ case 'upc':
}
}
break;
//------------------------------------------------------------------
// Unlink a card
//------------------------------------------------------------------
case 'rm_card':
$html=HtmlInput::title_box("Détail fiche", $ctl);
// Update a card and then display the result
// in the table
case 'upr':
$f_id=$http->get("f_id","number");
$html="";
if ( $g_user->check_action(FICADD)==0 )
{
$html.=alert(_('Action interdite'),true);
}
else
{
if ($cn->get_value('select count(*) from fiche where f_id=$1',array($f_id)) == '0' )
{
$html.=alert(_('Fiche non valide'),true);
}
if ( $g_user->check_action(FIC)==0 )
else
{
$f=new Fiche($cn,$f_id );
ob_start();
$f->update($_GET);
$detail=Icon_Action::modify("mod".$f_id, sprintf("modify_card('%s')",$f_id)).
"&nbsp;".
Icon_Action::trash("del".$f_id, sprintf("delete_card_id('%s')",$f_id));
$html.=td($detail);
$html.=$f->display_row();
$html.=ob_get_contents();
ob_end_clean();
}
}
break;
//------------------------------------------------------------------
// Unlink a card
//------------------------------------------------------------------
case 'rm_card':
$html=HtmlInput::title_box("Détail fiche", $ctl);
if ( $g_user->check_action(FIC)==0 )
{
$html.=alert(_('Action interdite'),true);
}
else
else
{
if ($cn->get_value('select count(*) from fiche where f_id=$1',array($_GET['f_id'])) == '0' )
{

View file

@ -38,7 +38,7 @@ try {
}catch (Exception $e )
{
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
return;
}

View file

@ -161,7 +161,7 @@ case 'rmop':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$e->getMessage();
$cn->rollback();
}
@ -207,7 +207,7 @@ case 'de':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo Icon_Action::close($div);
echo '<h2 class="error">'._("Désolé il y a une erreur").'</h2>';
}
@ -512,7 +512,7 @@ case 'save':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
if ( DEBUG ) echo $e->getMessage();
alert(_( "Changement impossible: on ne peut pas changer la date dans une période fermée"));
}
@ -570,13 +570,29 @@ case 'reverseop':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo $e->getMessage();
$cn->rollback();
}
}
$html=ob_get_contents();
ob_end_clean();
break;
case 'duplicateop':
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Duplicate operation
///////////////////////////////////////////////////////////////////////////////////////////////////////////
$operation=new Acc_Operation($cn);
$operation->jr_id=$jr_id;
ob_start();
echo HtmlInput::title_box(_("Dupliquer une opération"), $div);
echo $operation->form_clone_operation("cloneit");
$html=ob_get_contents();
ob_end_clean();
break;
}
$html=escape_xml($html);

View file

@ -205,7 +205,7 @@ switch ($act)
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$html=$e->getTrace();
throw $e;
}

View file

@ -42,7 +42,7 @@ try
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
return;
}

View file

@ -56,7 +56,7 @@ switch ($op)
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo span($e->getMessage(), ' class="notice"');
Anc_Key::display_list();
Anc_Key::key_add();

View file

@ -145,8 +145,8 @@ if ($sa=="pa_detail")
$accounting->add_json_param("pa_id", $pa_id);
$accounting->set_sort_column("po_name");
ob_start();
$accounting->display_table(" where pa_id = $1 order by po_name ",array($pa_id));
$accounting->create_js_script();
$accounting->display_table(" where pa_id = $1 order by po_name ",array($pa_id));
$ret.=ob_get_clean();
$ret.= '</div>';
}

View file

@ -56,7 +56,7 @@ if ( isset($_POST['save']))
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
alert($e->getMessage());
$cn->rollback();
}

View file

@ -62,7 +62,7 @@ if ( $action_frm == 'update')
} catch (Exception $e)
{
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
alert($e->getMessage());
}
}
@ -88,7 +88,7 @@ if ($action_frm == 'delete' )
catch (Exception $e)
{
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
alert ($e->getMessage());
}
@ -111,7 +111,7 @@ if (isset($_POST['add']))
catch (Exception $e)
{
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
alert($e->getMessage());
}
}
@ -146,7 +146,7 @@ switch ($sa)
catch (Exception $e)
{
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
alert($e->getMessage());
}
break;

View file

@ -284,7 +284,7 @@ class Acc_Bilan
}
catch(Exception $Ex)
{
record_log($e->getTraceAsString());
record_log($e);
echo $Ex->getMessage();
throw $Ex;
}

View file

@ -389,7 +389,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$this->db->rollback();
throw $e;
}
@ -869,7 +869,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
if ($e->getCode()==1)
{
echo _("Aucune période ouverte");
@ -1503,7 +1503,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$this->db->rollback();
echo _('OPERATION ANNULEE ');
echo '<hr>';
@ -2307,7 +2307,7 @@ class Acc_Ledger extends jrn_def_sql
catch (Exception $e)
{
$cn->rollback();
record_log($e->getTraceAsString());
record_log($e);
}
$cn->commit();
}
@ -2576,7 +2576,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
throw $e;
}
}
@ -2608,22 +2608,17 @@ class Acc_Ledger extends jrn_def_sql
switch ($this->jrn_def_type)
{
case 'ACH':
$this->jrn_def_fiche_cred=(isset($ACH_FICHECRED))?join($ACH_FICHECRED,
','):'';
$this->jrn_def_fiche_deb=(isset($ACH_FICHEDEB))?join($ACH_FICHEDEB,
','):"";
$this->jrn_def_fiche_cred=(isset($ACH_FICHECRED))?join(',',$ACH_FICHECRED):'';
$this->jrn_def_fiche_deb=(isset($ACH_FICHEDEB))?join(',',$ACH_FICHEDEB):"";
break;
case 'VEN':
$this->jrn_def_fiche_cred=(isset($VEN_FICHECRED))?join($VEN_FICHECRED,
','):'';
$this->jrn_def_fiche_deb=(isset($VEN_FICHEDEB))?join($VEN_FICHEDEB,
','):"";
$this->jrn_def_fiche_cred=(isset($VEN_FICHECRED))?join(',',$VEN_FICHECRED):'';
$this->jrn_def_fiche_deb=(isset($VEN_FICHEDEB))?join(',',$VEN_FICHEDEB):"";
break;
case 'ODS':
$this->jrn_def_class_deb=$p_jrn_class_deb;
$this->jrn_def_fiche_deb=(isset($ODS_FICHEDEB))?join($ODS_FICHEDEB,
','):''; ;
$this->jrn_def_fiche_deb=(isset($ODS_FICHEDEB))?join(',',$ODS_FICHEDEB):''; ;
$this->jrn_def_fiche_cred=null;
break;
@ -2632,8 +2627,7 @@ class Acc_Ledger extends jrn_def_sql
$result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])), false);
$bank=$a->id;
$this->jrn_def_bank=$bank;
$this->jrn_def_fiche_deb=(isset($FIN_FICHEDEB))?join($FIN_FICHEDEB,
','):"";
$this->jrn_def_fiche_deb=(isset($FIN_FICHEDEB))?join(',',$FIN_FICHEDEB):"";
if ($result==-1)
throw new Exception(_("Aucun compte en banque n'est donné"));
$this->jrn_def_num_op=(isset($numb_operation))?1:0;
@ -2812,22 +2806,17 @@ class Acc_Ledger extends jrn_def_sql
switch ($this->jrn_def_type)
{
case 'ACH':
$this->jrn_def_fiche_cred=(isset($ACH_FICHECRED))?join($ACH_FICHECRED,
','):'';
$this->jrn_def_fiche_deb=(isset($ACH_FICHEDEB))?join($ACH_FICHEDEB,
','):"";
$this->jrn_def_fiche_cred=(isset($ACH_FICHECRED))?join(',',$ACH_FICHECRED):'';
$this->jrn_def_fiche_deb=(isset($ACH_FICHEDEB))?join(',',$ACH_FICHEDEB):"";
break;
case 'VEN':
$this->jrn_def_fiche_cred=(isset($VEN_FICHECRED))?join($VEN_FICHECRED,
','):'';
$this->jrn_def_fiche_deb=(isset($VEN_FICHEDEB))?join($VEN_FICHEDEB,
','):"";
$this->jrn_def_fiche_cred=(isset($VEN_FICHECRED))?join(',',$VEN_FICHECRED):'';
$this->jrn_def_fiche_deb=(isset($VEN_FICHEDEB))?join(',',$VEN_FICHEDEB):"";
break;
case 'ODS':
$this->jrn_def_class_deb=$p_jrn_class_deb;
$this->jrn_def_fiche_deb=(isset($ODS_FICHEDEB))?join($ODS_FICHEDEB,
','):''; ;
$this->jrn_def_fiche_deb=(isset($ODS_FICHEDEB))?join(',',$ODS_FICHEDEB):''; ;
$this->jrn_def_fiche_cred=null;
break;
case 'FIN':
@ -2835,8 +2824,7 @@ class Acc_Ledger extends jrn_def_sql
$result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])), false);
$bank=$a->id;
$this->jrn_def_bank=$bank;
$this->jrn_def_fiche_deb=(isset($FIN_FICHEDEB))?join($FIN_FICHEDEB,
','):"";
$this->jrn_def_fiche_deb=(isset($FIN_FICHEDEB))?join(',',$FIN_FICHEDEB):"";
if ($result==-1)
throw new Exception(_("Aucun compte en banque n'est donné"));
$this->jrn_def_num_op=(isset($numb_operation))?1:0;
@ -2862,7 +2850,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
throw $e;
}
}

View file

@ -1076,7 +1076,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
__FILE__ . ':' . __LINE__ . ' ' .
$e->getMessage();
$this->db->rollback();
record_log($e->getTraceAsString());
record_log($e);
throw new Exception($r);
}
$this->db->commit();

View file

@ -417,7 +417,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History
function get_rowSimple($trunc=0, $p_limit=-1, $p_offset=-1)
{
global $g_user;
$jrn=" jrn_def_id in (".join($this->ma_ledger, ",").")";
$jrn=" jrn_def_id in (".join(',',$this->ma_ledger).")";
$periode=sql_filter_per($this->db, $this->m_from, $this->m_to, 'p_id',
'jr_tech_per');

View file

@ -63,7 +63,7 @@ class Acc_Ledger_Info
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo "Echec sauvegarde info additionnelles";
throw $e;
}
@ -86,7 +86,7 @@ class Acc_Ledger_Info
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$this->cn->rollback();
echo "Echec sauvegarde info additionnelles";
throw $e;

View file

@ -49,10 +49,12 @@ require_once NOALYSS_INCLUDE.'/class/stock_goods.class.php';
*/
class Acc_Ledger_Purchase extends Acc_Ledger
{
private $payment_operation; /*<! id of the payment , set in insert */
function __construct ($p_cn,$p_init)
{
$this->ledger_type='ACH';
parent::__construct($p_cn,$p_init);
$this->payment_operation=-1;
}
/*!\brief verify that the data are correct before inserting or confirming
*\param an array (usually $_POST)
@ -960,7 +962,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$acc_pay->grpt=$acseq;
$acc_pay->jrn=$mp->get_parameter('ledger_target');
$acc_pay->periode=$tperiode;
$acc_pay->type=($famount>=0)?'c':'d';
$acc_pay->type=($famount>=0)?'c':'d';
$acc_pay->insert_jrnx();
/* Insert supplier */
@ -996,6 +998,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
// insert into the table JRN
$mp_jr_id=$acc_pay->insert_jrn();
$this->payment_operation=$mp_jr_id;
$acjrn->grpt_id=$acseq;
$acjrn->update_internal_code($acinternal);
// add an automatic PJ if ODS
@ -1038,7 +1041,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}//end try
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo '<span class="error">'.
'Erreur dans l\'enregistrement '.
__FILE__.':'.__LINE__.' '.
@ -1146,7 +1149,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
if ($e->getCode() == 1 )
{
throw new Exception( _("Aucune période ouverte"));
@ -1855,19 +1858,30 @@ EOF;
*/
if ( $e_mp!=0 && strlen (trim (${'e_mp_qcode_'.$e_mp})) != 0 )
{
$r.="<p>";
$r.=HtmlInput::hidden('e_mp_qcode_'.$e_mp,${'e_mp_qcode_'.$e_mp});
$r.=HtmlInput::hidden('acompte',$acompte);
$r.=HtmlInput::hidden('e_comm_paiement',$e_comm_paiement);
$r.=HtmlInput::hidden('mp_date',$mp_date);
$r.=HtmlInput::hidden('e_comm_paiement',$e_comm_paiement);
$r.=HtmlInput::hidden('mp_date',$mp_date);
/* needed for generating a invoice */
$r.=HtmlInput::hidden('qcode_benef', ${'e_mp_qcode_' . $e_mp});
$fname = new Fiche($this->db);
$fname->get_by_qcode(${'e_mp_qcode_' . $e_mp});
$detail_payment="";
// payment operation
if ($this->payment_operation != 1) {
$pay_internal=$this->db->get_value("select jr_internal from jrn where jr_id=$1",
[$this->payment_operation]);
$detail_payment=HtmlInput::detail_op($this->payment_operation,$pay_internal);
}
$r.='<h2>' . _("Payé par")." " . ${'e_mp_qcode_' . $e_mp} .
" " . $fname->getName() . '</h2> ' . '<p class="decale">' . _('Déduction acompte ') . h($acompte) . '</p>' .
" " . $fname->getName() .$detail_payment. '</h2> ' ;
$r.='<p class="decale">' . _('Déduction acompte ') . h($acompte) . '</p>' .
_('Libellé :') . h($e_comm_paiement) ;
$r.='<br>';
$r.='<br>';
$r.="</p>";
}
// check for upload piece
/*

View file

@ -716,8 +716,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
}
}
} catch (Exception $e) {
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
echo '<span class="error">' .
'Erreur dans l\'enregistrement ' .
__FILE__ . ':' . __LINE__ . ' ' .

View file

@ -609,8 +609,8 @@ class Acc_Operation
$ret=new Acc_Fin($this->db,$this->jr_id);
break;
default:
$ret=new Acc_Misc($this->db,$this->jr_id);
break;
$ret=new Acc_Misc($this->db,$this->jr_id);
break;
}
$ret->get();
if ( empty($ret->det->array))
@ -747,6 +747,71 @@ class Acc_Operation
$type_operation->selected=$p_status;
return $type_operation;
}
/**
* create a form to recreate the operation and returns it, just like a correct
*
*/
function form_clone_operation($p_id) {
// retrieve all info about operation
$operation = $this->get_quant();
$array=$operation->compute_array();
global $g_user;
// Prepare the form
$r='<form id="'.$p_id.'" method="POST">';
$r.=Dossier::hidden();
$a_code=$this->db->get_array("select code from v_menu_dependency vmd where me_code=$1 and p_id=$2",
array( $operation->signature,$g_user->get_profile()));
// select the menu where the operation will be duplicated
if ( empty ($a_code)) {
$r.=_("Menu invalide");
return $r;
}
$r.="<p>";
$r.="<ul style=\"margin-left:2rem;padding-left:0;list-style:none;\">";
$r.=sprintf("<li>%s</li>",$operation->det->jr_pj_number);
$r.=sprintf("<li>%s</li>",$operation->det->jr_comment);
$r.=sprintf("<li>%s</li>",$operation->det->jr_montant);
$r.="</ul>";
$r.="</p>";
if (count($a_code) == 1 ) {
$r.=HtmlInput::hidden("ac",$a_code[0]['code']);
$r.=sprintf(_("Voulez-vous aller à %s pour dupliquer cette opération ?"),$a_code[0]['code']);
} else {
$select=new ISelect("ac");
$select->value=array();
$nb_code=count($a_code);
for ($i=0;$i<$nb_code;$i++) {
$select->value[]=array("label"=>$a_code[$i]['code'],"value"=>$a_code[$i]['code']);
}
$r.=sprintf(_("Voulez-vous aller à %s pour dupliquer cette opération ?"),$select->input());
}
$r.="</p>";
// For Misc Operation , if a card is given then there is no accounting
if ( $operation->signature==="ODS") {
$nb_array=count($array);
for ($i=0;$i<$nb_array;$i++) {
if (isset ($array["qc_".$i] ) && $array["qc_".$i] != "" ) {
$array["poste".$i]="";
}
}
}
// transform the operation into hidden element
$r.=HtmlInput::simple_array_to_hidden($array);
$r.=HtmlInput::submit(uniqid(), _("Dupliquer"));
$r.='</form>';
// return the form as a string
return $r;
}
}
/////////////////////////////////////////////////////////////////////////////
@ -779,6 +844,19 @@ class Acc_Detail extends Acc_Operation
$this->det->note=$this->db->get_value($sql,array($this->jr_id));
$this->det->note=strip_tags($this->det->note);
}
/**
*
*/
function compute_array()
{
$array=array();
$array['desc']=$this->det->jr_comment;
$array['e_date']="";
$array['e_ech']="";
$array['p_jrn']=$this->det->jr_def_id;
return $array;
}
}
/////////////////////////////////////////////////////////////////////////////
/**
@ -805,6 +883,30 @@ class Acc_Misc extends Acc_Detail
FROM jrnx where j_grpt = $1 order by j_debit desc,j_poste";
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
}
/***
* Compute an array for using with Acc_Ledger::insert
*
*/
function compute_array()
{
$this->get();
$array=parent::compute_array();
$nb_array=count($this->det->array);
$array['nb_item']=$nb_array;
for ($i=0;$i<$nb_array;$i++) {
$array["qc_".$i]=$this->det->array[$i]['j_qcode'];
$array["poste".$i]=$this->det->array[$i]['j_poste'];
$array["amount".$i]=$this->det->array[$i]['j_montant'];
if ( $this->det->array[$i]['j_debit'] == 't') {
$array["ck".$i]=1;
}
$array["ld".$i]=$this->det->array[$i]['j_text'];
}
return $array;
}
}
/////////////////////////////////////////////////////////////////////////////
/**
@ -828,6 +930,35 @@ class Acc_Sold extends Acc_Detail
FROM quant_sold join jrnx using(j_id) where j_grpt=$1";
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
}
/***
* Compute an array for using with Acc_Ledger::insert
*
*/
function compute_array()
{
$this->get();
$array=parent::compute_array();
$nb_array=count($this->det->array);
$array['nb_item']=$nb_array;
$array["e_client"]=$this->db->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=23",
array($this->det->array[0]['qs_client']));
for ($i=0;$i<$nb_array;$i++) {
$array["e_march".$i]=$this->db->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=23",
array($this->det->array[$i]['qs_fiche']));
$array["e_march".$i."_price"]=$this->det->array[$i]['qs_unit'];
$array["e_march".$i."_label"]=$this->det->array[$i]['j_text'];
$array["e_march".$i."_tva_id"]=$this->det->array[$i]['qs_vat_code'];
$array["e_march".$i."_tva_amount"]=$this->det->array[$i]['qs_vat'];
$array["e_quant".$i]=$this->det->array[$i]['qs_quantite'];
}
$array['correct']=1;
return $array;
}
}
/////////////////////////////////////////////////////////////////////////////
@ -854,6 +985,37 @@ class Acc_Purchase extends Acc_Detail
FROM quant_purchase join jrnx using(j_id) where j_grpt=$1";
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
}
/***
* Compute an array for using with Acc_Ledger::insert
*
*/
function compute_array()
{
$this->get();
$array=parent::compute_array();
$nb_array=count($this->det->array);
$array['nb_item']=$nb_array;
$array["e_client"]=$this->db->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=23",
array($this->det->array[0]['qp_supplier']));
for ($i=0;$i<$nb_array;$i++) {
$array["e_march".$i]=$this->db->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=23",
array($this->det->array[$i]['qp_fiche']));
$array["e_march".$i."_price"]=$this->det->array[$i]['qp_unit'];
$array["e_march".$i."_label"]=$this->det->array[$i]['j_text'];
$array["e_march".$i."_tva_id"]=$this->det->array[$i]['qp_vat_code'];
$array["e_march".$i."_tva_amount"]=$this->det->array[$i]['qp_vat'];
$array["e_quant".$i]=$this->det->array[$i]['qp_quantite'];
}
$array['correct']=1;
return $array;
}
}
/////////////////////////////////////////////////////////////////////////////
/**
@ -876,4 +1038,27 @@ class Acc_Fin extends Acc_Detail
FROM quant_fin where jr_id = $1";
$this->det->array=$this->db->get_array($sql,array($this->jr_id));
}
/***
* Compute an array for using with Acc_Ledger::insert
*
*/
function compute_array()
{
$this->get();
$array=parent::compute_array();
$nb_array=count($this->det->array);
$array['nb_item']=$nb_array;
for ($i=0;$i<$nb_array;$i++) {
$array["e_other".$i]=$this->db->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=23",
array($this->det->array[$i]['qf_other']));
$array["e_other".$i."_amount"]=$this->det->array[$i]['qf_amount'];
$array["e_other".$i."_comment"]=$this->det->jr_comment;
}
$array['correct']=1;
return $array;
}
}

View file

@ -216,7 +216,7 @@ class Acc_Report
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$this->db->rollback();
echo $e->getMessage();
}
@ -258,7 +258,7 @@ class Acc_Report
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$this->db->rollback();
echo $e->getMessage();
}

View file

@ -74,7 +74,7 @@ class Anc_Account_Table extends Manage_Table_SQL
$table->po_name=str_replace(">", '', $table->po_name);
// po_name must be uniq in the Analytic Plan
if ( $cn->get_value("select count(*) from poste_analytique where pa_id=$1 and po_name=$2 and po_id != $3",
if ( $cn->get_value("select count(*) from poste_analytique where pa_id=$1 and po_name=upper($2) and po_id != $3",
array($table->pa_id,$table->po_name,$table->po_id)) > 0)
{
$is_error++;
@ -90,4 +90,36 @@ class Anc_Account_Table extends Manage_Table_SQL
if ($is_error==0)return TRUE;
return FALSE;
}
/**
* @brief display a data row in the table, with the order defined
* in a_order and depending of the visibility of the column
*/
function display_row($p_row)
{
$cn=Dossier::connect();
$count=$cn->get_value("select count(*) from public.operation_analytique where po_id=$1",[$p_row["po_id"]]);
$p_row["po_name"]=sprintf("%s (%d)",$p_row['po_name'],$count);
parent::display_row($p_row);
}
/**
* Before deleting , we check that nothing is in a closed periode
*/
function delete() {
$cn=Dossier::connect();
$count_closed=$cn->get_value(" select count(*)
from jrnx as jx1
join jrn jn1 on (jx1.j_grpt = jn1.jr_grpt_id )
join jrn_def as jf1 on (jn1.jr_def_id =jf1.jrn_def_id )
join jrn_periode as je1 on (jf1.jrn_def_id =je1.jrn_def_id )
join operation_analytique as oa on (oa.j_id =jx1.j_id )
where
je1.status = 'CL' and oa.po_id=$1 ",[$this->table->po_id]);
if ( $count_closed > 0 ) {
throw new \Exception(_("Effacement impossible : le poste est utilisé dans une période fermée"));
}
}
}

View file

@ -74,7 +74,7 @@ class Anc_Group_Operation
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo $e->getTrace();
$this->db->rollback();
throw new Exception($e);
@ -260,7 +260,7 @@ class Anc_Group_Operation
}
catch (Exception $ex)
{
record_log($e->getTraceAsString());
record_log($e);
echo '<span class="error">'.
'Erreur dans l\'enregistrement '.
__FILE__.':'.__LINE__.' '.

View file

@ -268,7 +268,7 @@ class Anc_Key
{
if ( DEBUG ) { echo $e->getTraceAsString(); } else { echo _('erreur').$e->getMessage();}
record_log($e->getTraceAsString());
record_log($e);
$cn->rollback();
}
}

View file

@ -505,7 +505,7 @@ class Anc_Operation
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
}
}
/*!\brief display the form for PA

View file

@ -89,7 +89,7 @@ class Database extends DatabaseCore
$r = pg_fetch_array($ret, 0);
$old_oid = $r['jr_pj'];
if (strlen($old_oid) != 0)
pg_lo_unlink($cn, $old_oid);
$this->lo_unlink( $old_oid);
}
// Load new document
$this->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2,
@ -115,7 +115,7 @@ class Database extends DatabaseCore
/**
* \brief loop to apply all the path to a folder or a template
* Upgrade check if the folder $p_name needs to be upgrade thanks the variable DBVERSION
* and run all the SQL script named upgradeX.sql from the folder noalyss/include/sql/patch
* and run all the SQL script named upgradeX.sql from the folder noalyss/include/sql/patch
* until X equal DBVERSION-1
*
* \param $p_name database name
@ -226,7 +226,7 @@ class Database extends DatabaseCore
if (!DEBUG)
ob_end_clean();
}
}
echo '</ul>';
@ -253,4 +253,4 @@ class Database extends DatabaseCore
}
return $sys_name;
}
}
}

View file

@ -106,7 +106,7 @@ class Default_Menu
}
} catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo $e->getMessage();
throw $e;
}

View file

@ -194,7 +194,7 @@ class Document_modele
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
rollback($this->cn);
return ;
}
@ -360,7 +360,7 @@ class Document_modele
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
rollback($this->cn);
return ;
}

View file

@ -103,7 +103,7 @@ class Document_type
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
alert(j(_("Impossible d'ajouter [$p_value] ") . $e->getMessage()));
}
}
@ -120,7 +120,7 @@ class Document_type
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
alert(" Erreur " . $e->getMessage());
}
}
@ -133,7 +133,7 @@ class Document_type
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
alert("Erreur " . $e->getMessage());
}
}

View file

@ -326,7 +326,7 @@ class Dossier
{
echo_warning($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
$cn->rollback();
}
}

View file

@ -353,7 +353,7 @@ class Extension extends Menu_Ref_sql
$extension->me_type='PL';
$extension->me_menu=trim($xml->plugin[$i]->name);
$extension->me_parameter='plugin_code='.trim($xml->plugin[$i]->code);
$extension->depend=(isset($xml->plugin[$i]->depend))?trim($xml->plugin[$i]->depend):"";
$extension->depend=(isset($xml->plugin[$i]->depend))?trim($xml->plugin[$i]->depend):"EXT";
$extension->order=(isset($xml->plugin[$i]->order))?trim($xml->plugin[$i]->order):9000;
$a_extension[]=clone $extension;
}

View file

@ -937,7 +937,7 @@ class Fiche
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e->getMessage()." ".$e->getTraceAsString());
$this->cn->rollback();
throw ($e);
return;
@ -1133,7 +1133,7 @@ class Fiche
$e->getMessage().
'</span>';
record_log($e->getMessage());
record_log($e->getTraceAsString());
record_log($e);
$this->cn->rollback();
return;
}
@ -2342,6 +2342,45 @@ class Fiche
throw $e;
}
}
/**
* @brief display card as a table row , the tag TR must be added
*
* @return HTMLT string starting
*
*/
function display_row()
{
$this->getAttribut();
foreach($this->attribut as $attr) {
$sort="";
if ($attr->ad_type!='select')
{
if ($attr->ad_type=="date") {
// format YYYYMMDD
$sort='sorttable_customkey="'.format_date($attr->av_text, "DD.MM.YYYY", "YYYYMMDD").'"';
}
elseif ($attr->ad_type=="poste"){
$sort='sorttable_customkey="TEXT'.$attr->av_text.'"';
}
echo td($attr->av_text, 'style="padding: 0 10 1 10;white-space:nowrap;" '.$sort);
}
else {
$value=$this->cn->make_array($attr->ad_extra);
$row_content="";
for ($e=0; $e<count($value); $e++) {
if ( $value[$e]['value']==$attr->av_text) {
$row_content=h($value[$e]['label']);
break;
}
}
echo td($row_content, 'style="padding: 0 10 1 10;white-space:nowrap;"');
}
}
}
}
?>

View file

@ -99,7 +99,7 @@ class Fiche_Attr
$this->cn->exec_sql($this->ad_extra);
}catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
throw new Exception ("La requête SQL ".h($this->ad_extra)." est invalide ");
}
}
@ -161,7 +161,7 @@ class Fiche_Attr
);
} catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
throw $e;
}
@ -185,7 +185,7 @@ class Fiche_Attr
);
}catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
throw $e;
}

View file

@ -104,6 +104,7 @@ class Follow_Up
$this->aAction_detail=array();
$this->operation="";
$this->action="";
$this->f_dest_id=0;
}
/**
* Create a filter based on the current user,

View file

@ -457,7 +457,7 @@ class PDF_Operation extends PDF {
return $file_name;
}
function download_pdf() {
$this->pdf->Output("acc_op".$this->acc_detail->det->jr_internal.".pdf");
$this->pdf->Output("acc_op".$this->acc_detail->det->jr_internal.".pdf","D");
}
/**
* @brief unlink the file if exists

View file

@ -273,7 +273,7 @@ class Periode
catch (Exception $e)
{
record_log($e->getMessage()." - ".$e->getCode());
record_log($e->getTraceAsString());
record_log($e);
$this->cn->rollback();
throw $e;
}
@ -495,7 +495,7 @@ class Periode
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
$this->cn->rollback();
throw $e;
}

View file

@ -104,7 +104,7 @@ class Pre_op_ach extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -98,7 +98,7 @@ class Pre_Op_Advanced extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -86,7 +86,7 @@ class Pre_op_fin extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -78,7 +78,7 @@ class Pre_op_ods extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -102,7 +102,7 @@ class Pre_op_ven extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
record_log($e);
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -53,8 +53,8 @@ class Tva_Rate_MTable extends Manage_Table_SQL
$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")]
["value"=>0, "label"=>_("Non")],
["value"=>1, "label"=>_("Oui")]
));
$this->set_property_updatable("tva_id", FALSE);
$this->set_col_label("tva_payment_purchase",_("Exigible achat"));

View file

@ -13,6 +13,8 @@ define ("noalyss_psql_host","localhost");
// If you change the NOALYSS_ADMINISTRATOR , you will need to rerun http://..../noalyss/html/install.php
// But it doesn't change the password
define ("NOALYSS_ADMINISTRATOR","admin");
// used only for install
define ("NOALYSS_ADMIN_PASSWORD","");
define ("LOCALE",1);
define ("domaine","");
define ("MULTI",1);

View file

@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
define ("DBVERSION",143);
define ("DBVERSION",144);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",18);
define ('NOTFOUND','--not found--');
@ -325,7 +325,7 @@ if ( ! defined ("NOALYSS_URL")) {
$protocol=$_SERVER['REQUEST_SCHEME'];
}
$base=$protocol.'://'.
$_SERVER['HTTP_HOST'].
$_SERVER['SERVER_NAME'].
":".$_SERVER['SERVER_PORT'].
dirname($_SERVER['PHP_SELF']);
define ("NOALYSS_URL",$base);

View file

@ -0,0 +1,35 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta 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.
*
* PhpCompta 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 PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE."/class/pdf_operation.class.php";
$http=new HttpInput();
/**
* @file
* @brief export an operation in PDF
*/
$operation=$http->get("operation_id","number");
$op=new PDF_Operation($cn, $operation);
$op->export_pdf(["acc","anc"]);
$op->download_pdf();

View file

@ -37,7 +37,7 @@ global $g_user, $g_failed;
*/
/* category */
$categorie = new ISelect('cat');
$categorie->value = $cn->make_array("select fd_id,fd_label||'('||(select count(*) from fiche where fiche.fd_id=fiche_def.fd_id)::text||')' from fiche_def order by fd_label");
$categorie->value = $cn->make_array("select fd_id,fd_label||' ('||(select count(*) from fiche where fiche.fd_id=fiche_def.fd_id)::text||')' from fiche_def order by fd_label");
$categorie->selected = $http->get('cat','number',0);
$str_categorie = $categorie->input();
$ac = $http->request('ac');
@ -128,7 +128,8 @@ if ( $allcard == 0 ){
echo h1($fiche_def->label,"");
echo h2($fiche_def->fd_description,"");
}
if ($array == null && $allcard == 0)
// if no card found , stop here
if ($array == null && $allcard == 0 && $histo->selected != 3 )
{
echo '<div class="content">';
echo '<h2 class="info2"> '._('Aucune fiche trouvée').'</h2>';
@ -138,10 +139,10 @@ if ($array == null && $allcard == 0)
}
echo '<div class="content">';
/* * *********************************************************************************************************************************
/* * *************************************************************************************************************
* Liste
*
* ******************************************************************************************************************************** */
* ***************************************************************************************************************/
if ($histo->selected == -1)
{
$write = $g_user->check_action(FICADD);
@ -234,16 +235,25 @@ if ($histo->selected == 3)
$cat_card = new Fiche_Def($cn);
$cat_card->id =$http->get('cat','number');
$aHeading = $cat_card->getAttribut();
if ( $allcard == 0) echo $str_add_card;
$str_add_card="";
if ( $allcard == 0 ) {
$h_add_card_b = new IButton('add_card');
$h_add_card_b->label = _('Créer une nouvelle fiche');
$h_add_card_b->javascript = "dis_blank_card({gDossier:$gDossier,fd_id:$fd_id,after_save:1,ref:2})";
$str_add_card=$h_add_card_b->input();
}
echo $str_add_card;
require_once NOALYSS_TEMPLATE.'/result_cat_card_summary.php';
$hid = new IHidden();
echo '<form method="GET" ACTION="export.php">' . dossier::hidden() .
HtmlInput::submit('bt_csv', _("Export CSV")) .
HtmlInput::hidden('act', "CSV:fiche") .
$hid->input("type", "fiche") .
$hid->input("ac", $http->request('ac')) .
$hid->input("fd_id", $http->request('cat',"number"));
echo '<form method="GET" ACTION="export.php">' . dossier::hidden() ;
echo $str_add_card;
echo
HtmlInput::submit('bt_csv', _("Export CSV")) .
HtmlInput::hidden('act', "CSV:fiche") .
$hid->input("type", "fiche") .
$hid->input("ac", $http->request('ac')) .
$hid->input("fd_id", $http->request('cat',"number"));
echo "</form>";
return;

View file

@ -342,7 +342,17 @@ function html_page_start($p_theme="", $p_script="", $p_script2="")
$p_script2 . "
";
echo '<script language="javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>
<script type="text/javascript" src="js/lang/calendar-en.js"></script>';
if (isset($_SESSION['g_lang']) && $_SESSION['g_lang']=='fr_FR.utf8' )
{
echo '<script type="text/javascript" src="js/lang/calendar-fr.js"></script>';
}
if (isset($_SESSION['g_lang']) && $_SESSION['g_lang']=='nl_NL.utf8' )
{
echo '<script type="text/javascript" src="js/lang/calendar-nl.js"></script>';
}
echo '
<script language="javascript" src="js/calendar-setup.js"></script>
<LINK REL="stylesheet" type="text/css" href="calendar-blue.css" media="screen">
';
@ -1321,9 +1331,8 @@ function is_msie()
*/
function record_log($p_message)
{
error_log("noalyss".$p_message,0);
error_log("noalyss GET [".var_export($_GET, true)."]",0);
error_log( "noalyss POST [".var_export($_POST, true)."]",0);
error_log("noalyss".print_r($p_message,true),0);
error_log("noalyss GET [".var_export($_GET, true)."] POST [".var_export($_POST, true)."]",0);
}
if(!function_exists('tracedebug')) {
function tracedebug($file,$var, $label = NULL) {
@ -1365,4 +1374,4 @@ function convert_to_rtf($p_string)
}
}
return $result;
}
}

View file

@ -70,6 +70,7 @@ function config_file_form($p_array=null)
$cdbname="";
$chost="localhost";
$cadmin='admin';
$cpassword_admin="";
}
else extract ($p_array, EXTR_SKIP);

View file

@ -75,9 +75,11 @@ class DatabaseCore
}
$this->is_open = TRUE;
}
public function verify()
{
// Verify that the elt we want to add is correct

View file

@ -605,11 +605,24 @@ class HtmlInput
}
}
}
}
}
return $r;
}
/**
* Transform a double array as a HTML string with hidden html value
* array has the formarray ["name"]="x",array['value']="y") the key name will be the hidden input name;
* @param double $array
*/
static function simple_array_to_hidden($array)
{
if (empty ($array)) return "";
$r="";
foreach ( $array as $key=>$value) {
$r.=HtmlInput::hidden($key, $value);
}
return $r;
}
/**
* @brief transform a json to hidden
* @param json $p_json

View file

@ -1037,7 +1037,7 @@ function check()
{
$s1=$xml->createElement("status", "NOK");
$s2=$xml->createElement("ctl_row",
$this->object_name+"_"+$this->table->get_pk_value());
$this->object_name."_".$this->table->get_pk_value());
$s4=$xml->createElement("ctl", $this->object_name);
$s3=$xml->createElement("html", $ex->getTraceAsString());
$root=$xml->createElement("data");
@ -1113,7 +1113,7 @@ function check()
$s1=$xml->createElement("status", "NOK");
$s3=$xml->createElement("ctl", $this->object_name);
$s2=$xml->createElement("ctl_row",
$this->object_name+"_"+$this->table->get_pk_value());
$this->object_name."_".$this->table->get_pk_value());
$s4=$xml->createElement("html", $ex->getTraceAsString());
$root=$xml->createElement("data");

View file

@ -74,8 +74,8 @@ content[40]="<?php echo escape_xml(_("Laissez à 0 pour ne pas changer le numér
content[41]="<?php echo escape_xml(_("Mettez le pourcentage <br> à zéro pour effacer la ligne"))?>";
content[42]="<?php echo escape_xml(_("Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche"))?>";
content[43]="<?php echo escape_xml(_("Autoliquidation : Utilisé en même temps au crédit et au débit"))?>";
content[44]="<?php echo escape_xml(_("Ne donner pas ce poste comptable si ce code n'est pas utilisé à l'achat"))?>";
content[45]="<?php echo escape_xml(_("Ne donner pas ce poste comptable si ce code n'est pas utilisé à la vente"))?>";
content[44]="<?php echo escape_xml(_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à l'achat"))?>";
content[45]="<?php echo escape_xml(_("Ne donnez pas ce poste comptable si ce code n'est pas utilisé à la vente"))?>";
content[46]="<?php echo escape_xml(_("Un instant svp"))?>";
content[47]="<?php echo escape_xml(_("Vous confirmez ?"))?>";
content[48]="<?php echo escape_xml(_("Echec "))?>";
@ -107,4 +107,4 @@ content[73]="<?php echo _("Mettre à oui pour un journal dédié uniquement aux
content[74]="<?php echo _('TVA due ou récupérable quand l\'opération est payée ou exécutée')?>";
content[75]="<?php echo _('Journaux Achat ou vente en mode simple, TVA ou détaillé')?>";
content[76]="<?php echo _('Il est conseillé d\'avoir un quickcode de moins de 9 car.')?>";
</script>
</script>

View file

@ -36,7 +36,8 @@ class Select_Box
private $cnt;
private $filter; //!< allow a dynamic not case sensitive search
var $default_value;
private $position ; //!< change depending if we are in an absolute block or not
/**
* Default constructor
* @param type $p_id javascript DOMid
@ -52,6 +53,98 @@ class Select_Box
$this->default_value=-1;
$this->style_box="";
$this->filter="";
$this->position="normal";
}
public function get_position()
{
return $this->position;
}
public function set_position($position)
{
if ( ! in_array($position,array("normal","in-absolute") ) ) {
throw new Exception("SB0005",EXC_PARAM_VALUE);
}
$this->position=$position;
return $this;
}
private function compute_position()
{
$list_id=sprintf('%s_list', $this->id);
switch ($this->position)
{
case "normal":
// Show when click
$javascript=sprintf('$("%s_bt").onclick=function() {
try {
var newDiv=$("select_box%s");
var pos=$("%s_bt").cumulativeOffset();
newDiv.setStyle({display:"block",position:"fixed",top:pos.top+25+"px",left:pos.left+5+"px"});
if ( $("search_%s") ) { $("search_%s").focus();}
} catch(e) {
alert(e.message);
}
}
', $this->id, $this->id, $this->id, $list_id, $list_id);
// Hide when out of the zone
$javascript.=sprintf('$("select_box%s").onmouseleave=function() {
try {
var newDiv=$("select_box%s");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}',$this->id,$this->id);
break;
case "in-absolute":
// Show when click
$javascript=sprintf('
$("%s_bt").onclick=function() {
try {
if (! document.getElementById("select_box_content") ) {
var newDiv=new Element("div");
newDiv.id="select_box_content";
document.body.appendChild(newDiv);
newDiv.addClassName("select_box");
$("select_box_content").onmouseleave=function() {
try {
var newDiv=$("select_box_content");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}
} else {
var newDiv=document.getElementById("select_box_content");
}
newDiv.innerHTML=$("select_box%s").innerHTML;
var pos=$("%s_bt").cumulativeOffset();
var nTop=pos.top;
var viewport = document.viewport.getDimensions();
if ( nTop> viewport.height-newDiv.getHeight()-20) { nTop-=newDiv.getHeight()-5}
newDiv.setStyle({display:"block",position:"absolute",top:nTop+"px",left:pos.left+5+"px","z-index":999});
if ( $("search_%s") ) { $("search_%s").focus();}
} catch(e) {
alert(e.message);
}
}
', $this->id, $this->id, $this->id, $list_id, $list_id);
break;
default:
break;
}
return $javascript;
}
function input()
@ -59,36 +152,16 @@ class Select_Box
$list_id=sprintf('%s_list',$this->id);
// Show when click
$javascript=sprintf('$("%s_bt").onclick=function() {
try {
var newDiv=$("select_box%s");
var pos=$("%s_bt").cumulativeOffset();
newDiv.setStyle({display:"block",position:"fixed",top:pos.top+25+"px",left:pos.left+5+"px"});
if ( $("search_%s") ) { $("search_%s").focus();}
} catch(e) {
alert(e.message);
}
}
', $this->id, $this->id, $this->id, $list_id,$list_id);
$javascript=$this->compute_position();
// Hide when out of the zone
$javascript.=sprintf('$("select_box%s").onmouseleave=function() {
try {
var newDiv=$("select_box%s");
newDiv.setStyle({display:"none"});
} catch(e) {
alert(e.message);
}
}',$this->id,$this->id);
// display the button
printf('<input type="button" class="smallbutton icon" id="%s_bt" value="%s &#x25BE;">',
printf('<input type="button" class="smallbutton icon " id="%s_bt" value="%s &#x25BE;" >',
$this->id, $this->value);
printf('<input type="hidden" id="%s" name="%s" value="%s">', $this->id,
$this->id, $this->default_value);
printf('<div class="select_box" id="select_box%s" style="%s">',
printf('<div class="select_box " id="select_box%s" style="%s">',
$this->id, $this->style_box);
// Show the filter if there is one,

View file

@ -78,7 +78,8 @@ class Sendmail_Core
*/
function set_message($p_message)
{
$this->message = $p_message;
// $this->message =wordwrap($p_message,70,"\r\n");
$this->message =$p_message;
}
/**
@ -134,24 +135,26 @@ class Sendmail_Core
$this->content .= "Content-Type: text/plain; charset=\"utf-8\"" . $eol;
$this->content .= "Content-Transfer-Encoding: 7bit" . $eol.$eol ;
$this->content .= $this->message . $eol ;
// attachment
for ($i = 0; $i < count($this->afile); $i++)
if ( ! empty($this->afile ) )
{
$file = $this->afile[$i];
$file_size = filesize($file->full_name);
$handle = fopen($file->full_name, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$this->content .= "--" . $separator . $eol;
$this->content .= "Content-Type: " . $file->type . "; name=\"" . $file->filename . "\"" . $eol;
$this->content .= "Content-Disposition: attachment; filename=\"" . $file->filename . "\"" . $eol;
$this->content .= "Content-Transfer-Encoding: base64" . $eol;
$this->content.=$eol;
$this->content .= $content . $eol ;
// attachment
for ($i = 0; $i < count($this->afile); $i++)
{
$file = $this->afile[$i];
$file_size = filesize($file->full_name);
$handle = fopen($file->full_name, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$this->content .= "--" . $separator . $eol;
$this->content .= "Content-Type: " . $file->type . "; name=\"" . $file->filename . "\"" . $eol;
$this->content .= "Content-Disposition: attachment; filename=\"" . $file->filename . "\"" . $eol;
$this->content .= "Content-Transfer-Encoding: base64" . $eol;
$this->content.=$eol;
$this->content .= $content . $eol ;
}
}
if ( count ($this->afile) == 0 ) $this->content.=$eol;
if ( empty ($this->afile) ) $this->content.=$eol;
$this->content .= "--" . $separator . "--";
}

View file

@ -25,6 +25,7 @@ define('SIZE_REQUEST', 70);
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/class/sendmail.class.php';
/**
* @brief generate a random string of char
* @param $car int length of the string
@ -95,12 +96,22 @@ elseif ($action=="send_email") :
if ($valid==true):
$request_id=generate_random(SIZE_REQUEST);
$user_password=generate_random(10);
/*
* save the request into
*/
$cn->exec_sql("insert into recover_pass(use_id,request,password,created_on,created_host) "
." values ($1,$2,$3,now(),$4)", array($user_id, $request_id, $user_password, $_SERVER['REMOTE_ADDR']));
// exist a valid request for this user ?
$exist_request= $cn->get_array("select request , password from recover_pass
where use_id=$1 and created_on > now() - interval '12 hours'",[$user_id]);
if ( empty($exist_request ) ) {
/* save the request into */
$cn->exec_sql("insert into recover_pass(use_id,request,password,created_on,created_host) "
." values ($1,$2,$3,now(),$4)", array($user_id, $request_id, $user_password, $_SERVER['REMOTE_ADDR']));
} else {
$request_id=$exist_request[0]["request"];
$user_password=$exist_request[0]['password'];
/* if too many request , there is a bug somewhere , so record an warning */
if ( count($exist_request)> 1 ){
error_log("WRE109 Trop de request pour ".var_export($exist_request,true));
}
}
/*
* send an email
*/

View file

@ -0,0 +1,8 @@
begin;
insert into menu_ref (me_code,me_description ,me_file) values ('PDF:operation_detail','Export Operation','export_operation_pdf.php');
insert into profile_menu(me_code,p_id,p_type_display ,pm_default ) select 'PDF:operation_detail',p_id,'P',0 from profile ;
insert into version (val,v_description) values (144,'Export Operation PDF');
commit;

View file

@ -177,8 +177,7 @@ CREATE TABLE bud_hypothese
CONSTRAINT fk_bud_hypo_pa_id FOREIGN KEY (pa_id)
REFERENCES plan_analytique (pa_id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITHOUT OIDS;
);
create sequence seq_bud_hypothese_bh_id;

View file

@ -1,5 +1,6 @@
<hr>
<?php
/**
//This file is part of NOALYSS and is under GPL
//see licence.txt
@ -10,6 +11,10 @@
* Variables : $div = popup or box (det[0-9]
*
*/
require_once NOALYSS_INCLUDE."/lib/select_box.class.php";
$select_box=new \Select_Box("sb_".$jr_id, _("Autre action"));
$select_box->set_position("in-absolute");
$cn=Dossier::connect();
// Contains all the linked actions
$a_followup = Follow_Up::get_all_operation($jr_id);
@ -199,7 +204,6 @@ if ($aRap != null ) {
$e
);
$remove=Icon_Action::trash(uniqid(), $js);
// $remove=$rmReconciliation->input();
}
else
$remove='';
@ -315,25 +319,35 @@ if ( $div != 'popup' ) {
echo HtmlInput::submit('save',_('Sauver'),'onClick="return verify_ca(\'popup\');"');
$owner=new Noalyss_Parameter_Folder($cn);
if ($owner->MY_ANALYTIC != 'nu' /*&& $div=='popup' */){
echo '<input type="button" class="smallbutton" value="'._('verifie CA').'" onClick="verify_ca(\''.$div.'\');">';
$select_box->add_javascript(_("Vérification CA"), sprintf("verify_ca('%s')",$div));
}
$per=new Periode($cn,$obj->det->jr_tech_per);
if ( $per->is_closed() == 0 && $owner->MY_STRICT=='N' && $g_user->check_action(RMOPER)==1)
{
$remove=new IButton('Effacer');
$remove->label=_('Effacer');
$remove->javascript="return confirm_box(null,content[50],function () {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')})";
echo $remove->input();
$javascript="return confirm_box(null,content[50],function () {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')})";
$select_box->add_javascript(_("Effacer"), $javascript);
}
//----------------------------------------------------
// Extourne
//----------------------------------------------------
$reverse=new IButton('bext'.$div);
$reverse->label=_('Extourner');
$reverse->javascript="g('ext".$div."').style.display='block'";
echo $reverse->input();
echo '</p>';
$select_box->add_javascript(_("Extourne"), sprintf("g('ext%s').style.display='block'",$div));
//-------------------------------------------------------------------
// Duplicate
//-------------------------------------------------------------------
$select_box->add_javascript(_("Duplicate"),sprintf("duplicate_operation('%s','%s')",Dossier::id(),$obj->jr_id));
//-------------------------------------------------------------------
// Export PDF
//-------------------------------------------------------------------
$select_box->add_url(_("Export PDF"), "export.php?".
http_build_query(array("act"=>"PDF:operation_detail","gDossier"=>Dossier::id(),"operation_id"=>$obj->jr_id)));
echo $select_box->input();
echo '</p>';
echo '</form>';
echo '<div id="ext'.$div.'" class="inner_box" style="position:absolute;top:40px;display:none">';
@ -341,7 +355,7 @@ echo '</form>';
$extourne_label=new IText("ext_label");
$extourne_label->size=40;
$r="<form id=\"form_".$div."\" onsubmit=\"return false;\">";
$r.=HtmlInput::hidden('jr_id',$_REQUEST['jr_id'])
$r.=HtmlInput::hidden('jr_id',$obj->jr_id)
. HtmlInput::hidden('div',$div).dossier::hidden().HtmlInput::hidden('act','reverseop');
$r.=HtmlInput::title_box(_('Extourner'), 'ext'.$div, 'hide');
$r.="<p>";

View file

@ -24,42 +24,22 @@ for ($i=0;$i<count($aHeading);$i++) :
</tr>
<?php
$e=0;
$fiche=new Fiche($cn);
echo HtmlInput::hidden("card_gdossier",Dossier::id());
foreach ($array as $row ) :
$e++;
if ($e%2==0)
printf('<tr id="card%s" class="odd">',$row['f_id']);
printf('<tr id="row_card%s" class="odd">',$row['f_id']);
else
printf('<tr id="card%s" class="even">',$row['f_id']);
printf('<tr id="row_card%s" class="even">',$row['f_id']);
$fiche=new Fiche($cn);
$fiche->id=$row['f_id'];
$fiche->getAttribut();
$detail=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE));
$fiche->id=$row['f_id'];
$detail=Icon_Action::modify("mod".$fiche->id, sprintf("modify_card('%s')",$fiche->id)).
"&nbsp;".
Icon_Action::trash("del".$fiche->id, sprintf("delete_card_id('%s')",$fiche->id));
echo td($detail);
foreach($fiche->attribut as $attr) :
$sort="";
$fiche->display_row();
if ( $attr->ad_type != 'select'):
if ($attr->ad_type=="date") :
// format YYYYMMDD
$sort='sorttable_customkey="'.format_date($attr->av_text, "DD.MM.YYYY", "YYYYMMDD").'"';
elseif ($attr->ad_type=="poste"):
$sort='sorttable_customkey="TEXT'.$attr->av_text.'"';
endif;
echo td($attr->av_text,'style="padding: 0 10 1 10;white-space:nowrap;" '.$sort);
else:
$value=$cn->make_array($attr->ad_extra);
$row_content="";
for ($e=0;$e<count($value);$e++):
if ( $value[$e]['value']==$attr->av_text):
$row_content=h($value[$e]['label']);
break;
endif;
endfor;
echo td($row_content,'style="padding: 0 10 1 10;white-space:nowrap;"');
endif;
endforeach;
echo '</tr>';
endforeach;

View file

@ -1257,7 +1257,7 @@ function _dochecks()
if(ini_get('mbstring.func_overload') & 2)
$this->Error('mbstring overloading must be disabled');
// Ensure runtime magic quotes are disabled
if(get_magic_quotes_runtime())
if(version_compare(PHP_VERSION, '7.3.0','<') && get_magic_quotes_runtime())
@set_magic_quotes_runtime(0);
}

View file

@ -10,4 +10,4 @@ operation_currency
join jrnx using (j_id)
group by f_id,j_id;
commit ;
commit ;