From 7e7407575ad5cefb902f96a475087f1480faaa2f Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 25 Aug 2015 00:38:44 +0200 Subject: [PATCH] Task #1153 - Boite de dialogue modale #1153 Dialog box : confirm_form in javascript , use of smoke, add style --- html/ajax_ledger.php | 30 ++++-- html/ajax_misc.php | 12 ++- html/js/acc_ledger.js | 15 +++ html/js/scripts.js | 115 ++++++++++++---------- include/ac_common.php | 5 +- include/action.common.inc.php | 11 ++- include/ajax_plugin_detail.php | 8 +- include/anc_pa.inc.php | 10 +- include/card_attr.inc.php | 9 +- include/category_detail.inc.php | 4 +- include/cfgfiche.inc.php | 10 +- include/cfgledger.inc.php | 12 ++- include/class_acc_ledger.php | 6 +- include/class_document_type.php | 7 +- include/class_fiche_def.php | 15 ++- include/class_follow_up.php | 2 +- include/class_html_input.php | 4 +- include/class_periode.php | 23 ++++- include/forecast.inc.php | 28 +++--- include/menu.inc.php | 1 - include/preod.inc.php | 4 +- include/template/anc_key_input.php | 4 +- include/template/dashboard.php | 3 +- include/template/detail-action.php | 12 +-- include/template/ledger_detail_bottom.php | 23 +++-- include/user_detail.inc.php | 36 ++++--- 26 files changed, 239 insertions(+), 170 deletions(-) diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php index c1974ca12..7b2c9321b 100644 --- a/html/ajax_ledger.php +++ b/html/ajax_ledger.php @@ -292,9 +292,13 @@ case 'file': echo '
'; $x=''; if ($access=='W' && $g_user->check_action (RMRECEIPT) == 1) + { + // Not possible to remove the file thanks a modal dialog box, + // because of the frameset $x=sprintf(''.SMALLX.'', $gDossier,$div,$jr_id); - + + } $filename= $obj->det->jr_pj_name; if ( strlen($obj->det->jr_pj_name) > 20 ) { @@ -334,6 +338,8 @@ case 'loadfile': // check if the user can remove a document if ($g_user->check_action (RMRECEIPT) == 1) { + // Not possible to remove the file thanks a modal dialog box, + // because of the frameset $x=sprintf(''.SMALLX.'', $gDossier,$div,$jr_id); echo $x; @@ -509,7 +515,8 @@ case 'save': // Save related ////////////////////////////////////////////////////////////////// $related=HtmlInput::default_value_post("related", "0"); - if ($related == "0" ) throw new Exception('Parameter not send -> related'.__FILE__.__LINE__,10); + if ($related == "0" ) + throw new Exception('Parameter not send -> related'.__FILE__.__LINE__,10); $op->insert_related_action($related); } @@ -525,9 +532,9 @@ case 'save': ob_end_clean(); break; -///////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// // remove a reconciliation -///////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// case 'rmr': if ( $access=='W') { @@ -536,20 +543,25 @@ case 'rmr': $rec->remove($_GET['jr_id2']); } break; - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// // ask for a date for reversing the operation + //////////////////////////////////////////////////////////////////////////// case 'ask_extdate': $date=new IDate('p_date'); $html.="
"; - $html.=HtmlInput::hidden('jr_id',$_REQUEST['jr_id']).HtmlInput::hidden('div',$div).dossier::hidden().HtmlInput::hidden('act','reverseop'); + $html.=HtmlInput::hidden('jr_id',$_REQUEST['jr_id']). + HtmlInput::hidden('div',$div). + dossier::hidden(). + HtmlInput::hidden('act','reverseop'); + $html.='

'._('entrez une date').'

'.$date->input(); $html.=HtmlInput::submit('x','accepter'); - $html=HtmlInput::button_close($div); + $html.=HtmlInput::button_close($div); $html.='
'; break; - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// // Reverse an operation - //////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// case 'reverseop': if ( $access=='W') { diff --git a/html/ajax_misc.php b/html/ajax_misc.php index ecee0354e..f30f47019 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -172,14 +172,17 @@ EOF; case 'rem_cat_doc': require_once NOALYSS_INCLUDE.'/class_document_type.php'; // if user can not return error message + $message=""; if ($g_user->check_action(PARCATDOC) == 0) { $html = "nok"; + $message=_('Action non autorisée'); header('Content-type: text/xml; charset=UTF-8'); echo << $html +$message EOF; return; @@ -190,12 +193,14 @@ EOF; if ($count_md != 0 || $count_a != 0) { + $message=_('Des actions dépendent de cette catégorie'); $html = "nok"; header('Content-type: text/xml; charset=UTF-8'); echo << $html +$message EOF; exit; @@ -205,9 +210,10 @@ EOF; header('Content-type: text/xml; charset=UTF-8'); echo << - - $html - + +$html +$message + EOF; return; break; diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index e071c8c73..839f01c40 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -1111,4 +1111,19 @@ function gestion_add_row() alert_box(e.message); } +} +function document_remove(p_dossier,p_div,p_jrid) +{ + smoke.confirm('Effacer ?', function (e) + { + if (e) { + new Ajax.Request('ajax_ledger.php', + { + parameters:{"p_dossier":p_dossier,"div":p_div,"p_jrid":p_jrid,'act':'rmf'}, + onSuccess : function(x) { + $('receipt'+p_div).innerHTML=x.responseText; + } + }) + } + }); } \ No newline at end of file diff --git a/html/js/scripts.js b/html/js/scripts.js index ca0f0c0b7..ca1f765c6 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -84,8 +84,7 @@ function deleteRow(tb, obj) } function deleteRowRec(tb, obj) { - var td = obj.parentNode; - var tr = td.parentNode; + var tr = obj; var lidx = tr.rowIndex; g(tb).deleteRow(lidx); } @@ -417,7 +416,40 @@ function cat_doc_remove(p_dt_id, p_dossier) { var queryString = "gDossier=" + p_dossier + "&op=rem_cat_doc" + "&dt_id=" + p_dt_id; var action = new Ajax.Request( - "ajax_misc.php", {method: 'get', parameters: queryString, onFailure: ajax_misc_failure, onSuccess: success_cat_doc_remove} + "ajax_misc.php", {method: 'get', + parameters: queryString, + onFailure: ajax_misc_failure, + onSuccess: function (req) + { + try + { + var answer = req.responseXML; + var html = answer.getElementsByTagName('dtid'); + if (html.length === 0) + { + var rec = req.responseText; + alert_box('erreur
' + rec ); + return; + } + nodeXML = html[0]; + row_id = getNodeText(nodeXML); + if (row_id === 'nok') + { + var message_node = answer.getElementsByTagName('message'); + var message_text = getNodeText(message_node[0]); + alert_box('erreur
' + message_text); + return; + } + $('row' + row_id).style.textDecoration = "line-through"; + $('X' + row_id).style.display='none'; + $('M' + row_id).style.display='none'; + } + catch (e) + { + alert_box(e.message); + } + } + } ); } /** @@ -447,32 +479,6 @@ function cat_doc_change(p_dt_id, p_dossier) ); } -function success_cat_doc_remove(req) -{ - try - { - var answer = req.responseXML; - var html = answer.getElementsByTagName('dtid'); - if (html.length === 0) - { - var rec = req.responseText; - alert_box('erreur :' + rec); - } - nodeXML = html[0]; - row_id = getNodeText(nodeXML); - if (row_id === 'nok') - { - alert_box('Error'); - return; - } - $('row' + row_id).style.textDecoration = "line-through"; - $('X' + row_id).style.display = 'none'; - } - catch (e) - { - alert_box(e.message); - } -} /** *@brief display the popup with vat and explanation *@param obj with 4 attributes gdossier, ctl,popup @@ -2862,39 +2868,40 @@ function init_scroll()
* @endcode - * @param p_obj form element id + * @param p_obj form element (object) or element id (string) * @param p_message message to display * @returns true or false */ -function confirm_form(p_obj, p_message) +function confirm_form(p_obj, p_message,p_callback_true) { try { + // Find id of the end var name=""; - if ( typeof (p_obj) == "object") { - name=p_obj.id; - } else { - name=p_obj; + if ( p_obj != null ) + { + if ( typeof (p_obj) === "object") { + name=p_obj.id; + } else { + name=p_obj; + } + } + + // execute the callback function or submit the form + if ( p_callback_true == undefined || p_callback_true==null) + { + smoke.confirm(p_message,function (e) { + if ( e ) { + $(name).submit(); + } + }); + } else { + smoke.confirm(p_message,function (e) + { + if ( e ) { p_callback_true.apply();} + }); } - var background_block = document.createElement('DIV'); - background_block.id = 'background_block'; - background_block.addClassName('popup_back'); - document.body.appendChild(background_block); - - var newdiv = document.createElement('DIV'); - newdiv.id = 'confirm_12'; - newdiv.addClassName("inner_box confirm_box"); - //newdiv.innerHTML="

"; - newdiv.innerHTML += '

'; - newdiv.innerHTML += p_message; - newdiv.innerHTML += '

'; - newdiv.innerHTML += '

'; - newdiv.innerHTML += ''; - newdiv.innerHTML += ''; - newdiv.innerHTML += '

'; - document.body.appendChild(newdiv); - } catch (e) { - console.debug(e); + alert_box(e.getMessage); } return false; } diff --git a/include/ac_common.php b/include/ac_common.php index 4d19bef4d..7e5e0a46e 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -383,8 +383,11 @@ function html_min_page_start($p_theme="", $p_script="", $p_script2="") " . + "" . $p_script2 . " - "; + + + "; echo ' '; diff --git a/include/action.common.inc.php b/include/action.common.inc.php index df9943e44..6a717cd0b 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -97,7 +97,7 @@ if (isset($_POST['generate'])) $sub_action = 'detail'; } /* for delete */ -if (isset($_POST['delete'])) +if (isset($_POST['delete']) && $_POST['delete'] == "1") $sub_action = 'delete'; if ($sub_action == "") $sub_action = "list"; @@ -196,15 +196,16 @@ if ($sub_action == 'detail') if ($g_user->can_write_action($ag_id) == true) { - echo '
'; + echo ''; echo $supl_hidden; echo HtmlInput::hidden('ac', $_REQUEST['ac']); echo dossier::hidden(); echo $act->Display('UPD', false, $base, $retour); echo ''; - echo HtmlInput::submit("save", "Sauve"); - echo HtmlInput::submit("add_action_here", _("Ajoute un événement à celui-ci")); - echo HtmlInput::submit("delete", _("Efface cet événement "), ' onclick="return confirm(\'' . _("Vous confirmez l\'effacement") . '\')" '); + echo ''; + echo HtmlInput::submit("save", "Sauve",' onclick="$(\'delete\').value=0"'); + echo HtmlInput::submit("add_action_here", _("Ajoute un événement à celui-ci"),' onclick="$(\'delete\').value=0"'); + echo HtmlInput::submit("delete_bt", _("Efface cet événement "), ' onclick="$(\'delete\').value=1;return confirm_form(\'action_common_frm\',\''. _("Vous confirmez l\'effacement") . '\')" '); echo $retour; echo '
'; } diff --git a/include/ajax_plugin_detail.php b/include/ajax_plugin_detail.php index c60aa5f6e..184c9f527 100644 --- a/include/ajax_plugin_detail.php +++ b/include/ajax_plugin_detail.php @@ -29,7 +29,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); $msg=($new==1)?_("Nouvelle extension"):_("Modification"). " ".$me_menu->value; echo HtmlInput::title_box($msg, $ctl); ?> -
')"> +')"> @@ -51,11 +51,13 @@ echo HtmlInput::title_box($msg, $ctl); "._("Voulez-vous effacer ce plugin ?")." ".$delete->input()."

"; - echo HtmlInput::submit("mod_plugin",_("Modifier ce plugin")); + echo HtmlInput::hidden('mod_plugin',1); + echo HtmlInput::submit("mod_plugin_sbt",_("Modifier ce plugin")); } ?> diff --git a/include/anc_pa.inc.php b/include/anc_pa.inc.php index cc65926cb..64ed9cacd 100644 --- a/include/anc_pa.inc.php +++ b/include/anc_pa.inc.php @@ -147,8 +147,8 @@ if ( isset($_REQUEST['sa'])) $ret.=$po->form(); $ret.=HtmlInput::hidden('sa','po_update'); $ret.=HtmlInput::submit('Correction','Correction'); - $ret.=sprintf(''. - '', + $ret.=sprintf('id, $_REQUEST['pa_id'] ); @@ -192,7 +192,11 @@ if ( isset($_REQUEST['sa'])) $ret.= $new->form(); $ret.= $wSa; $ret.=HtmlInput::submit("submit",_("Enregistre")); - $ret.=HtmlInput::button_anchor(_('Efface'),"?ac=".$_REQUEST['ac']."&pa_id=".$_GET['pa_id']."&sa=pa_delete&$str_dossier",_('Efface'),'onclick="return confirm(\'Effacer ?\')"','smallbutton'); + $ret.=HtmlInput::button_anchor(_('Efface'), + '', + 'remove_analytic_plan', + 'onclick="return confirm_form(\'remove_analytic_plan\',\'Effacer ?\',function () {window.location=\'do.php?ac='.$_REQUEST['ac'].'&pa_id='.$_GET['pa_id'].'&sa=pa_delete&'.$str_dossier.'\';})"', + 'smallbutton'); $ret.= ''; /** * Detail now diff --git a/include/card_attr.inc.php b/include/card_attr.inc.php index e826c66be..e38b4b389 100644 --- a/include/card_attr.inc.php +++ b/include/card_attr.inc.php @@ -82,8 +82,7 @@ $select_type->value=array( array('value'=>'card','label'=>_('Fiche')), array('value'=>'select','label'=>_('Selection')) ); -$remove=new IButton('rmfa'); -$remove->label=_('Effacer'); + echo '
'; echo '
'; @@ -106,6 +105,8 @@ for ($e=0;$evalue=$row->get_parameter('desc'); $size->value=$row->get_parameter('size'); $extra->value=$row->get_parameter('extra'); + $remove=new IButton('rmfa'.$e); + $remove->label=_('Effacer'); if ( $row->get_parameter('id')>= 9000) { $select_type->readOnly=false; @@ -119,8 +120,8 @@ for ($e=0;$einput()); $r.=td($extra->input()); - $remove->javascript=sprintf('if ( confirm(\'Vous confirmez ?\')) { removeCardAttribut(%d,%d,\'tb_rmfa\',this);}', - $row->get_parameter('id'),$gDossier); + $remove->javascript=sprintf('confirm_form(\'tb_rmfa\',\'Vous confirmez ?\',function() { removeCardAttribut(%d,%d,\'tb_rmfa\',$(\'rmfa%d\') );})', + $row->get_parameter('id'),$gDossier,$e); $msg=''._("Attention : effacera les données qui y sont liées").' '; $r.=td($remove->input().$msg); } diff --git a/include/category_detail.inc.php b/include/category_detail.inc.php index 6cea98bba..ed87960c2 100644 --- a/include/category_detail.inc.php +++ b/include/category_detail.inc.php @@ -51,7 +51,7 @@ if ( isset($_POST['mod'])) echo hb(_('Information sauvée')); $supplier=new Fiche($cn,$f_id); $p_readonly=($g_user->check_action(FICADD)==0)?true:false; -if ( ! $p_readonly) echo ''; +if ( ! $p_readonly) echo ''; echo dossier::hidden(); echo HtmlInput::hidden('sb','detail'); echo HtmlInput::hidden('dc','cc'); @@ -67,7 +67,7 @@ if ( ! $p_readonly) { echo HtmlInput::submit('mod',_('Sauver les modifications')); echo HtmlInput::reset(_("Annuler")); - echo HtmlInput::submit('delete_card',_('Effacer cette fiche'),'onclick="return confirm(\'Confirmer effacement ?\');"'); + echo HtmlInput::submit('delete_card',_('Effacer cette fiche'),'onclick="return confirm_form(\'catergory_detail_frm\',\''.('Confirmer effacement ?').'\');"'); echo ''; } echo '
'; diff --git a/include/cfgfiche.inc.php b/include/cfgfiche.inc.php index 88f29dde5..4231c3817 100644 --- a/include/cfgfiche.inc.php +++ b/include/cfgfiche.inc.php @@ -33,11 +33,11 @@ require_once NOALYSS_INCLUDE.'/class_fiche_def.php'; require_once NOALYSS_INCLUDE.'/class_tool_uos.php'; $retour=HtmlInput::button_anchor("Retour à la liste", HtmlInput::get_to_string(array("gDossier","ac"))); - +$action=HtmlInput::default_value_post('action', ''); /*******************************************************************************************/ // Add an attribut /*******************************************************************************************/ -if ( isset($_POST['add_line'])) +if ( $action == 'add_line') { $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); $fiche_def->InsertAttribut($_REQUEST['ad_id']); @@ -48,7 +48,7 @@ if ( isset($_POST['add_line'])) /*******************************************************************************************/ // Remove an attribut /*******************************************************************************************/ -if ( isset ($_POST['remove_line'])) +if ( $action == 'remove_line' ) { $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); @@ -60,7 +60,7 @@ if ( isset ($_POST['remove_line'])) /*******************************************************************************************/ // Try to remove a category /*******************************************************************************************/ -if ( isset ($_POST['remove_cat'])) +if ( $action == 'remove_cat' ) { $post_id=HtmlInput::default_value_post('fd_id', 0); if ($post_id == 0 || $post_id >= 500000) @@ -104,7 +104,7 @@ if ( isset ($_POST['change_name'])) /*******************************************************************************************/ // Save order of the attributes /*******************************************************************************************/ -if ( isset($_POST['save_line'])) +if ( $action == 'save_line' ) { $fiche_def=new Fiche_Def($cn,$_REQUEST['fd_id']); $fiche_def->save_order($_POST); diff --git a/include/cfgledger.inc.php b/include/cfgledger.inc.php index d27ad946c..ac618745f 100644 --- a/include/cfgledger.inc.php +++ b/include/cfgledger.inc.php @@ -42,7 +42,8 @@ $sa=HtmlInput::default_value("sa","",$_REQUEST); ////////////////////////////////////////////////////////////////////////// // Perform request action : update ////////////////////////////////////////////////////////////////////////// -if (isset($_POST['update'])) +$action_frm = HtmlInput::default_value_post('action_frm', ''); +if ( $action_frm == 'update') { try { @@ -60,7 +61,7 @@ if (isset($_POST['update'])) ////////////////////////////////////////////////////////////////////////// // Perform request action : delete ////////////////////////////////////////////////////////////////////////// -if (isset($_POST['efface'])) +if ($action_frm == 'delete' ) { $ledger->jrn_def_id=$_POST['p_jrn']; $ledger->id=$_POST['p_jrn']; @@ -115,11 +116,12 @@ switch ($sa) { $ledger->id=$_REQUEST['p_jrn']; echo '
'; - echo '
'; + echo ''; echo $ledger->display_ledger(); - echo ' + echo HtmlInput::hidden('action_frm',''); + echo ' - '; + '; $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier'])); echo ''._('Retour').''; echo ''; diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 701d9c313..d3724e179 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -225,7 +225,7 @@ class Acc_Ledger extends jrn_def_sql // Check return code if ($Res == false) - throw (new Exception(__FILE__ . __LINE__ . "sql a echoue [ $sql ]")); + throw new Exception(__FILE__ . __LINE__ . "sql a echoue [ $sql ]"); ////////////////////////////////////////////////// // Reverse in jrnx* tables @@ -264,7 +264,7 @@ class Acc_Ledger extends jrn_def_sql FROM quant_sold where j_id=$3", array($p_internal, $j_id, $row)); if ($Res == false) - throw (new Exception(__FILE__ . __LINE__ . "sql a echoue [ $sql ]")); + throw new Exception(__FILE__ . __LINE__ . "sql a echoue [ $sql ]"); $Res = $this->db->exec_sql("INSERT INTO quant_purchase( qp_internal, j_id, qp_fiche, qp_quantite, qp_price, qp_vat, qp_vat_code, qp_nd_amount, qp_nd_tva, qp_nd_tva_recup, qp_supplier, @@ -275,7 +275,7 @@ class Acc_Ledger extends jrn_def_sql FROM quant_purchase where j_id=$3", array($p_internal, $j_id, $row)); if ($Res == false) - throw (new Exception(__FILE__ . __LINE__ . "SQL ERROR [ $sql ]")); + throw new Exception(__FILE__ . __LINE__ . "SQL ERROR [ $sql ]"); } $sql = "insert into jrn ( jr_id, diff --git a/include/class_document_type.php b/include/class_document_type.php index d66e60db9..c674731b4 100644 --- a/include/class_document_type.php +++ b/include/class_document_type.php @@ -71,7 +71,7 @@ class Document_type $tmp['dt_value'] = $r[$i]['dt_value']; $tmp['dt_prefix'] = $r[$i]['dt_prefix']; - $bt = new IButton('X' . $r[$i]['dt_id']); + $bt = new IButton('M' . $r[$i]['dt_id']); $bt->label = _('Modifier'); $bt->javascript = "cat_doc_change('" . $r[$i]['dt_id'] . "','" . Dossier::id() . "');"; @@ -80,9 +80,8 @@ class Document_type $bt = new IButton('X' . $r[$i]['dt_id']); $bt->label = _('Effacer'); - $bt->javascript = "if (confirm('" . _('Vous confirmez') . "')==true) {"; - $bt->javascript.="cat_doc_remove('" . $r[$i]['dt_id'] . "','" . Dossier::id() . "');"; - $bt->javascript.='}'; + $bt->javascript = "confirm_form('X{$r[$i]['dt_id']}','" . _('Vous confirmez') . "',"; + $bt->javascript.="function () { cat_doc_remove('{$r[$i]['dt_id']}','" . Dossier::id() . "');})"; $tmp['js_remove'] = $bt->input(); diff --git a/include/class_fiche_def.php b/include/class_fiche_def.php index 4f2356bf7..495b91e64 100644 --- a/include/class_fiche_def.php +++ b/include/class_fiche_def.php @@ -766,17 +766,22 @@ $order /* attributes */ $r.='
'._('Détails').''; - $r.= '
'; + $r.= ''; $r.=dossier::hidden(); $r.=HtmlInput::hidden("fd_id", $this->id); + $r.=HtmlInput::hidden("action", ""); $r.= $this->DisplayAttribut("remove"); - $r.= HtmlInput::submit('add_line', _('Ajoutez cet élément')); - $r.= HtmlInput::submit("save_line", _("Sauvez")); - $r.=HtmlInput::submit('remove_cat', _('Effacer cette catégorie'), 'onclick="return confirm(\'' . _('Vous confirmez ?') . '\')"'); + $r.= HtmlInput::submit('add_line_bt', _('Ajoutez cet élément'), + 'onclick="$(\'action\').value=\'add_line\'"'); + $r.= HtmlInput::submit("save_line_bt", _("Sauvez"), + 'onclick="$(\'action\').value=\'save_line\'"'); + + $r.=HtmlInput::submit('remove_cat_bt', _('Effacer cette catégorie'), 'onclick="$(\'action\').value=\'remove_cat\';return confirm_form(\'input_detail_frm\',\'' . _('Vous confirmez ?') . '\')"'); // if there is nothing to remove then hide the button if (strpos($r, "chk_remove") != 0) { - $r.=HtmlInput::submit('remove_line', _("Enleve les éléments cochés"), "onclick=\"return confirm('Vous confirmez?')\""); + $r.=HtmlInput::submit('remove_line_bt', _("Enleve les éléments cochés"), + 'onclick="$(\'action\').value=\'remove_line\';return confirm_form(\'input_detail_frm\',\'' . _('Vous confirmez ?') . '\')"'); } $r.= ""; $r.="

" . _("Attention : il n'y aura pas de demande de confirmation pour enlever les diff --git a/include/class_follow_up.php b/include/class_follow_up.php index 474ea1fd2..77d580df8 100644 --- a/include/class_follow_up.php +++ b/include/class_follow_up.php @@ -1083,7 +1083,7 @@ class Follow_Up function get_last($p_limit) { - $sql="select coalesce(vw_name,'Interne') as vw_name,ag_id,ag_title,ag_ref, dt_value,to_char(ag_timestamp,'DD.MM.YYYY') as ag_timestamp_fmt,ag_timestamp ". + $sql="select coalesce(vw_name,'Interne') as vw_name,quick_code,ag_id,ag_title,ag_ref, dt_value,to_char(ag_timestamp,'DD.MM.YYYY') as ag_timestamp_fmt,ag_timestamp ". " from action_gestion join document_type ". " on (ag_type=dt_id) " . "left join vw_fiche_attr on (f_id=f_id_dest) " diff --git a/include/class_html_input.php b/include/class_html_input.php index ceb700ad1..ed745e56c 100755 --- a/include/class_html_input.php +++ b/include/class_html_input.php @@ -901,10 +901,10 @@ class HtmlInput */ static function button_action_remove_operation($p_operation) { - $rmOperation=sprintf("javascript:if ( confirm('"._('Voulez-vous effacer cette relation ')."')==true ) {remove_operation('%s','%s');}", + $rmOperation=sprintf("javascript:confirm_form(null,'"._('Voulez-vous effacer cette relation ')."',function () {remove_operation('%s','%s');});", dossier::id(), $p_operation); - $js= ''.SMALLX.''; + $js= ''.SMALLX.''; return $js; } static function button_action_add_concerned_card($p_agid) diff --git a/include/class_periode.php b/include/class_periode.php index 228ccea8a..1e35c4558 100644 --- a/include/class_periode.php +++ b/include/class_periode.php @@ -239,7 +239,8 @@ class Periode $change='

'; $remove=sprintf(_('Nombre opérations %d'),$l_line['count_op']); $remove=td($remove,' class="mtitle" '); - $change=td (' Réouverture',' class="mtitle"'); + $change=td (' Réouverture',' class="mtitle"'); } else @@ -261,8 +262,14 @@ class Periode if ($l_line['count_op'] == 0 ) { - $remove.=' Efface"; + $go='do.php?'.http_build_query(array('ac'=>$_REQUEST['ac'], + 'action'=>'delete_per', + 'p_per'=>$l_line['p_id'], + 'gDossier'=>Dossier::id())); + + $remove.='' + . ' Efface'; } else { @@ -358,8 +365,14 @@ class Periode $closed=""; if ( $l_line['status'] != 'OP' ) { - $closed=td (' Réouverture',' class="mtitle"'); - // $closed=($l_line['status']=='CE')?'':''; + $go='do.php?'.http_build_query(array('ac'=>$_REQUEST['ac'], + 'action'=>'reopen', + 'p_per'=>$l_line['p_id'], + 'gDossier'=>Dossier::id(), + 'jrn_def_id'=>$this->jrn_def_id)); + + $closed=td (' Réouverture',' class="mtitle"'); } echo "$closed"; diff --git a/include/forecast.inc.php b/include/forecast.inc.php index 77dd7256c..abe3a7227 100644 --- a/include/forecast.inc.php +++ b/include/forecast.inc.php @@ -26,6 +26,8 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); require_once NOALYSS_INCLUDE.'/class_anticipation.php'; +$action=HtmlInput::default_value_get('action',''); + echo '
'; $sa = (isset($_REQUEST['sa'])) ? $_REQUEST['sa'] : 'list'; @@ -34,7 +36,7 @@ $sa = (isset($_REQUEST['sa'])) ? $_REQUEST['sa'] : 'list'; * * * ******************************************************************** */ -if (isset($_GET['del'])) +if ( $action == 'del' ) { $forecast = new Forecast($cn, $_GET['f_id']); $forecast->delete(); @@ -42,7 +44,7 @@ if (isset($_GET['del'])) /* * Cloning */ -if (isset($_REQUEST ['clone'])) +if ( $action == 'clone' ) { echo "

cloning

"; /* @@ -274,7 +276,7 @@ if ($sa == 'new') * * * ******************************************************************** */ -if (isset($_GET['mod_cat'])) +if ( $action == 'mod_cat') { $anc = new Anticipation($cn, $_GET['f_id']); echo '
'; @@ -295,20 +297,13 @@ if (isset($_GET['mod_cat'])) * * * ******************************************************************** */ -if (isset($_GET['mod_item'])) +if ($action == 'mod_item' ) { /* Propose a form for the items */ $anticip = new Anticipation($cn, $_GET['f_id']); echo '
'; - echo ICard::ipopup('ipopcard'); - echo IPoste::ipopup('ipop_account'); - $search_card = new IPopup('ipop_card'); - $search_card->title = _('Recherche de fiche'); - $search_card->value = ''; - echo $search_card->input(); - echo '
'; echo dossier::hidden(); echo HtmlInput::hidden('sa', 'new'); @@ -334,14 +329,15 @@ if (isset($_REQUEST['f_id']) && $sa == "vw") { echo $forecast->display(); echo '
'; - echo ''; + echo ''; echo dossier::hidden(); + echo HtmlInput::hidden('action',''); echo HtmlInput::hidden('f_id', $_REQUEST['f_id']); - echo HtmlInput::submit('mod_cat', _('Modifier nom ou catégories')); - echo HtmlInput::submit('mod_item', _('Modifier éléments')); + echo HtmlInput::submit('mod_cat_bt', _('Modifier nom ou catégories'),'onclick="$(\'action\').value=\'mod_cat\';"'); + echo HtmlInput::submit('mod_item_bt', _('Modifier éléments'),'onclick="$(\'action\').value=\'mod_item\';"'); //echo HtmlInput::submit('cvs',_('Export CVS')); - echo HtmlInput::submit('del', _('Effacer'), 'onclick="return confirm(\'' . _('Vous confirmez l\\\' effacement') . '\')"'); - echo HtmlInput::submit('clone', _('Cloner'), 'onclick="return confirm(\'' . _('Vous confirmez le clonage ') . '\')"'); + echo HtmlInput::submit('del_bt', _('Effacer'), 'onclick="$(\'action\').value=\'del\';return confirm_form(\'forecast_frm\',\'' . _('Vous confirmez l\\\' effacement') . '\')"'); + echo HtmlInput::submit('clone_bt', _('Cloner'), 'onclick="$(\'action\').value=\'clone\';return confirm_form(\'forecast_frm\',\'' . _('Vous confirmez le clonage ') . '\')"'); echo HtmlInput::hidden('ac', $_REQUEST['ac']); $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier'])); echo ''._('Retour').''; diff --git a/include/menu.inc.php b/include/menu.inc.php index 727c2f049..06e8fc97c 100644 --- a/include/menu.inc.php +++ b/include/menu.inc.php @@ -46,7 +46,6 @@ if ( isset($_POST['save_plugin'])) $plugin->me_description=$me_description; $plugin->me_parameter='plugin_code='.$me_code; $plugin->insert_plugin(); - $plugin->insert_profile_module(); } /** * if post update then we update diff --git a/include/preod.inc.php b/include/preod.inc.php index 2a2314358..b48c233d9 100644 --- a/include/preod.inc.php +++ b/include/preod.inc.php @@ -97,7 +97,7 @@ if ( $request_sa== 'jrn' ) echo '
'; echo ''; echo 'label=SMALLX; $rmReconciliation->class="tinybutton"; - $rmReconciliation->javascript="if (confirm ('vous confirmez?') ) {"; - $rmReconciliation->javascript.=sprintf('dropLink(\'%s\',\'%s\',\'%s\',\'%s\');deleteRowRec(\'%s\',this);}', + $rmReconciliation->javascript="return confirm_form(null,'"._("vous confirmez?")."',"; + $rmReconciliation->javascript.=sprintf('function () { dropLink(\'%s\',\'%s\',\'%s\',\'%s\');deleteRowRec(\'%s\',$(\'row%d\'));})', $gDossier, $div, $jr_id, $aRap[$e], - $tableid + $tableid, + $e ); if ( $access=='W') $remove=$rmReconciliation->input(); @@ -182,7 +183,11 @@ if ($aRap != null ) { $remove=''; $comment=strip_tags($array_jr[0]['jr_comment']); - echo tr (td(format_date($array_jr[0]['jr_date'])).td(''.$internal.'').td($comment).td(nbm($amount)).td($remove)); + echo tr (td(format_date($array_jr[0]['jr_date'])). + td(''.$internal.''). + td($comment). + td(nbm($amount)). + td($remove),' id = "row'.$e.'"'); } echo '
CentraliseeFermée'.h($row['od_name']).''.h($row['od_description']).''; - echo ''; + echo ''; echo dossier::hidden(); echo $hid->input("sa","del"); echo $hid->input("ac",$request_ac); @@ -106,7 +106,7 @@ if ( $request_sa== 'jrn' ) echo $hid->input("jrn",$get_jrn); $b=''; + ' onClick="return confirm_form(\'preod_frm\',\''._("Voulez-vous vraiment effacer cette operation ?").'\');" >'; echo $b; echo ''; diff --git a/include/template/anc_key_input.php b/include/template/anc_key_input.php index 470dc6f0b..c1c7b762e 100644 --- a/include/template/anc_key_input.php +++ b/include/template/anc_key_input.php @@ -203,10 +203,10 @@ -
+ key->getp('id')); - if ($this->key->getp('id') != -1) echo HtmlInput::submit('delete_key', _('Effacer'),'onclick="return confirm(\''._('Confirmer effacement?').'\')"'); ?> + if ($this->key->getp('id') != -1) echo HtmlInput::submit('delete_key', _('Effacer'),'onclick="return confirm_form(\'anc_key_input_frm\',\''._('Confirmer effacement?').'\')"'); ?>
\ No newline at end of file diff --git a/include/template/dashboard.php b/include/template/dashboard.php index a4e422188..89737313c 100644 --- a/include/template/dashboard.php +++ b/include/template/dashboard.php @@ -286,7 +286,6 @@ for($i=0;$i
- + diff --git a/include/template/detail-action.php b/include/template/detail-action.php index 0076ac712..82fd88fb2 100644 --- a/include/template/detail-action.php +++ b/include/template/detail-action.php @@ -193,11 +193,11 @@ { if ( $p_view != 'READ' && $p_base != 'ajax') { - $rmAction=sprintf("javascript:if ( confirm('"._('Voulez-vous effacer cette action ')."')==true ) {remove_action('%s','%s','%s');}", + $rmAction=sprintf("return confirm_form(null,'"._('Voulez-vous effacer cette action ')."', function () {remove_action('%s','%s','%s');});", dossier::id(), $action[$o]['ag_id'],$_REQUEST['ag_id']); $showAction=''; - $js= ''.SMALLX.''; + $js= ''.SMALLX.''; echo '
  • '.$showAction.$action[$o]['str_date']." ".$action[$o]['ag_ref']." ". h($action[$o]['sub_title']).'('.h($action[$o]['dt_value']).')'." " .$js.'
  • '; @@ -271,10 +271,10 @@ for( $c=0;$c'.SMALLX.''; + $js= ''.SMALLX.''; echo hb('n°'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ".$acomment[$c]['str_agc_date'].')').$js. '
     '.
     				" ".h($acomment[$c]['agc_comment']).'
    ' @@ -462,14 +462,14 @@ for ($i=0;$i -
    - " href=""> + " href="javascript:void(0)" onclick="">
    '; } @@ -291,7 +296,7 @@ if ( $div != 'popup' ) { { $remove=new IButton('Effacer'); $remove->label=_('Effacer'); - $remove->javascript="if ( confirm('Vous confirmez effacement ?')) {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')}"; + $remove->javascript="return confirm_form(null,'Vous confirmez effacement ?',function () {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')})"; echo $remove->input(); } @@ -304,8 +309,9 @@ echo ''; echo '