Error : duplicate function update_row

This commit is contained in:
Dany De Bontridder 2020-06-07 19:24:47 +02:00
commit 9c40c9df68
36 changed files with 929 additions and 197 deletions

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

@ -1473,4 +1473,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

@ -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

@ -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

@ -2465,4 +2465,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

@ -77,7 +77,7 @@ foreach ($var as $v)
$cont=1;
}
}
extract($_REQUEST, EXTR_SKIP );
extract($_REQUEST, EXTR_SKIP );
if ( $cont != 0 ) exit();
@ -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

@ -577,6 +577,22 @@ case 'reverseop':
}
$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

@ -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;

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

@ -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
@ -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

@ -747,6 +747,60 @@ 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>";
$r.=HtmlInput::simple_array_to_hidden($array);
//
$r.=HtmlInput::submit(uniqid(), _("Dupliquer"));
$r.='</form>';
// return the form as a string
return $r;
}
}
/////////////////////////////////////////////////////////////////////////////
@ -779,6 +833,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 +872,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 +919,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 +974,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 +1027,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

@ -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

@ -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

@ -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

@ -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

@ -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">
';
@ -1365,4 +1375,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

@ -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;