diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 2e2e258f3..9a74ce07c 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -257,7 +257,15 @@ $path = array( // payment_method "payment_method"=>"ajax_payment_method", // update list of predefined operation if ledger changes - "up_predef"=>"ajax_update_predef" + "up_predef"=>"ajax_update_predef", + // cfgaction type of document + "cfgaction"=>'ajax_cfgaction', + // list options for multiple contact + "contact_option_list"=>'ajax_contact_option_list', + // Add group of tags + 'tag_group'=>'ajax_tag_group', + // set the group for a tag + 'tag_set_group'=>"ajax_tag_set_group" ) ; if (array_key_exists($op, $path)) { @@ -388,58 +396,8 @@ EOF; EOF; break; - /* rem a cat of document */ - case 'rem_cat_doc': - require_once NOALYSS_INCLUDE.'/class/document_type.class.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; - } - // remove the cat if no action - $count_md = $cn->get_value('select count(*) from document_modele where md_type=$1', array($dt_id)); - $count_a = $cn->get_value('select count(*) from action_gestion where ag_type=$1', array($dt_id)); + - 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; - } - $cn->exec_sql('delete from document_type where dt_id=$1', array($dt_id)); - $html = $dt_id; - header('Content-type: text/xml; charset=UTF-8'); - echo << - -$html -$message - -EOF; - return; - break; - case 'mod_cat_doc': - require_once NOALYSS_TEMPLATE.'/document_mod_change.php'; - break; case 'dsp_tva': $cn = Dossier::connect(); // Filter the VAT diff --git a/html/do.php b/html/do.php index c957df934..49a2dccea 100644 --- a/html/do.php +++ b/html/do.php @@ -241,8 +241,10 @@ if (isset($_REQUEST['ac'])) fclose($file_loginput); } - $_REQUEST['ac']= trim(strtoupper($_REQUEST['ac'])); - $AC=$http->request('ac'); + $ac_post = trim(strtoupper($http->post("ac","string",""))); + $ac_get = trim(strtoupper($http->get("ac","string",""))); + + $AC=($ac_post == "")?$ac_get:$ac_post; $user_profile=$g_user->get_profile(); diff --git a/html/export.php b/html/export.php index d32bc4975..9b5044c2c 100644 --- a/html/export.php +++ b/html/export.php @@ -50,6 +50,7 @@ if ( $action=='X' || $g_user->check_print($action)==0 ) $prfile=$cn->get_value("select me_file from menu_ref where me_code=$1",array($action)); if ( $prfile == "") { + print $action; die (_('Export impossible')); } require_once NOALYSS_INCLUDE."/export/$prfile"; diff --git a/html/fid.php b/html/fid.php index 814a28376..2b6c38964 100644 --- a/html/fid.php +++ b/html/fid.php @@ -115,7 +115,7 @@ if ( isset($_SESSION['isValid']) && $_SESSION['isValid'] == 1) from vw_fiche_attr where quick_code=upper($1)". $filter_card; - $array=$cn->get_array($sql, array($_REQUEST['FID'])); + $array=$cn->get_array($sql, array($hi->request('FID'))); if ( empty($array)) { diff --git a/html/fid_card.php b/html/fid_card.php index 0c66dec21..d01a89b86 100644 --- a/html/fid_card.php +++ b/html/fid_card.php @@ -118,13 +118,15 @@ else } } } +// filter only enable card +$filter_enable_card=" and f_id in (select f_id from fiche_detail where ad_value = '1' and ad_id=54) "; $sql_str="select distinct f_id from fiche join fiche_detail using (f_id) where ad_id in (9,1,23) - and ad_value ilike '%'||$1||'%' ".$filter_card.' limit '.$limit; + and ad_value ilike '%'||$1||'%' ".$filter_enable_card.$filter_card.' limit '.$limit; $fid=$http->request("FID"); diff --git a/html/js/card.js b/html/js/card.js index 8c7b918ad..3e9c112fd 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -33,7 +33,7 @@ function boxsearch_card(p_dossier) { waiting_box(); removeDiv('boxsearch_card_div'); - var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI($(card_search).value); + var queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI($("card_search").value); var action = new Ajax.Request( "ajax_misc.php" , { @@ -57,14 +57,15 @@ function boxsearch_card(p_dossier) /** * show the ipopup with the form to search a card * the properties - * - jrn for the ledger - * - fs for the action - * - price for the price of the card (field to update) - * - tvaid for the tvaid of the card (field to update) - * - inp input text to update with the quickcode - * - label field to update with the name - * - ctl the id to fill with the HTML answer (ending with _content) - * - acc 1 if accounting are visible + * @param obj + * @param {int} obj.jrn for the ledger + * @param {int} obj.fs route to the action + * @param {string} obj.price for the price of the card (field to update) + * @param {string} obj.tvaid for the tvaid of the card (field to update) + * @param {string} obj.inp input text to update with the quickcode + * @param {string} obj.label field to update with the name + * @param {string} obj.ctl the id to fill with the HTML answer (ending with _content) + * @param {int} obj.acc 1 if accounting are visible */ function search_card(obj) { @@ -78,6 +79,13 @@ function search_card(obj) var price=obj.price; var tvaid=obj.tvaid; var jrn=obj.jrn; + var inactive_card=0; + if ( obj.inactive_card) {inactive_card=obj.inactive_card.value;} + var amount_from_type=0; + if ( obj.amount_from_type) { + amount_from_type=obj.amount_from_type; + + } if ( jrn==undefined) { if ( g('p_jrn')) { @@ -97,7 +105,9 @@ function search_card(obj) 'inp':inp,'label':label,'price':price,'tvaid':tvaid, 'ctl':'search_card','op2':'fs','jrn':jrn, 'typecard':typecard,'query':string_to_search,'op':'card', - 'accvis':accvis + 'accvis':accvis, + 'amount_from_type':amount_from_type, + 'inactive_card':inactive_card }); if ( $('search_card') ) { removeDiv('search_card'); @@ -122,16 +132,63 @@ function search_card(obj) } } /** - * Display form for select card to add to action : other_concerned - *action_add_concerned_card + * Display found card and let you select several to link them to an action-followup + * @param {obj} obj form object + * @param {obj} obj form object */ -function action_add_concerned_card(obj) +function action_concerned_save_card(obj) +{ + try { + waiting_box(); + // get all data from FORM + var query = obj.serialize(); + new Ajax.Request("ajax_misc.php", { + method: "POST", + parameters: query, + onSuccess: function (req) { + remove_waiting_box(); + 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); + $(namectl).update(code_html); + removeDiv('search_card'); + } + }); + } catch (e) + { + + alert_box('action_concerned_save_card' + e.message); + return false; + } + return false; +} +/** + * Display form for searching cards to add to action-follow-up + *@see ajax_add_concerned_card.php + *@param {object} obj form object + *@param obj.elements.ag_id id of the action (elements) + *@param obj.elements.gDossier folder id + *@param obj.elements.query + */ +function action_concerned_search_card(obj) { try { var dossier = 0; var inp=""; var ag_id=0; + var search_in=-1; + var inactive_card=0; + var search_cat=-1; if (obj.dossier) { dossier = obj.dossier; /* From the button */ @@ -153,6 +210,15 @@ function action_add_concerned_card(obj) if (obj.elements['ag_id']) { ag_id = obj.elements['ag_id'].value; } + if (obj.elements['search_in']) { + search_in = obj.elements['search_in'].value; + } + if ( obj.elements['inactive_card']) { + inactive_card=obj.elements['inactive_card'].value; + } + if ( obj.elements['search_cat']) { + search_cat=obj.elements['search_cat'].value; + } } if (dossier == 0) { throw "obj.dossier not found"; @@ -167,7 +233,10 @@ function action_add_concerned_card(obj) 'ctl' : 'unused', 'ag_id' : ag_id, 'op':'card', - 'accvis':0 + 'accvis':0, + 'search_in':search_in, + 'inactive_card':inactive_card, + 'search_cat':search_cat }); waiting_box(); @@ -204,7 +273,7 @@ function action_add_concerned_card(obj) { sx = document.body.scrollTop + 60; } - var div_style = "top:" + sx + "px;height:80%"; + var div_style = "top:" + sx + "px;height:52rem"; if ( ! $('search_card')) { add_div({id: 'search_card', cssclass: 'inner_box', html: "", style: div_style, drag: true}); } $('search_card').innerHTML = code_html; $('query').focus(); @@ -273,8 +342,20 @@ function search_get_card(obj) queryString+="&accvis="+$F(accvis); } else { queryString+="&accvis=0"; + } + if ( obj.elements['amount_from_type']) { + queryString+="&amount_from_type="+obj.elements['amount_from_type'].value; } + if (obj.elements['page_card']) { + queryString+="&page_card="+obj.elements["page_card"].value; + } + if ( obj.elements["inactive_card"]) { + queryString+="&inactive_card="+obj.elements["inactive_card"].value; + } + + queryString=encodeURI(queryString); $('asearch').innerHTML=loading(); + var action=new Ajax.Request ( 'ajax_misc.php', { method:'get', @@ -949,7 +1030,7 @@ try { * @param {type} p_action_id action_gestion.ag_id * @returns {undefined} nothing */ -function action_save_concerned(p_dossier, p_fiche_id, p_action_id) { +function action_save_concerned(p_form_id) { var query = encodeJSON({'gDossier': p_dossier, 'f_id': p_fiche_id, 'ag_id': p_action_id,'op':'card','op2':'action_save_concerned','ctl':'unused'}); var a=new Ajax.Request('ajax_misc.php', { @@ -1218,4 +1299,51 @@ function card_update_row(obj) alert_box(e.message); return false; } +} +/** + * Display the option of a contact linked in a action-followup + * @param {int} p_action_person_id action_person.ap_id + * @param {int} p_dossier current folder + */ +function linked_card_option(p_action_person_id,p_dossier) { + try { + waiting_box(); + new Ajax.Request("ajax_misc.php",{ + method:"get", + parameters: { + ap_id:p_action_person_id, + gDossier:p_dossier, + op:"card", + op2:"display_card_option", + ctl:"notused" + }, + onSuccess:function(req) { + remove_waiting_box(); + add_div({ "id":"d_linked_card_option",cssclass:"inner_box",style:"position:fixed;top:30%;min-width:20rem;width:auto;",drag:0}); + $("d_linked_card_option").update(req.responseText); + + } + }); + } catch (e) { + console.error(e.message); + } +} +/** + * Save option for the contact + * @param {object} obj form + * @see card_multiple_display_option.php + * @returns {undefined} + */ +function save_linked_card_option(obj) +{ + waiting_box(); + new Ajax.Request("ajax_misc.php",{ + method:"post", + parameters:obj.serialize(), + onSuccess:function(req) { + remove_waiting_box(); + removeDiv("d_linked_card_option"); + } + }); + return false; } \ No newline at end of file diff --git a/html/js/scripts.js b/html/js/scripts.js index 7a469d632..66c9c832f 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -24,9 +24,28 @@ * */ var ask_reload = 0; -var tag_choose = ''; +// tag_choose Element which contains all the selected tags +var tag_choose = ''; var aDraggableElement = new Array(); - +/** + * return undefined if nothing is found , otherwise return the DOM elemnt + * @param {type} p_name_dom + * @param {type} name_child + * @returns {undefined} + */ +function in_child(p_element,name_child) { + var element=p_element + if ( typeof p_element !== "object" ) { + element=document.getElementById(p_element); + + } + if ( ! element ) return undefined; + for ( var e=0; e < element.childElementCount;e++) { + if ( element.childNodes[e].id == name_child) { + return element.childNodes[e]; + } + } +} /** * callback function when we just need to update a hidden div with an info * message @@ -1304,6 +1323,7 @@ function search_reconcile(dossier, ctl_concern, amount_id, ledger, p_id_target, str_style += ";width:92%;overflow:auto;"; waiting_box(); var hide_operation = $(ctl_concern).getAttribute("hide_operation"); + var single_operation = $(ctl_concern).getAttribute("single_operation"); var param_send = {gDossier: dossier, ctlc: ctl_concern, @@ -1313,7 +1333,8 @@ function search_reconcile(dossier, ctl_concern, amount_id, ledger, p_id_target, ledger: ledger, target: target, tiers: tiers, - hide_operation: hide_operation + hide_operation: hide_operation, + single_operation:single_operation }; var qs = encodeJSON(param_send); @@ -1381,6 +1402,7 @@ function set_reconcile(obj) if (!obj.elements['target']) return; var target = obj.elements['target'].value; + var single_operation = obj.elements['single_operation'].value; for (var e = 0; e < obj.elements.length; e++) { @@ -1414,7 +1436,12 @@ function set_reconcile(obj) }); } } - $(ctlc.value).value += nValue; + if (single_operation==0) { + $(ctlc.value).value += nValue; + } else { + $(ctlc.value).value = nValue; + + } } } } @@ -2107,7 +2134,13 @@ function view_action(ag_id, dossier, modify) }); $(id).innerHTML = code_html; if (ctl_txt == 'ok') { - compute_all_ledger(); + // compute detail + var detail=in_child(id,"follow_up_detail"); + if (detail) { + compute_all_ledger(); + } + + } code_html.evalScripts(); } catch (e) { @@ -2455,7 +2488,7 @@ function show_tag(p_dossier, p_ac, p_tag_id, p_post) code_html = unescape_xml(code_html); remove_waiting_box(); var posy = calcy(250); - add_div({id: 'tag_div', cssclass: 'inner_box', drag: 0, style: "position:fixed;top:" + posy + "px"}); + add_div({id: 'tag_div', cssclass: 'inner_box', drag: 0, style: "position:fixed;top:15%;"}); $('tag_div').innerHTML = code_html; try { @@ -2542,13 +2575,14 @@ function action_tag_select(p_dossier, ag_id) * @brief Add the current tag to the current ag_id * @param {type} p_dossier * @param {type} ag_id + * @param p_isgroup g it is a group , t is a single tag * @returns {undefined} */ -function action_tag_add(p_dossier, ag_id, t_id) +function action_tag_add(p_dossier, ag_id, t_id,p_isgroup) { try { waiting_box(); - var queryString = "t_id=" + t_id + "&ag_id=" + ag_id + "&op=tag_add&gDossier=" + p_dossier; + var queryString = "t_id=" + t_id + "&ag_id=" + ag_id + "&op=tag_add&gDossier=" + p_dossier+"&isgroup="+p_isgroup; var action = new Ajax.Request( "ajax_misc.php", { @@ -2679,8 +2713,10 @@ function search_display_tag(p_dossier, p_prefix) * in the search screen * @param {type} p_dossier * @param {type} p_tag_id + * @param p_prefix is the prefix of the widget + * @param p_obj is either g for group of tag or t for a single tag */ -function search_add_tag(p_dossier, p_tag_id, p_prefix) +function search_add_tag(p_dossier, p_tag_id, p_prefix,p_obj) { try { var clear_button = 0; @@ -2689,7 +2725,7 @@ function search_add_tag(p_dossier, p_tag_id, p_prefix) clear_button = 1; } waiting_box(); - var queryString = "op=search_add_tag&gDossier=" + p_dossier + "&id=" + p_tag_id + "&clear=" + clear_button + '&pref=' + p_prefix; + var queryString = "op=search_add_tag&gDossier=" + p_dossier + "&id=" + p_tag_id + "&clear=" + clear_button + '&pref=' + p_prefix+"&obj="+p_obj; var action = new Ajax.Request( "ajax_misc.php", { @@ -3049,6 +3085,8 @@ function alert_box(p_message) function alternate_row_color(p_table) { var table_colored=$(p_table); + if (! table_colored.tBodies[0] ) return; + var len = table_colored.tBodies[0].rows.length; var i = 0; var localClass = ""; @@ -3666,6 +3704,27 @@ function toggle_row_warning_enable(p_enable, p_row) } } +/** + * return a json object which is the merge of the 2 json objects + * from 2015 : Object.assign(obj1, obj2); + * @param p_json1 object 1 to merge + * @param p_json2 object 2 to merge + * @returns new json object + */ +function json_concat(p_json1,p_json2) +{ + + var result = {}; + for (var key in p_json1) { + result[key] = p_json1[key]; + } + for (var key in p_json2) { + result[key] = p_json2[key]; + } + return result; + +} + /** * return a json object which is the merge of the 2 json objects * from 2015 : Object.assign(obj1, obj2); diff --git a/html/js/taggroup.js b/html/js/taggroup.js new file mode 100644 index 000000000..b159a0f6c --- /dev/null +++ b/html/js/taggroup.js @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2020 Dany De Bontridder + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +// Copyright (2002-2020) Author Dany De Bontridder + + +var TagGroup = function () +{ + this.callback = "ajax_misc.php"; + this.param_operation = "tag_set_group"; + this.list_tag = "ol_tag_group"; + this.div_tag_add = "d_tag_group_add"; + /** + * Add a tag to group and redraw the div "div_tag_add" + * @param {int} p_tag_group_id + * @param {int} p_tag_id + * @param {int} p_dossier + */ + this.add_tag = function (p_tag_group_id, p_select, p_dossier) { + waiting_box(); + // retrieve value from p_select + var p_tag_id = $(p_select).value; + new Ajax.Request(this.callback, { + method: "get", + parameters: {op: this.param_operation, gDossier: p_dossier, act: "add", tag_group: p_tag_group_id, tag: p_tag_id}, + onSuccess: function (req) { + remove_waiting_box(); + // redraw div_tag_add + $("d_tag_group_add").update(req.responseText); + } + }); + }; + /** + * removing a tag from a group and redraw the div "div_tag_add" + * @param {int} p_tag_group_id + * @param {int} p_tag_id + * @param {int} p_dossier + */ + this.remove = function (p_jt_tag, p_dossier) { + waiting_box(); + + new Ajax.Request(this.callback, { + method: "get", + parameters: {op: this.param_operation, + gDossier: p_dossier, + act: "remove", + jt_tag: p_jt_tag + }, + onSuccess: function (req) { + remove_waiting_box(); + // redraw div_tag_add + $("d_tag_group_add").update(req.responseText); + } + }); + }; +}; \ No newline at end of file diff --git a/html/style-classic.css b/html/style-classic.css index 6874bcbc2..e163c16e4 100644 --- a/html/style-classic.css +++ b/html/style-classic.css @@ -2434,10 +2434,17 @@ span.title_tab_row { color : white !important; } +p.info { + font-size:90%; + font-family: sans-serif; + font-style: italic; +} - /** - * dialog box for adding, modifying predefined operation - */ - #prdfop { - - } \ No newline at end of file +/* Cell with tag */ +span.tagcell { + border:1px solid darkgray; + padding:2px;margin:1px; + display: inline-block; + color:black; + +} diff --git a/html/style-classic7.css b/html/style-classic7.css index 46fd2eba9..abbbcc316 100644 --- a/html/style-classic7.css +++ b/html/style-classic7.css @@ -2469,9 +2469,16 @@ span.title_tab_row { color : white !important; } -/** - * dialog box for adding, modifying predefined operation - */ -#prdfop { +p.info { + font-size:90%; + font-family: sans-serif; + font-style: italic; +} -} \ No newline at end of file +/* Cell with tag */ +span.tagcell { + border-radius:3px; + border:1px solid darkblue; + padding:3px;margin:1px; + display: inline-block; +} \ No newline at end of file diff --git a/html/style-light.css b/html/style-light.css index 6474f1d2d..8384b90c1 100644 --- a/html/style-light.css +++ b/html/style-light.css @@ -2367,11 +2367,17 @@ span.title_tab_row { background-color: #000066 !important; color : white !important; +} +p.info { + font-size:90%; + font-family: sans-serif; + font-style: italic; } - /** - * dialog box for adding, modifying predefined operation - */ - #prdfop { - - } \ No newline at end of file + /* Cell with tag */ +span.tagcell { + border:1px solid blue; + padding:1px;margin:1px; + display: inline-block; + color:black; +} diff --git a/include/action.common.inc.php b/include/action.common.inc.php index 59d9041f3..257915c3e 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -30,18 +30,20 @@ * */ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); +$http=new HttpInput(); $supl_hidden = ''; if (isset($_REQUEST['sc'])) - $supl_hidden.=HtmlInput::hidden('sc', $_REQUEST['sc']); + $supl_hidden.=HtmlInput::hidden('sc', $http->request("sc")); if (isset($_REQUEST['f_id'])) - $supl_hidden.=HtmlInput::hidden('f_id', $_REQUEST['f_id']); + $supl_hidden.=HtmlInput::hidden('f_id', $http->request("f_id","number")); if (isset($_REQUEST['sb'])) - $supl_hidden.=HtmlInput::hidden('sb', $_REQUEST['sb']); -$supl_hidden.=HtmlInput::hidden('ac', $_REQUEST['ac']); + $supl_hidden.=HtmlInput::hidden('sb', $http->request("sb")); +$supl_hidden.=HtmlInput::hidden('ac', $http->request("ac")); + $correction = 0; $error_id=0; -$http=new HttpInput(); + /*-----------------------------------------------------------------------------*/ /* For other action /*-----------------------------------------------------------------------------*/ @@ -207,21 +209,29 @@ if ($sub_action == 'detail') $act->ag_id = $ag_id; echo $act->get(); } + if ($g_user->can_write_action($ag_id) == true) { - echo '
'; - echo $supl_hidden; - echo HtmlInput::hidden('ac', $_REQUEST['ac']); - echo dossier::hidden(); - echo $act->Display('UPD', false, $base, $retour); - echo ''; - 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_box(\'action_common_frm\',\''. _("Vous confirmez l\'effacement") . '\')" '); - echo $retour; - echo '
'; + + echo '
'; + echo $supl_hidden; + echo HtmlInput::hidden('ac', $http->request('ac')); + echo dossier::hidden(); + echo $act->Display('UPD', false, $base, $retour); + echo ''; + 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"'); + + // + if ($g_user->can_delete_action($ag_id)) + { + echo HtmlInput::submit("delete_bt", _("Efface cet événement "), + ' onclick="$(\'delete\').value=1;return confirm_box(\'action_common_frm\',\''. _("Vous confirmez l\'effacement") . '\')" '); + } + echo $retour; + echo '
'; } else if ($g_user->can_read_action($ag_id) == true || $act->ag_dest == -1) { @@ -245,7 +255,7 @@ if ($sub_action == 'delete') $act = new Follow_Up($cn); $act->ag_id =$http->request("ag_id","number") ; $act->get(); - if ($g_user->can_write_action($act->ag_id)==true) $act->remove(); + if ($g_user->can_delete_action($act->ag_id)==true) $act->remove(); $sub_action = "list"; $cn->commit(); Follow_Up::show_action_list($cn, $base); @@ -277,12 +287,13 @@ if ($sub_action == "save_action_st2") $act->fromArray($_POST); try { $act->d_id = 0; + $act->ag_id=$http->request("ag_id","number"); $act->md_id = (isset($_POST['gen_doc'])) ? $_POST['gen_doc'] : 0; $act->verify(); // insert into action_gestion - echo $act->save(); + echo $act->update(); $url = "?$base&sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get(); echo '

' . hb(_('Evènement Sauvée').' : ' . $act->ag_ref) . '

'; @@ -305,8 +316,9 @@ if ($sub_action == "add_action") { $act = new Follow_Up($cn); $act->fromArray($_POST); - $act->ag_id = 0; + $act->dt_id = $http->request("action_type","number"); $act->d_id = 0; + $act->save(); echo '
'; // Add hidden tag echo '
'; diff --git a/include/action.inc.php b/include/action.inc.php index 57098451f..70406bb75 100644 --- a/include/action.inc.php +++ b/include/action.inc.php @@ -22,6 +22,8 @@ */ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); global $g_user; +$http=new HttpInput(); + $retour=HtmlInput::button_anchor(_('Retour liste'), HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","action_query","tdoc","date_start","date_end","hsstate","searchtag")), "","","smallbutton"); @@ -47,14 +49,15 @@ require_once NOALYSS_INCLUDE.'/class/follow_up.class.php'; // propose to add one // permit also a search // show detail -$sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:""; +$sub_action=$http->request("sa","string",""); /* if ag_id is set then we give it otherwise we have problem * with the generation of document */ -$ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0; -$ac=$_REQUEST['ac']; -$base=HtmlInput::request_to_string(array('ac','gDossier'),""); +$ag_id=$http->request("ag_id","string","0"); +$ac=$http->request("ac"); +$base=HtmlInput::request_to_string(array('ac','gDossier'),""); +echo '
'; require_once NOALYSS_INCLUDE.'/action.common.inc.php'; echo "
"; diff --git a/include/adm.inc.php b/include/adm.inc.php index 7d0a478dc..5c571f66d 100644 --- a/include/adm.inc.php +++ b/include/adm.inc.php @@ -52,7 +52,7 @@ if ( isset($_POST['action_fiche'] ) ) return; } - $f_id=$hi->request('f_id',"number"); + $f_id=$http->request('f_id',"number"); $fiche=new Admin($cn,$f_id); $fiche->remove(); diff --git a/include/ajax/ajax_action_remove_concerned.php b/include/ajax/ajax_action_remove_concerned.php index 31112dff6..00d389490 100644 --- a/include/ajax/ajax_action_remove_concerned.php +++ b/include/ajax/ajax_action_remove_concerned.php @@ -37,6 +37,13 @@ catch (Exception $exc) error_log($exc->getTraceAsString()); return; } +/* + * security Who can do it ? + */ +if ( ! $g_user->can_read_action($ag_id) ) { + record_log(__FILE__."security : access refused"); + return; +} require_once 'class/follow_up.class.php'; $follow=new Follow_Up($cn,$ag_id); @@ -44,7 +51,7 @@ $follow=new Follow_Up($cn,$ag_id); ob_start(); $follow->remove_linked_card($f_id); echo $follow->display_linked(); -HtmlInput::button_action_add_concerned_card( $follow->ag_id); +echo HtmlInput::button_action_add_concerned_card( $follow->ag_id); $response = ob_get_clean(); diff --git a/include/ajax/ajax_action_save_concerned.php b/include/ajax/ajax_action_save_concerned.php index e799b09f1..25baf3008 100644 --- a/include/ajax/ajax_action_save_concerned.php +++ b/include/ajax/ajax_action_save_concerned.php @@ -28,9 +28,34 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); /** * Insert into follow-up the card (f_id) for the action_gestion (ag_id) */ +$http=new HttpInput(); +try { + // follow_up id + $ag_id=$http->request("ag_id","number"); + $ctl=$http->request("ctl"); + $selected_card=$http->request("selected_card","array",[]); +} catch (Exception $ex) { + record_log(__FILE__.$ex->getMessage().$ex->getTraceAsString()); + return; +} +/* + * security Who can do it ? + */ +if ( ! $g_user->can_write_action($ag_id) ) { + record_log(__FILE__."security : access refused"); + return; +} + require_once 'class/follow_up.class.php'; $follow=new Follow_Up($cn,$ag_id); -$follow->insert_linked_card($f_id); +$nb_card=count($selected_card); +for ($i=0;$i< $nb_card;$i++) +{ + $elt=$selected_card[$i]; + if (isNumber($elt)) { + $follow->insert_linked_card($elt); + } +} /** * Display all the linked card */ @@ -44,7 +69,7 @@ header('Content-type: text/xml; charset=UTF-8'); echo << -unused +$ctl $html EOF; diff --git a/include/ajax/ajax_add_concerned_card.php b/include/ajax/ajax_add_concerned_card.php index 4322b13a5..9187a7045 100644 --- a/include/ajax/ajax_add_concerned_card.php +++ b/include/ajax/ajax_add_concerned_card.php @@ -29,6 +29,7 @@ if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; +require_once NOALYSS_INCLUDE.'/class/card_multiple.class.php'; $http=new HttpInput(); ob_start(); @@ -42,49 +43,106 @@ catch (Exception $exc) error_log($exc->getTraceAsString()); return; } +/* + * security Who can do it ? + */ +if ( ! $g_user->can_write_action($ag_id) ) { + record_log(__FILE__."security : access refused"); + return; +} require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php'; $r=HtmlInput::title_box(_("Détail fiche"), 'search_card'); - -$r.=''; +//-------------------------------------------------------------------------------------------------------------------- +// Form search +//-------------------------------------------------------------------------------------------------------------------- +$r.=''; $q=new IText('query'); $q->value=(isset($query))?$query:''; $r.=''; $r.=_('Fiche contenant').Icon_Action::infobulle(19); $r.=$q->input(); -$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton"); + +// where to search +$select=new ISelect("search_in"); +$select->value=$cn->make_array("select ad_id, ad_text from attr_def where ad_search_followup = 1 order by 2 ",1); +$select->selected=$http->get("search_in","string",""); +$r.=_("limité aux champs ").$select->input(); + $r.=''; -$r.=dossier::hidden().HtmlInput::hidden('op', 'add_concerned_card'); +$r.=dossier::hidden().HtmlInput::hidden('op2', 'add_concerned_card'); $r.=HtmlInput::request_to_hidden(array('ag_id')); + +// Search by category +$sel_Category=new ISelect("search_cat"); +$sel_Category->value=$cn->make_array("select fd_id,fd_label from fiche_def order by 2",1); +$sel_Category->set_value($http->request("search_cat","string","-1")); +$r.=_("Catégorie")." ".$sel_Category->input(); + +// search also inactive card +$inactive=$http->get("inactive_card","string",0); +if ($inactive=="undefined" || $inactive == "") $inactive=0; +$is=new InputSwitch("inactive_card",$inactive); +$is->value=$inactive; +$r.=_("Fiches inactives").$is->input(); + +$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton"); $r.=''; + + $query=$http->get("query", "string",""); $sql_array['query']=$query; $sql_array['typecard']='all'; +$sql_array['search_in']=$select->selected; +$sql_array['inactive_card']=$inactive; +$sql_array['search_cat']=$sel_Category->selected; -$fiche=new Fiche($cn); +$fiche=new Card_Multiple($cn); /* Build the SQL and show result */ $sql=$fiche->build_sql($sql_array); +$count_card=$fiche->count_sql($sql_array); +//-------------------------------------------------------------------------------------------------------------------- +// Result +//-------------------------------------------------------------------------------------------------------------------- /* We limit the search to MAX_SEARCH_CARD records */ -$sql=$sql.' order by vw_name limit '.MAX_SEARCH_CARD; $a=$cn->get_array($sql); +$r.='
'; +$r.=HtmlInput::request_to_hidden(array('ag_id')); +$r.=dossier::hidden().HtmlInput::hidden('op2', 'link_concerned_card').HtmlInput::hidden("op","card"); +// element to update with the answer +$r.=HtmlInput::hidden("ctl","concerned_card_td"); +$array=[]; for ($i=0; $ivalue=$a[$i]['f_id']; + $array[$i]['checkbox']=$ic->input(); $array[$i]['quick_code']=$a[$i]['quick_code']; $array[$i]['name']=h($a[$i]['vw_name']); - $array[$i]['accounting']=$a[$i]['accounting']; $array[$i]['first_name']=h($a[$i]['vw_first_name']); $array[$i]['description']=h($a[$i]['vw_description']); - $array[$i]['javascript']=sprintf("action_save_concerned(%d,'%s','%s')",$gDossier,$a[$i]['f_id'],$ag_id); + $array[$i]['company']=h($a[$i]['company']); }//foreach - -echo $r; // No accountancy history $accvis=0; -require_once(NOALYSS_TEMPLATE.'/card_result.php'); +echo $r; +require_once(NOALYSS_TEMPLATE.'/card_multiple_result.php'); +echo '
    '; +echo '
  • '; +echo HtmlInput::submit("add_concerned_card",_("Ajouter")); +echo '
  • '; +echo '
  • '; +echo HtmlInput::button_close("search_card"); +echo '
  • '; +echo '
'; +echo ''; + + $response=ob_get_contents(); ob_end_clean(); diff --git a/include/ajax/ajax_anc_search.php b/include/ajax/ajax_anc_search.php index c9f943752..85d46b58b 100644 --- a/include/ajax/ajax_anc_search.php +++ b/include/ajax/ajax_anc_search.php @@ -72,7 +72,7 @@ if ( isset($_REQUEST['go'])) $sql="select po_name , po_description from poste_analytique ". "where pa_id=$1 and ". " (po_name ilike '%'||$2||'%' or po_description ilike '%'|| $3||'%') order by po_name"; - $array=$cn->get_array($sql,array($_c2,$plabel,$plabel)); + $array=$cn->get_array($sql,array($c2,$plabel,$plabel)); if (empty($array) == true) { diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index 9b61631ba..7b065898b 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -63,6 +63,7 @@ require_once NOALYSS_INCLUDE.'/lib/function_javascript.php'; require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; require_once NOALYSS_INCLUDE.'/class/user.class.php'; require_once NOALYSS_INCLUDE.'/class/fiche_attr.class.php'; +require_once NOALYSS_INCLUDE.'/lib/input_switch.class.php'; mb_internal_encoding("UTF-8"); @@ -99,31 +100,9 @@ $extra=""; $http=new \HttpInput(); switch($op2) { - /* ------------------------------------------------------------ */ - /* Remove a attribut */ - /* ------------------------------------------------------------ */ -case 'rmfa': - if ($g_user->check_action(FICCAT)==0)exit(); - - ob_start(); - try - { - $ad_id= $http->get("ad_id","number"); - $cn->start(); - $fa=new Fiche_Attr($cn,$ad_id); - $fa->delete(); - $cn->commit(); - } - catch (Exception $e) - { - $cn->rollback(); - record_log($e->getMessage()); - record_log($e); - echo $e->getMessage(); - } - $html=ob_get_contents(); - ob_end_clean(); - break; + case 'attribute': + require_once "ajax/ajax_card_attribute.php"; + return ; /* ------------------------------------------------------------ */ /* Display card detail */ /* ------------------------------------------------------------ */ @@ -441,14 +420,31 @@ case 'fs': $r.=''; $r.=dossier::hidden().HtmlInput::hidden('op','fs'); $array=array(); - foreach (array('accvis','query','inp','jrn','label','typecard','price','tvaid') as $i) + + // to navigate + $page_card=$http->get("page_card","number",0); + $inactive=$http->get("inactive_card","string",0); + if ($inactive=="undefined" || $inactive == "") $inactive=0; + $is=new InputSwitch("inactive_card",$inactive); + $is->value=$inactive; + $r.=_("fiches inactives").$is->input(); + + // save previous info + $hidden=""; + foreach (array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type') as $i) { if (isset(${$i}) ) { $r.=HtmlInput::hidden($i,${$i}); + $hidden.=HtmlInput::hidden($i,${$i}); $sql_array[$i]=${$i}; } } + $r.=$hidden; + $r.=""; + + $sql_array["query"]=$query; + $sql_array["inactive_card"]=$inactive; /* what is the type of the ledger */ $type="GL"; if (isset($jrn) && $jrn > 1) @@ -456,50 +452,69 @@ case 'fs': $ledger=new Acc_Ledger($cn,$jrn); $type=$ledger->get_type(); } + // if jrn == -10 , the search is called from the detail operation from an action follow-up + if ( isset($jrn) && $jrn == -10){ + $type=$http->request("amount_from_type","string","VEN"); + } $fiche=new Fiche($cn); /* Build the SQL and show result */ $sql=$fiche->build_sql($sql_array); if ( strpos($sql," in ()") != 0) { - $html=Icon_Action::close('search_card'); - $html.='
'.h2info(_('Recherche de fiche')).'
'; + $html=""; + $html.=HtmlInput::title_box(_('Recherche de fiche'), 'search_card'); $html.='

'; $html.=_("Aucune catégorie de fiche ne correspond à". " votre demande, le journal pourrait n'avoir accès à aucune fiche"); $html.='

'; + $html.=HtmlInput::button_close("search_card"); break; } + /** + * if inactive == 0 , then only active card + */ + if ( $inactive == 0 ) { + $sql.=" and f_id in (select f_id from fiche_detail where ad_id=54 and ad_value='1') "; + } + /* We limit the search to MAX_SEARCH_CARD records */ - $sql=$sql.' order by vw_name limit '.MAX_SEARCH_CARD; - $a=$cn->get_array($sql); - for($i=0;$iget_value("select count(*) from ($sql) as c"); + + $record_start=$page_card*MAX_SEARCH_CARD; + $sql.=' limit '.MAX_SEARCH_CARD.' offset '.$record_start; + + $aFound=$cn->get_array($sql); + $nb_found=count($aFound); + for($i=0;$i<$nb_found;$i++) + { + $array[$i]['quick_code']=$aFound[$i]['quick_code']; + $array[$i]['name']=h($aFound[$i]['vw_name']); + $array[$i]['accounting']=$aFound[$i]['accounting']; + $array[$i]['first_name']=h($aFound[$i]['vw_first_name']); + $array[$i]['description']=h($aFound[$i]['vw_description']); $array[$i]['javascript']=sprintf("set_value('%s','%s');", $inp,$array[$i]['quick_code']); $array[$i]['javascript'].=sprintf("set_value('%s','%s');", - $label,j(h(strip_tags($a[$i]['vw_name'])))); + $label,j(h(strip_tags($aFound[$i]['vw_name'])))); + /* if it is a ledger of sales we use vw_buy if it is a ledger of purchase we use vw_sell*/ if ( $type=="ACH" ){ - $amount=(isNumber($a[$i]['vw_buy']) == 1 )?$a[$i]['vw_buy']:0; + $amount=(isNumber($aFound[$i]['vw_buy']) == 1 )?$aFound[$i]['vw_buy']:0; $array[$i]['javascript'].=sprintf("set_value('%s','%s');", $price,$amount); } if ( $type=="VEN" ){ - $amount=(isNumber($a[$i]['vw_buy']) == 1 )?$a[$i]['vw_sell']:0; + $amount=(isNumber($aFound[$i]['vw_sell']) == 1 )?$aFound[$i]['vw_sell']:0; $array[$i]['javascript'].=sprintf("set_value('%s','%s');", $price,$amount); } $array[$i]['javascript'].=sprintf("set_value('%s','%s');", - $tvaid,$a[$i]['tva_id']); + $tvaid,$aFound[$i]['tva_id']); $array[$i]['javascript'].="removeDiv('search_card');"; }//foreach @@ -516,9 +531,11 @@ case 'fs': require_once NOALYSS_INCLUDE.'/ajax/ajax_add_concerned_card.php'; return; break; - case 'action_save_concerned': +// add several card to an action follow⁻up + case 'link_concerned_card': require NOALYSS_INCLUDE.'/ajax/ajax_action_save_concerned.php'; return; +// remove card from an action follow⁻up case 'action_remove_concerned': require NOALYSS_INCLUDE.'/ajax/ajax_action_remove_concerned.php'; return; @@ -742,6 +759,23 @@ case 'upr': } } break; + //--------------------------------------------------------------------------------------------------------------- + // Display option of a contact in an action-followup + //--------------------------------------------------------------------------------------------------------------- + case 'display_card_option': + + require_once NOALYSS_INCLUDE.'/ajax/ajax_display_card_option.php'; + return; + break; + + //--------------------------------------------------------------------------------------------------------------- + // Save option of a contact in an action-followup + //--------------------------------------------------------------------------------------------------------------- + case 'save_card_option': + require_once NOALYSS_INCLUDE.'/ajax/ajax_save_card_option.php'; + return; + + break; } // switch $xml=escape_xml($html); diff --git a/include/ajax/ajax_card_attribute.php b/include/ajax/ajax_card_attribute.php new file mode 100644 index 000000000..418b103df --- /dev/null +++ b/include/ajax/ajax_card_attribute.php @@ -0,0 +1,103 @@ + + +/** + * @file + * @brief answer to card_attr_inc.php + */ +global $g_user; +// security +$g_user->can_request("CFGATCARD"); +require_once NOALYSS_INCLUDE."/lib/inplace_switch.class.php"; +require_once NOALYSS_INCLUDE.'/class/card_attribut_mtable.class.php'; + +$http=new HttpInput(); + +try +{ + $action=$http->request("action", "string"); +} +catch (Exception $ex) +{ + record_log("ACA01".$ex->getMessage().$ex->getTraceAsString()); +} + +if ($action=="enable_search") +{ + $value=$http->request("value"); + $ad_id=$http->request("ad_id"); + $name=$http->request("name"); + if ($value==1) + { + $cn->exec_sql("update attr_def set ad_search_followup=0 where ad_id=$1", [$ad_id]); + $value=0; + } + else + { + $cn->exec_sql("update attr_def set ad_search_followup=1 where ad_id=$1", [$ad_id]); + $value=1; + } + $ic=new Inplace_Switch($name, $value); + $ic->set_callback("ajax_misc.php"); + $ic->add_json_param("op", "card"); + $ic->add_json_param("gDossier", Dossier::id()); + $ic->add_json_param("op2", "attribute"); + $ic->add_json_param("action", "enable_search"); + $ic->add_json_param("ad_id", $ad_id); + $ic->add_json_param("ctl", $ad_id); + echo $ic->input(); +} +else +{ + $obj=new Fiche_Attr($cn); + $mtable=new Card_Attribut_MTable($obj); + $mtable->add_json_param("op", "card"); + $mtable->add_json_param("op2", "attribute"); + $mtable->set_callback("ajax_misc.php"); + $mtable->set_object_name($http->request("ctl")); + $ad_id=$http->request("p_id"); + $mtable->get_table()->set_parameter("id", $ad_id); + switch ($action) + { + case "input": + $mtable->set_pk($ad_id); + if ( $ad_id < 0 ) $mtable->get_table()->set("ad_search_followup",0); + $mtable->send_header(); + echo $mtable->ajax_input()->saveXML(); + + break; + case "save": + $mtable->set_pk($http->request("p_id")); + $mtable->send_header(); + echo $mtable->ajax_save()->saveXML(); + + + break; + case "delete": + $mtable->set_pk($http->request("p_id")); + $mtable->send_header(); + echo $mtable->ajax_delete()->saveXML(); + break; + default: + break; + } +} +?> diff --git a/include/ajax/ajax_cfgaction.php b/include/ajax/ajax_cfgaction.php new file mode 100644 index 000000000..656253194 --- /dev/null +++ b/include/ajax/ajax_cfgaction.php @@ -0,0 +1,82 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +// check right +if ($g_user->check_action(PARCATDOC)==0) +{ + + record_log("cfgaction01 security "); + return; +} + +require_once NOALYSS_INCLUDE."/class/action_document_type_mtable.class.php"; + +$http=new HttpInput(); + + +/** + * @file + * @brief call for document_type in follow up + */ +try +{ + $table=$http->request('table'); + $ctl_id=$http->request('ctl'); + $action=$http->request('action'); + $p_id=$http->request('p_id', "number"); +} +catch (Exception $ex) +{ + echo $e->getMessage(); + return; +} + +$doc_type=new Document_type_SQL($cn,$p_id); +$action_document_type=new Action_Document_Type_MTable($doc_type); + +$action_document_type->set_callback("ajax_misc.php"); +$action_document_type->add_json_param("op", "cfgaction"); +$action_document_type->set_object_name($ctl_id); + + + +if ($action=="input") +{ + + header('Content-type: text/xml; charset=UTF-8'); + echo $action_document_type->ajax_input()->saveXML(); + return; +} +elseif ($action=="save") +{ + $xml=$action_document_type->ajax_save(); + header('Content-type: text/xml; charset=UTF-8'); + echo $xml->saveXML(); +} +elseif ($action=="delete") +{ + $xml=$action_document_type->ajax_delete(); + header('Content-type: text/xml; charset=UTF-8'); + echo $xml->saveXML(); +} diff --git a/include/ajax/ajax_contact_option_list.php b/include/ajax/ajax_contact_option_list.php new file mode 100644 index 000000000..1622d1ab8 --- /dev/null +++ b/include/ajax/ajax_contact_option_list.php @@ -0,0 +1,67 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); +require_once NOALYSS_INCLUDE."/class/contact_option_ref_mtable.class.php"; + +/** + * @file + * @brief add option for contact + * @see contact_option_list + * @see action_document_type_mtable::input() + */ +try +{ + $contact_option_id=$http->request("p_id"); + $ctl_id=$http->request("ctl"); + $action=$http->request("action"); +} +catch (Exception $ex) +{ + record_log(__FILE__." no p_id"); + return; +} +$cn=Dossier::connect(); + +// document_option id from document_option where do_code='contact_multiple' and document_type_id=p_id +$obj=new Contact_option_ref_SQL($cn); + +$contact_mtable=new Contact_Option_Ref_MTable($obj); + +$contact_mtable->set_callback("ajax_misc.php"); +$contact_mtable->set_object_name("s_contact_option"); +$contact_mtable->set_dialog_box("db_contact_option"); +$contact_mtable->add_json_param("op", "contact_option_list"); +$contact_mtable->set_object_name($ctl); +$contact_mtable->set_pk($contact_option_id); + +if ($action == "input") { + $contact_mtable->send_header(); + echo $contact_mtable->ajax_input()->saveXML(); +} elseif($action == "save") { + $contact_mtable->send_header(); + + echo $contact_mtable->ajax_save()->saveXML(); +} elseif ($action == "delete") { + $contact_mtable->send_header(); + $contact_mtable->ajax_delete(); +} \ No newline at end of file diff --git a/include/ajax/ajax_display_card_option.php b/include/ajax/ajax_display_card_option.php new file mode 100644 index 000000000..464c2b574 --- /dev/null +++ b/include/ajax/ajax_display_card_option.php @@ -0,0 +1,44 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief display the options of a card + */ +require_once NOALYSS_INCLUDE."/class/card_multiple.class.php"; + +$card_multiple=new Card_Multiple(); +try +{ + $ap_id=$http->get("ap_id"); +} +catch (Exception $exc) +{ + echo $exc->getMessage(); + record_log($exc->getMessage().$exc->getTraceAsString()); +} + +echo HtmlInput::title_box(_("Options contact"), "d_linked_card_option","close","","y"); +// display existing option +$card_multiple->display_option($ap_id); diff --git a/include/ajax/ajax_get_profile.php b/include/ajax/ajax_get_profile.php index 586a92d66..9f92f8d2b 100644 --- a/include/ajax/ajax_get_profile.php +++ b/include/ajax/ajax_get_profile.php @@ -55,7 +55,7 @@ $a_tab[$call_tab]='tabs_selected';
  • -
  • +
  •   @@ -111,7 +111,6 @@ if ($profile->p_id > 0) echo '
  • '; echo ''; echo ''; echo ' + + + \ No newline at end of file diff --git a/include/cfgtags.inc.php b/include/cfgtags.inc.php index e9aef771f..9a6188597 100644 --- a/include/cfgtags.inc.php +++ b/include/cfgtags.inc.php @@ -17,7 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Copyright Author Dany De Bontridder danydb@aevalys.eu -if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); /** * @file @@ -26,34 +27,82 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); */ require_once NOALYSS_INCLUDE.'/class/tag.class.php'; require_once NOALYSS_INCLUDE.'/lib/single_record.class.php'; +require_once NOALYSS_INCLUDE."/lib/html_tab.class.php"; +require_once NOALYSS_INCLUDE."/lib/output_html_tab.class.php"; +require_once NOALYSS_INCLUDE."/class/tag_group_mtable.class.php"; +/* * ***************************************************************************** + * Tags + * + * ***************************************************************************** */ +$tabs=new Html_Tab("tg", _("Etiquette")); + +ob_start(); $tag=new Tag($cn); $uos=new Single_Record('tag'); -if ( isset ($_POST['save_tag_sb'])) +if (isset($_POST['save_tag_sb'])) { - if ( ! isset ($_POST['remove'])) + if (!isset($_POST['remove'])) { - try { + try + { $uos->check(); $tag->save($_POST); $uos->save(); - } catch (Exception $e) + } + catch (Exception $e) { alert("déjà sauvé"); } - } else { + } + else + { $tag->remove($_POST); } } ?> -
    -

    - +

    + -

    - show_list(); - $js=sprintf("onclick=\"show_tag('%s','%s','%s','p')\"",Dossier::id(),$_REQUEST['ac'],'-1'); - echo HtmlInput::button("tag_add", "Ajout d'un tag", $js); - ?> \ No newline at end of file + à plusieurs dossiers ou avoir plusieurs étiquettes."); ?> +

    +show_list(); +$js=sprintf("onclick=\"show_tag('%s','%s','%s','p')\"", Dossier::id(), $_REQUEST['ac'], '-1'); +echo HtmlInput::button("tag_add", "Ajout d'un tag", $js); +?> +
    +set_content(ob_get_contents()); +ob_end_clean(); +/* * ***************************************************************************** + * Group of Tags + * + * ***************************************************************************** */ +$tag_group=new Html_Tab("grp_tg", _("Groupe étiquettes")); + +$obj=new Tag_Group_SQL($cn); +$obj_manage=new Tag_Group_MTable($obj); +$obj_manage->set_callback("ajax_misc.php"); +$obj_manage->add_json_param("op", "tag_group"); +ob_start(); +$obj_manage->display_table(); +$r=ob_get_contents(); +$tag_group->set_content($r); +ob_end_clean(); + + +$out=new Output_Html_Tab(); +$out->add($tabs); +$out->add($tag_group); +$out->output(); +$obj_manage->create_js_script(); +?> + \ No newline at end of file diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index c1e17f315..003513bc2 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -2354,7 +2354,12 @@ class Acc_Ledger extends jrn_def_sql */ function verify_ledger($array) { - extract($array, EXTR_SKIP); + + $p_jrn=$array['p_jrn']; + $p_jrn_deb_max_line=$array['p_jrn_deb_max_line']; + $p_jrn_name=$array['p_jrn_name']; + $p_jrn_type=$array['p_jrn_type']; + try { if (isNumber($p_jrn)==0) @@ -2368,8 +2373,10 @@ class Acc_Ledger extends jrn_def_sql throw new Exception(_("Un journal avec ce nom existe déjà")); if ($p_jrn_type=='FIN') { + $http=new \HttpInput(); $a=new Fiche($this->db); - $result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])), false); + $bank=$http->post("bank"); + $result=$a->get_by_qcode(trim(strtoupper($bank)), false); if ($result==1) throw new Exception(_("Aucun compte en banque n'est donné")); } @@ -2378,11 +2385,17 @@ class Acc_Ledger extends jrn_def_sql throw new Exception(_('Choix du type de journal est obligatoire')); } - if (isset( $negative_warning) && $negative_amount == 1 && trim($negative_warning)=="") { + if ( isset( $array['negative_warning']) && + isset( $array['negative_amount']) && + $array['negative_amount'] == 1 + && trim($array['negative_warning'])=="") { throw new Exception(_("Avertissement ne peut être vide")); } - if ( isset( $negative_amount) && $negative_amount <> 0 && $negative_amount <> 1 ){ + if ( isset( $array['negative_amount']) && + $array['negative_amount'] <> 0 && + $array['negative_amount'] <> 1 ) + { throw new Exception(_("Valeur invalide")); } } diff --git a/include/class/acc_ledger_history_generic.class.php b/include/class/acc_ledger_history_generic.class.php index 54ee8312b..a50f142d8 100644 --- a/include/class/acc_ledger_history_generic.class.php +++ b/include/class/acc_ledger_history_generic.class.php @@ -494,7 +494,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History $cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:""; - $ledger_list=join($this->ma_ledger, ","); + $ledger_list=join( ",",$this->ma_ledger); // Grand livre == 0 $Res=$this->db->exec_sql("select jr_id,j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date, jr_internal, diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php index d7a19155a..b7ed71b3e 100644 --- a/include/class/acc_ledger_search.class.php +++ b/include/class/acc_ledger_search.class.php @@ -224,6 +224,9 @@ class Acc_Ledger_Search if (isset($_REQUEST['hide_operation'])) $r.=HtmlInput::hidden("hide_operation", $http->request('hide_operation')); + if (isset($_REQUEST['single_operation'])) + $r.=HtmlInput::hidden("single_operation", $http->request('single_operation')); + ob_start(); $search_filter=$this->build_search_filter(); require_once NOALYSS_TEMPLATE.'/ledger_search.php'; diff --git a/include/class/acc_operation.class.php b/include/class/acc_operation.class.php index e1930efc1..06946c760 100644 --- a/include/class/acc_operation.class.php +++ b/include/class/acc_operation.class.php @@ -747,11 +747,11 @@ class Acc_Operation $r.=_("Menu invalide"); return $r; } - /** - * @bug : if several menu possible , will use only the first one, because request take first the GET and after - * the POST - */ + // Prepare the form + $r=sprintf('
    ',$p_id,NOALYSS_URL."/do.php?".Dossier::get()); + $r.=Dossier::hidden(); + // select the menu where the operation will be duplicated $r=sprintf('',$p_id,NOALYSS_URL."/do.php?".http_build_query([ "ac"=>$a_code[0]['code'],"gDossier"=>Dossier::id() ])); diff --git a/include/class/action_document_type_mtable.class.php b/include/class/action_document_type_mtable.class.php new file mode 100644 index 000000000..f02f56d7b --- /dev/null +++ b/include/class/action_document_type_mtable.class.php @@ -0,0 +1,244 @@ + + +/* @file + * @brief display and allow to update , add , delete document_type for the follow up + * + */ +require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php"; +require_once NOALYSS_INCLUDE."/database/document_type_sql.class.php"; + +/** + * @class + * @brief display , modify and add document_type for follow up + * @see include/ajax/ajax_cfgaction.php + * @see include/cfg_action.inc.php + */ +class Action_Document_Type_MTable extends Manage_Table_SQL +{ + + private $other; //!< Other value + + public function __construct(Document_type_SQL $doc_type) + { + parent::__construct($doc_type); + $this->set_order(["dt_id", "dt_prefix", "dt_value",]); + $this->set_property_updatable("dt_id", false); + $this->set_property_visible("dt_id", false); + $this->set_property_updatable("dt_value", true); + $this->set_property_updatable("dt_prefix", true); + $this->set_col_label("dt_value", _("Nom")); + $this->set_col_label("dt_prefix", _("Préfixe document")); + $this->other=array(); + } + + /** + * + @code + table "public.document_type" + ctl_id "dtr" + gDossier "74" + op "cfgaction" + p_id "28" + action "save" + ctl "tbl5f785d403b123" + dt_prefix "ABO.HEB" + dt_value "Abonnements+PhpCompta" + seq "0" + det_op "1" + det_contact_mul "1" + update "OK" + @endcode + * + * + * + */ + public function from_request() + { + $http=new HttpInput(); + $this->table->dt_value=$http->request('dt_value'); + $this->table->dt_prefix=$http->request('dt_prefix'); + $this->other['detail_operation']=$http->request("detail_operation", "string", 0); + $this->other['contact_multiple']=$http->request("det_contact_mul", "string", 0); + $this->other['make_invoice']=$http->request("make_invoice", "string", 0); + $this->other['seq']=$http->request("seq", "string", 0); + $this->other['select_option_operation']=$http->request("select_option_operation", "string", null); + $this->other["cor_id"]=$http->request("cor_id","array",[]); + $nb_corid=count($this->other["cor_id"]); + $http->set_empty(0); + for ($i=0;$i<$nb_corid;$i++) { + $this->other["contact_option$i"]=$http->request("contact_option".$i,"number",0); + } + + } + + /** + * + */ + public function check() + { + $table=$this->get_table(); + $error=0; + if (empty(trim($table->dt_value))) + { + $this->set_error("dt_value", _("Nom ne peut être vide")); + $error++; + } + if (empty(trim($table->dt_prefix))) + { + $this->set_error("dt_prefix", _("Préfixe ne peut être vide")); + $error++; + } + // Check doublon + if ($table->cn->get_value('select count(*) from document_type where upper(dt_value)=upper($1) and dt_id <> $2', + [$table->dt_value, $table->dt_id])>0) + { + $this->set_error("dt_value", _("Doublon, ce nom existe déjà ")); + $error++; + } + // Check doublon + if ($table->cn->get_value('select count(*) from document_type where upper(dt_prefix)=upper($1) and dt_id <> $2', + [$table->dt_prefix, $table->dt_id])>0) + { + $this->set_error("dt_value", _("Doublon, ce préfixe existe déjà ")); + $error++; + } + if ($error>0) + return false; + return true; + } + + /** + * + * @throws Exception + */ + function delete() + { + $table=$this->get_table(); + try + { + // remove the cat if no action + $count_md=$table->cn->get_value('select count(*) from document_modele where md_type=$1', + array($table->dt_id)); + $count_a=$table->cn->get_value('select count(*) from action_gestion where ag_type=$1', array($table->dt_id)); + + if ($count_md!=0||$count_a!=0) + { + throw new Exception(_('Des actions dépendent de cette catégorie'), 1300); + } + $table->delete(); + } + catch (Exception $exc) + { + if ($exc->getCode()!=1300) + { + record_log("ADTM01".$exc->getTrace()); + } + throw new Exception($exc->getMessage()); + } + } + + /** + * @brief display the box for adding, the name for p_id , are in the form + */ + function input() + { + parent::input(); + + + + // Detail option contact + $table=$this->get_table(); + $cn=$table->cn; + // insert new contact options + $cn->exec_sql("insert into jnt_document_option_contact (jdoc_enable,document_type_id, + contact_option_ref_id) + select 0 , $1, cor_id + from contact_option_ref + where + cor_id not in (select cor_id from + jnt_document_option_contact a + where a.document_type_id=$1)",[$table->dt_id]); + + // Select all + + $aOption=$cn->get_array("select cor_id,cor_label,cor_type,document_type_id ,coalesce(jdoc_enable,0) jdoc_enable + from + contact_option_ref cor + left join jnt_document_option_contact jdoc on (cor_id=contact_option_ref_id) + where + document_type_id is null + or document_type_id = $1 + order by cor_label",[$this->table->dt_id]); + + // Detail option + require NOALYSS_TEMPLATE."/action_document_type_mtable_input.php"; + } + + /** + * save + */ + function save() + { + parent::save(); + $cn=Dossier::connect(); + $object_sql=$this->get_table(); + // restart sequence + if ($this->other['seq']!=0) + { + $doc_type=new Document_type($cn, $object_sql->dt_id); + $doc_type->set_number($this->other['seq']); + } + // Save detail operation + $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4) + on conflict on constraint document_option_un + do update set do_enable=$3,do_option=$4", ["detail_operation", + $object_sql->dt_id, + $this->other['detail_operation'], + $this->other['select_option_operation'] + ]); + + // Save contact_multiple + $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3) + on conflict on constraint document_option_un + do update set do_enable=$3 ", ["contact_multiple", $object_sql->dt_id, $this->other['contact_multiple']]); + + // Save make invoice + $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3) + on conflict on constraint document_option_un + do update set do_enable=$3 ", ["make_invoice", $object_sql->dt_id, $this->other['make_invoice']]); + + // Option contact to save + $cn->exec_sql("delete from jnt_document_option_contact where document_type_id=$1",[$object_sql->dt_id]); + $nb_contact_option=count($this->other["cor_id"]); + $aOption=$this->other["cor_id"]; + for ( $e=0;$e<$nb_contact_option;$e++) { + $option_id=$aOption[$e]; + if ( isset($this->other["contact_option".$e]) ) { + $cn->exec_sql("insert into jnt_document_option_contact + (jdoc_enable,document_type_id,contact_option_ref_id) + values ($1,$2,$3)",[$this->other["contact_option".$e],$object_sql->dt_id,$option_id]); + } + } + + } + +} diff --git a/include/class/card_attribut_mtable.class.php b/include/class/card_attribut_mtable.class.php new file mode 100644 index 000000000..7b468f41f --- /dev/null +++ b/include/class/card_attribut_mtable.class.php @@ -0,0 +1,199 @@ + + +/** + * @file + * @brief manage the table attr_def + * @see card_attr.inc.php + */ +require_once NOALYSS_INCLUDE."/class/fiche_attr.class.php"; +require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php"; +require_once NOALYSS_INCLUDE."/lib/inplace_switch.class.php"; + +class Card_Attribut_MTable extends Manage_Table_SQL +{ + + function __construct(\Data_SQL $p_table) + { + parent::__construct($p_table); + $this->set_property_visible("ad_id", TRUE); + $this->set_property_updatable("ad_id", FALSE); + $this->set_col_label("ad_text", _("Nom")); + $this->set_col_label("ad_type", _("Type")); + $this->set_col_label('ad_size', _("Taille")); + $this->set_col_label("ad_extra", _("Option sup.")); + $this->set_col_label("ad_search_followup", _("Recherche suivi")); + + $this->set_col_type("ad_search_followup", "custom"); + $this->set_col_type("ad_text", "custom"); + $this->set_col_type("ad_size", "numeric"); + $this->set_col_type("ad_extra", "text"); + $this->set_col_type("ad_type", "select", + array( + ["value"=>"text", "label"=>_("Texte")], + ["value"=>"date", "label"=>_("Date")], + ["value"=>"numeric", "label"=>_("Nombre")], + ["value"=>"select", "label"=>_("Choix")], + ["value"=>"card", "label"=>_("Fiche")], + ["value"=>"zone", "label"=>_("Zone de texte")], + ["value"=>"check", "label"=>_("Coche")], + ["value"=>"poste", "label"=>_("Poste comptable")] + )); + $this->set_col_tips("ad_search_followup", 77); + // to prevent a call to this function for each row + $this->dossier_id=Dossier::id(); + $this->set_col_sort(1); + } + + /** + * Display row of table attr_def + * @param array $row + */ + function display_row($row) + { + tracedebug("card_attribute.log", $row); + if ($row['ad_id']>=9000) + { + $this->set_delete_row(TRUE); + $this->set_update_row(TRUE); + } + else + { + $this->set_delete_row(FALSE); + $this->set_update_row(FALSE); + } + + parent::display_row($row); + } + + /** + * For the type custom , we can call a function to display properly the value + * @param $p_key string key name + * @param $p_value string value + * @see input_custom + * @see set_type + * @note must return a string which will be in surrounded by td in the function display_row + * @return string + */ + function display_row_custom($p_key, $p_value, $p_id=0) + { + if ($p_key=="ad_search_followup") + { + $ic=new Inplace_Switch(uniqid("search_follow_up"), $p_value); + $ic->set_callback("ajax_misc.php"); + $ic->add_json_param("op", "card"); + $ic->add_json_param("gDossier", $this->dossier_id); + $ic->add_json_param("op2", "attribute"); + $ic->add_json_param("action", "enable_search"); + $ic->add_json_param("ad_id", $p_id); + $ic->add_json_param("ctl", $p_id); + $ret=$ic->input(); + + return $ret; + } + if ($p_key == "ad_text"){ + return $p_value; + } + return; + } + + /** + * For the type custom , we can call a function to display properly the value + * @param $p_key string key name + * @param $p_value string value + * @see input_custom + * @see set_type + * @note must return a string which will be in surrounded by td in the function display_row + * @return string + */ + function input_custom($p_key, $p_value) + { + if ($p_key=="ad_search_followup") + { + $p_id=$this->get_table()->get("ad_id"); + $ic=new InputSwitch("ad_search_followup", $p_value); + echo $ic->input(); + } + /** + * Bug in firefox if id=ad_text , the widget is not displaid + */ + if ( $p_key == "ad_text") + { + $text=new IText("ad_text",$p_value); + $text->id=uniqid(); + echo $text->input(); + } + echo ""; + return; + } + + function check() + { + $nb_error=0; + $object_sql=$this->get_table(); + + if ($object_sql->get("ad_id")<9000 && $object_sql->get("ad_id")!=-1) + { + $this->set_error("ad_id",_("Bloqué")); + return false; + } + + // Duplicate + $count="select count(*) + from attr_def as ad1 + where + upper(trim(ad1.ad_text)) = upper(trim($1)) + and ad1.ad_id != $2 + "; + $count_duplicate=$object_sql->cn->get_value($count, [$object_sql->ad_text, $object_sql->ad_id]); + if ($count_duplicate>0) + { + $this->set_error("ad_text", _("Doublon")); + $nb_error++; + } + + // Name empty + if (trim($object_sql->ad_text)=="") + { + $this->set_error("ad_text", _("Description ne peut pas être vide")); + $nb_error++; + } + // select protect + + + if ($nb_error>0) + return false; + return true; + } + + function delete() { + $object_sql=$this->get_table(); + $db=$object_sql->cn; + try { + $db->start(); + $object_sql=$this->get_table()->delete(); + $db->commit(); + } catch (Exception $ex) { + $db->rollback(); + throw new Exception (_("Effacement bloqué : attribut utilisé")); + } + } +} diff --git a/include/class/card_multiple.class.php b/include/class/card_multiple.class.php new file mode 100644 index 000000000..60ed305b0 --- /dev/null +++ b/include/class/card_multiple.class.php @@ -0,0 +1,164 @@ + + +/** + * @file + * @brief in follow-up , add multiple cards to an event, an action + */ +class Card_Multiple +{ + private $sql ; //!< SQL with the right column name + function __construct() + { + $this->sql="select f_id,quick_code,vw_name,accounting,vw_first_name,vw_description, + (select ad_value from fiche_detail fd where fd.f_id=vw_fiche_attr.f_id and fd.ad_id=25) as company + from vw_fiche_attr "; + } + /** + * + * @param type $sql_array + * @return type + */ + function build_sql($sql_array) + { + $cn=Dossier::connect(); + $filter=""; + if ( $sql_array["inactive_card"]==0) { + $filter=" and ".$this->filter_enable_card(); + } + // By Cat of card + $sql_cat=""; + if ( $sql_array['search_cat']!=-1) { + $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']); + } + $query=sql_string($sql_array['query']); + if ( $sql_array['search_in'] == "-1") + { + $string_sql=$this->sql." + where + (vw_name ilike '%$query%' + or quick_code ilike '%$query%') + ".$filter.$sql_cat." + order by vw_name + limit + ".MAX_CARD_SEARCH; + } else { + $string_sql=sprintf($this->sql." where f_id in (select f_id from fiche_detail where + ad_id = '%s' and ad_value ilike '%%%s%%') %s %s" + , sql_string($sql_array["search_in"]),$query,$filter,$sql_cat); + } + return $string_sql; + } + /** + * + * @param type $sql_array + * @return type + */ + function count_sql($sql_array) + { + $cn=Dossier::connect(); + $query=sql_string($sql_array['query']); + $filter=""; + if ( $sql_array["inactive_card"]==0) { + $filter="and ".$this->filter_enable_card(); + } + // By Cat of card + $sql_cat=""; + if ( $sql_array['search_cat']!=-1) { + $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']); + } + + $string_sql="select count(*) + from vw_fiche_attr + where + ( vw_name ilike '%$query%' + or quick_code ilike '%$query%') + ".$filter.$sql_cat; + + + return $cn->get_value($string_sql); + } + /** + * + * @return string + */ + private function filter_enable_card() + { + $filter_enable_card=" f_id in (select f_id from fiche_detail where ad_value = '1' and ad_id=54) "; + return $filter_enable_card; + } + /** + * + * @global type $g_user + * @param type $ap_id + * @return type + */ + function display_option($p_action_person_id) + { + global $g_user; + $cn=Dossier::connect(); + // retrieve card id (fiche.f_id) and the ag_id (action_gestion.ag_id) + $tmp=$cn->get_row("select f_id,ag_id from action_person where ap_id=$1 ", [$p_action_person_id]); + if ($tmp==NULL) + { + record_log("CMDO.01nothing found ".var_export($_REQUEST, true)); + return; + } + $fiche_id=$tmp['f_id']; + $ag_id=$tmp['ag_id']; + if ( ! $g_user->can_read_action($ag_id)) { + throw new Exception (_("CMCDO01"."Security")); + } + // Retrieve Name, first Name and QCODE + $aIdentity=$cn->get_row("select (select ad_value from fiche_detail where f_id=$1 and ad_id=1) as name , + (select ad_value from fiche_detail where f_id=$1 and ad_id=32) as first_name , + (select ad_value from fiche_detail where f_id=$1 and ad_id=23) as qcode ",[$fiche_id]); + + // insert new , synchronized + $cn->exec_sql("insert into action_person_option (ap_value,contact_option_ref_id ,action_person_id ) + select null,cor_id,$1 + from contact_option_ref + where + cor_id not in ( + select contact_option_ref_id + from action_person_option + join action_person a on (a.ap_id=action_person_id) + where f_id=$2)",[$p_action_person_id,$fiche_id]); + + // delete disable + $cn->exec_sql("delete + from action_person_option apo + where contact_option_ref_id in + (select contact_option_ref_id from jnt_document_option_contact jdoc join action_gestion on (ag_type=document_type_id) + where ag_id=$1 and jdoc_enable=0)",[$ag_id]); + + // First select the option + $sql="select ap_id,cor_id,ap_value,cor_type ,cor_label,cor_value_select + from contact_option_ref cor + join action_person_option apo on (cor.cor_id=apo.contact_option_ref_id) + where action_person_id=$1 order by cor_label "; + + $a_option=$cn->get_array($sql,[$p_action_person_id]); + require NOALYSS_TEMPLATE."/card_multiple_display_option.php"; + + } + +} diff --git a/include/class/contact_option_ref_mtable.class.php b/include/class/contact_option_ref_mtable.class.php new file mode 100644 index 000000000..b6a62f9da --- /dev/null +++ b/include/class/contact_option_ref_mtable.class.php @@ -0,0 +1,50 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +// Copyright (2002-2020) Author Dany De Bontridder + + +/** + * @file + * @brief + * @todo to be implemented + */ +require_once NOALYSS_INCLUDE."/database/contact_option_ref_sql.class.php"; +require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php"; + +class Contact_Option_Ref_MTable extends Manage_Table_SQL{ + + function __construct(Contact_Option_Ref_SQL $obj) + { + parent::__construct($obj); + $this->set_col_label("cor_label", _("Nom")); + $this->set_col_label("cor_type", _("Type ")); + $this->set_col_label("document_option_id", _("Action")); + $this->set_col_label("cor_value_select",_("Options")); + $this->set_property_visible("cor_id", false); + $this->set_col_type("cor_type","select",[ + ["label"=>_("Texte"),"value"=>0], + ["label"=>_("Nombre"),"value"=>1], + ["label"=>_("Choix"),"value"=>3], + ["label"=>_("Date"),"value"=>2], + ["label"=>_("Coche"),"value"=>4] + ]); + } + +} diff --git a/include/class/document.class.php b/include/class/document.class.php index a58f1de64..2752d8827 100644 --- a/include/class/document.class.php +++ b/include/class/document.class.php @@ -533,6 +533,10 @@ class Document * - [TITLE] * - [DESCRIPTION] * - [COMM_PAYMENT] + * - [LABELOP] + * - [COMMENT] + * - [DESCRIPTION] + * - [DOCUMENT_ID] * * \param $p_tag TAG * \param $p_array data from $_POST @@ -789,6 +793,10 @@ class Document case 'NUMBER': $r=$this->d_number; break; + case "DOCUMENT_ID": + if (isset($p_array['ag_id'])) return $p_array['ag_id']; + return ""; + break; case 'USER' : return $_SESSION['use_name'].', '.$_SESSION['use_first_name']; @@ -814,16 +822,17 @@ class Document * - [DATE_LIMIT] */ case 'DATE_LIMIT_CALC': - extract ($p_array, EXTR_SKIP); - $id='e_ech' ; - if ( !isset (${$id}) ) return ""; - $r=format_date(${$id},'DD.MM.YYYY','YYYY-MM-DD'); - break; + if ( isset ($p_array["e_ech"] )) + return format_date($p_array["ech"],'DD.MM.YYYY','YYYY-MM-DD'); + if ( isset ($p_array["ag_remind_date"] )) + return format_date($p_array["ag_remind_date"],'DD.MM.YYYY','YYYY-MM-DD'); + + break; case 'DATE_LIMIT': - extract ($p_array, EXTR_SKIP); - $id='e_ech' ; - if ( !isset (${$id}) ) return ""; - $r=${$id}; + if ( isset ($p_array["e_ech"] )) + return $p_array["ech"]; + if ( isset ($p_array["ag_remind_date"] )) + return $p_array["ag_remind_date"]; break; case 'MARCH_NEXT': $this->counter++; @@ -1130,7 +1139,7 @@ class Document else return ""; break; - case 'COMMENT': + case 'LABELOP': if ( isset($p_array['e_comm'])) return $p_array['e_comm']; break; @@ -1160,9 +1169,36 @@ class Document $ret=$this->db->get_value('select r_phone from public.stock_repository where r_id=$1',array($p_array['repo'])); return $ret; case 'TITLE': - $http=new HttpInput(); - $title=$http->request("ag_title","string", ""); - return $title; + if ( isset($p_array['ag_title'])) return $p_array['ag_title']; + return ""; + break; + case 'DESCRIPTION': + if ( isset($p_array['ag_id'])) { + // retrieve first comment + $description=$this->db->get_value("select agc_comment " + . " from action_gestion_comment " + . "where ag_id=$1 order by 1 asc limit 1" + ,[$p_array['ag_id']]); + return $description; + } + return ""; + break; + case 'COMMENT': + if ( isset($p_array['ag_id'])) { + // retrieve first comment + $aComment=$this->db->get_array("select agc_comment " + . " from action_gestion_comment " + . "where ag_id=$1 order by 1" + ,[$p_array['ag_id']]); + $nb_comment=count($aComment); + $description=""; + for ($i=0;$i< $nb_comment;$i++) { + $description.=$aComment[$i]['agc_comment']."\n"; + } + return $description; + } + return ""; + break; case 'COMM_PAYMENT': if ( isset($p_array["e_comm_paiement"])) { return $p_array["e_comm_paiement"]; diff --git a/include/class/document_option.class.php b/include/class/document_option.class.php new file mode 100644 index 000000000..cc5553356 --- /dev/null +++ b/include/class/document_option.class.php @@ -0,0 +1,102 @@ + + +/** + * @file + * @brief + */ + +/** + * @class + * @brief + */ +class Document_Option +{ + + /** + * returns true if the operation_detail is enable, otherwise false + * + * @param int $p_document_type Document_Type.dt_id + * @return boolean + */ + static function is_enable_operation_detail($p_document_type) + { + $display_operation=false; + $cn=Dossier::connect(); + if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2", + [$p_document_type, 'detail_operation'])=='1') + { + $display_operation=true; + } + return $display_operation; + } + /** + * returns option from the operation_detail + * + * @param int $p_document_type Document_Type.dt_id + * @return string + */ + static function option_operation_detail($p_document_type) + { + $cn=Dossier::connect(); + $option_operation = $cn->get_value("select do_option from document_option where document_type_id=$1 " + . " and do_code = $2", + [$p_document_type, 'detail_operation']); + return $option_operation; + } + + /** + * returns true if the operation_detail is enable, otherwise false + * + * @param int $p_document_type Document_Type.dt_id + * @return boolean + */ + static function is_enable_contact_multiple($p_document_type) + { + $return=false; + $cn=Dossier::connect(); + if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2", + [$p_document_type, 'contact_multiple'])=='1') + { + $return=true; + } + return $return; + } + + /** + * returns true if the operation_detail is enable, otherwise false + * + * @param int $p_document_type Document_Type.dt_id + * @return boolean + */ + static function is_enable_make_invoice($p_document_type) + { + $return=false; + $cn=Dossier::connect(); + if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2", + [$p_document_type, 'make_invoice'])=='1') + { + $return=true; + } + return $return; + } + +} diff --git a/include/class/document_type.class.php b/include/class/document_type.class.php index 8f0d2fbf1..946202604 100644 --- a/include/class/document_type.class.php +++ b/include/class/document_type.class.php @@ -23,7 +23,9 @@ * \brief class for the table document_type */ -/** \brief class for the table document_type +/** \ + *@brief class for the table document_type , a document_type is a kind of action in the follow up + * * < dt_id pk document_type * < dt_value value */ @@ -91,40 +93,10 @@ class Document_type return $array; } - function insert($p_value, $p_prefix) - { - $sql = "insert into document_type(dt_value,dt_prefix) values ($1,$2)"; - try - { - if ($this->db->count_sql('select * from document_type where upper(dt_value)=upper(trim($1))', array($p_value)) > 0) - throw new Exception('Nom en double'); - if (strlen(trim($p_value)) > 0) - $this->db->exec_sql($sql, array($p_value, $p_prefix)); - } - catch (Exception $e) - { - record_log($e); - alert(j(_("Impossible d'ajouter [$p_value] ") . $e->getMessage())); - } - } - - /** - * Update - */ - function update() - { - try - { - $this->db->exec_sql("update document_type set dt_value=$1,dt_prefix=$2 where dt_id=$3", array($this->dt_value, - $this->dt_prefix, $this->dt_id)); - } - catch (Exception $e) - { - record_log($e); - alert(" Erreur " . $e->getMessage()); - } - } - + /** + * Restart the increment of the document + * @param type $p_int + */ function set_number($p_int) { try diff --git a/include/class/extension.class.php b/include/class/extension.class.php index 5fad200ec..1b321fe60 100644 --- a/include/class/extension.class.php +++ b/include/class/extension.class.php @@ -251,6 +251,12 @@ class Extension extends Menu_Ref_sql } } + /** + * compare the version of the plugin and the last version , propose to update it if a new version exists + * @todo add a mechanism to check once a day + * @global User $g_user + * @global number $version_plugin + */ static function check_plugin_version() { global $g_user, $version_plugin; diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 214b100f8..98aee882c 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -29,6 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/fiche_def.class.php'; require_once NOALYSS_INCLUDE.'/lib/iposte.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_account.class.php'; +require_once NOALYSS_INCLUDE."/lib/input_switch.class.php"; /*! \file * \brief define Class fiche, this class are using @@ -502,6 +503,11 @@ class Fiche $w->table = 1; $bulle = Icon_Action::infobulle(14); break; + case 'check': + $w=new InputSwitch("av_text".$r->ad_id); + $w->value=$r->av_text; + $w->value=(trim($w->value)=="")?1:$w->value; + break; case 'select': $w = new ISelect("av_text" . $attr->ad_id); $w->value = $this->cn->make_array($attr->ad_extra); @@ -641,6 +647,11 @@ class Fiche $w->style=' class="itextarea" style="margin:0px;width:100%"'; $w->value=$r->av_text; break; + case 'check': + $w=new InputSwitch("av_text".$r->ad_id); + $w->value=$r->av_text; + $w->value=(trim($w->value)=="")?1:$w->value; + break; case 'poste': $w=new IPoste("av_text".$r->ad_id); $w->set_attribute('ipopup', 'ipop_account'); @@ -711,6 +722,11 @@ class Fiche $value=$x->display(); $w->value=$value; break; + case 'check': + $w=new InputSwitch("av_text".$r->ad_id); + $w->value=$r->av_text; + $w->value=(trim($w->value)=="")?1:$w->value; + break; default: $w->value=$r->av_text; } @@ -2131,8 +2147,9 @@ class Fiche { $query=sql_string($query); - if (strlen(trim($query))>1) + if (strlen(trim($query))>0) { + $query=str_replace(" ", "%", $query); $filter_query=$and."(vw_name ilike '%$query%' or quick_code ilike ('%$query%') " ." or vw_description ilike '%$query%' or tva_num ilike '%$query%' or accounting like upper('$query%'))"; } diff --git a/include/class/fiche_attr.class.php b/include/class/fiche_attr.class.php index c764731e5..ee7184195 100644 --- a/include/class/fiche_attr.class.php +++ b/include/class/fiche_attr.class.php @@ -1,286 +1,165 @@ column_name,"email"=>"column_name_email","val3"=>0); */ - protected $variable=array("id"=>"ad_id","desc"=>"ad_text","type"=>"ad_type","size"=>"ad_size","extra"=>"ad_extra"); - function __construct ($p_cn,$p_id=0) + function __construct($p_cn, $p_id=0) { - $this->cn=$p_cn; - if ( $p_id == 0 ) - { - /* Initialize an empty object */ - foreach ($this->variable as $key=>$value) $this->$value=''; - } - else - { - /* load it */ - $this->ad_id=$p_id; - $this->load(); - } + parent::__construct($p_cn, $p_id); } + public function get_parameter($p_string) { - if ( array_key_exists($p_string,$this->variable) ) - { - $idx=$this->variable[$p_string]; - return $this->$idx; - } - else - throw new Exception (__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant'); + return $this->getp($p_string); } - public function set_parameter($p_string,$p_value) + + public function set_parameter($p_string, $p_value) { - if ( array_key_exists($p_string,$this->variable) ) - { - $idx=$this->variable[$p_string]; - $this->$idx=$p_value; - } - else - throw new Exception (__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant'); - } - public function get_info() - { - return var_export($this,true); + $this->setp($p_string, $p_value); } + public function verify() { // Verify that the elt we want to add is correct /* verify only the datatype */ - if ( strlen(trim($this->ad_text))==0) - throw new Exception('La description ne peut pas être vide',1); - if ( strlen(trim($this->ad_type))==0) - throw new Exception('Le type ne peut pas être vide',1); + if (strlen(trim($this->ad_text))==0) + throw new Exception('La description ne peut pas être vide', 1); + if (strlen(trim($this->ad_type))==0) + throw new Exception('Le type ne peut pas être vide', 1); $this->ad_type=strtolower($this->ad_type); - if ( in_array($this->ad_type,array('date','text','numeric','zone','poste','card','select'))==false) - throw new Exception('Le type doit être text, numeric,poste, card, select ou date',1); - if ( trim($this->ad_size)=='' || isNumber($this->ad_size)==0||$this->ad_size>22) + if (in_array($this->ad_type, array('date', 'text', 'numeric', 'zone', 'poste', 'card', 'select','check'))==false) + throw new Exception('Le type doit être text, numeric,poste, card, select ou date', 1); + if (trim($this->ad_size)==''||isNumber($this->ad_size)==0||$this->ad_size>22) { switch ($this->ad_type) { - case 'text': + case 'text': $this->ad_size=22; - break; - case 'numeric': - $this->ad_size=9; - break; - case 'date': - $this->ad_size=8; - break; - case 'zone': - $this->ad_size=22; - break; + break; + case 'numeric': + $this->ad_size=9; + break; + case 'date': + $this->ad_size=8; + break; + case 'zone': + $this->ad_size=22; + break; - default: - $this->ad_size=22; + default: + $this->ad_size=22; } } - if ( $this->ad_type == 'numeric' ) { - $this->ad_extra=(trim($this->ad_extra)=='')?'2':$this->ad_extra; - if (isNumber($this->ad_extra) == 0) throw new Exception ("La précision doit être un chiffre"); - - } - if ( $this->ad_type == 'select') + if ($this->ad_type=='numeric') { - if (trim($this->ad_extra)=="") throw new Exception ("La requête SQL est vide "); - if ( preg_match('/^\h*select/i',$this->ad_extra) == 0) throw new Exception ("La requête SQL doit commencer par SELECT "); - try{ - - $this->cn->exec_sql($this->ad_extra); - }catch (Exception $e) - { - record_log($e); - throw new Exception ("La requête SQL ".h($this->ad_extra)." est invalide "); - } + $this->ad_extra=(trim($this->ad_extra)=='')?'2':$this->ad_extra; + if (isNumber($this->ad_extra)==0) + throw new Exception("La précision doit être un chiffre"); } - } - public function save() - { - - /* please adapt */ - if ( $this->ad_id == 0 ) - $this->insert(); - else - $this->update(); - } - /** - *@brief retrieve array of object thanks a condition - *@param $cond condition (where clause) - *@param $p_array array for the SQL stmt - *@see Database::get_array - *@return an empty array if nothing is found - */ - public function seek($cond='',$p_array=null) - { - if ( $cond != '') - $sql="select * from attr_def where $cond order by ad_text"; - else - $sql="select * from attr_def order by ad_text"; - - $aobj=array(); - $array= $this->cn->get_array($sql,$p_array); - // map each row in a object - $size=$this->cn->count(); - if ( $size == 0 ) return $aobj; - for ($i=0;$i<$size;$i++) + if ($this->ad_type=='select') { - $oobj=new Fiche_Attr ($this->cn); - foreach ($array[$i] as $idx=>$value) + if (trim($this->ad_extra)=="") + throw new Exception("La requête SQL est vide "); + if (preg_match('/^\h*select/i', $this->ad_extra)==0) + throw new Exception("La requête SQL doit commencer par SELECT "); + try { - $oobj->$idx=$value; + + $this->cn->exec_sql($this->ad_extra); + } + catch (Exception $e) + { + record_log($e); + throw new Exception("La requête SQL ".h($this->ad_extra)." est invalide "); } - $aobj[]=clone $oobj; } - return $aobj; } - public function insert() - { - try{ - $this->verify(); - /* please adapt */ - $sql="insert into attr_def(ad_text - ,ad_type,ad_size,ad_extra - ) values ($1 - ,$2,$3,$4 - ) returning ad_id"; - $this->ad_id=$this->cn->get_value( - $sql, - array( $this->ad_text,$this->ad_type,$this->ad_size,$this->ad_extra - ) - ); - } catch (Exception $e) - { - record_log($e); - throw $e; - } - - } public function update() { try { - $this->verify(); - if ( $this->ad_id < 9000) return; - /* please adapt */ - $sql=" update attr_def set ad_text = $1 - ,ad_type = $2,ad_size=$4,ad_extra=$5 - where ad_id= $3"; - $res=$this->cn->exec_sql( - $sql, - array($this->ad_text - ,$this->ad_type - ,$this->ad_id,$this->ad_size,$this->ad_extra) - ); - }catch (Exception $e) + $this->verify(); + if ($this->ad_id<9000) + return; + /* please adapt */ + parent::update(); + } + catch (Exception $e) { - record_log($e); + record_log($e); throw $e; } - - - } - /** - *@brief load a object - *@return 0 on success -1 the object is not found - */ - public function load() - { - - $sql="select ad_text - ,ad_type,ad_size,ad_extra - from attr_def where ad_id=$1"; - /* please adapt */ - $res=$this->cn->get_array( - $sql, - array($this->ad_id) - ); - - if ( count($res) == 0 ) - { - /* Initialize an empty object */ - foreach ($this->variable as $key=>$value) $this->$key=''; - - return -1; - } - foreach ($res[0] as $idx=>$value) - { - $this->$idx=$value; - } - return 0; } public function delete() { - if ($this->ad_id < 9000) return; - $sql=$this->cn->exec_sql("delete from fiche_detail where ad_id=$1 ", - array($this->ad_id)); + if ($this->ad_id<9000) + return; + $sql=$this->cn->exec_sql("delete from fiche_detail where ad_id=$1 ", array($this->ad_id)); - $sql="delete from jnt_fic_attr where ad_id=$1"; - $res=$this->cn->exec_sql($sql,array($this->ad_id)); + $sql="delete from jnt_fic_attr where ad_id=$1"; + $res=$this->cn->exec_sql($sql, array($this->ad_id)); $sql="delete from attr_def where ad_id=$1"; - $res=$this->cn->exec_sql($sql,array($this->ad_id)); - + $res=$this->cn->exec_sql($sql, array($this->ad_id)); } - /** - * Unit test for the class + + /* ! + * @brief used with a usort function, to sort an array of Attribut on the attribut_id (ad_id) */ - static function test_me() + + static function sort_by_id($o1, $o2) { - $cn=new Database(25); - $cn->start(); - echo h2info('Test object vide'); - $obj=new Fiche_Attr($cn); - var_dump($obj); - - echo h2info('Test object NON vide'); - $obj->set_parameter('j_id',3); - $obj->load(); - var_dump($obj); - - echo h2info('Update'); - $obj->set_parameter('j_qcode','NOUVEAU CODE'); - $obj->save(); - $obj->load(); - var_dump($obj); - - echo h2info('Insert'); - $obj->set_parameter('j_id',0); - $obj->save(); - $obj->load(); - var_dump($obj); - - echo h2info('Delete'); - $obj->delete(); - echo (($obj->load()==0)?'Trouve':'non trouve'); - var_dump($obj); - $cn->rollback(); - - } - /*! - *@brief used with a usort function, to sort an array of Attribut on the attribut_id (ad_id) - */ - static function sort_by_id($o1,$o2) - { - if ( $o1->ad_id > $o2->ad_id ) return 1; - if ( $o1->ad_id == $o2->ad_id ) return 0; + if ($o1->ad_id>$o2->ad_id) + return 1; + if ($o1->ad_id==$o2->ad_id) + return 0; return -1; } + public function save() + { + /* please adapt */ + if ($this->ad_id < 1) + { + $this->ad_id=-1; + $this->insert(); + } + else + $this->update(); + } + public function to_array($prefix="") + { + + $array=array(); + foreach ($this->name as $key=> $value) + { + $nkey=$prefix.$value; + $array[$nkey]=$this->$value; +// $nkey=$prefix.$key; +// $array[$nkey]=$this->$value; +// + } + tracedebug("card_attribute.log",$array); + return $array; + } } + //Fiche_Attr::test_me(); diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php index 48ad1e2ea..b04bc903e 100644 --- a/include/class/follow_up.class.php +++ b/include/class/follow_up.class.php @@ -31,6 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/fiche.class.php'; require_once NOALYSS_INCLUDE.'/class/document.class.php'; require_once NOALYSS_INCLUDE.'/class/document_type.class.php'; require_once NOALYSS_INCLUDE.'/class/document_modele.class.php'; +require_once NOALYSS_INCLUDE.'/class/document_option.class.php'; require_once NOALYSS_INCLUDE.'/lib/user_common.php'; require_once NOALYSS_INCLUDE.'/class/follow_up_detail.class.php'; require_once NOALYSS_INCLUDE.'/lib/inum.class.php'; @@ -152,7 +153,7 @@ class Follow_Up * * \return string containing the html code */ - function Display($p_view, $p_gen, $p_base, $retour="") + function display($p_view, $p_gen, $p_base, $retour="") { global $g_user; if ($p_view=='UPD') @@ -164,7 +165,6 @@ class Follow_Up { $upd=false; $readonly=false; - $this->ag_ref=_("Nouveau"); } elseif ($p_view=='READ') { @@ -175,6 +175,8 @@ class Follow_Up { throw new Exception('class_action'.__LINE__.'Follow_Up::Display error unknown parameter'.$p_view); } + + // Compute the widget // Date $date=new IDate(); @@ -387,7 +389,7 @@ class Follow_Up $h_agrefid=new IHidden(); $iag_ref=new IText("ag_ref"); $iag_ref->value=$this->ag_ref; - $iag_ref->readOnly=($p_view=="NEW"||$p_view=='READ')?true:false; + $iag_ref->readOnly=false; $str_ag_ref=$iag_ref->input(); // Preparing the return string $r=""; @@ -428,108 +430,9 @@ class Follow_Up $text=new IText(); $num=new INum(); - /* TVA */ - $itva=new ITva_Popup($this->db); - $itva->in_table=true; - $aCard=array(); - /* create aArticle for the detail section */ - $article_count=(count($this->aAction_detail)==0)?MAX_ARTICLE:count($this->aAction_detail); - /* Compute total */ - $tot_item=0; - $tot_vat=0; - for ($i=0; $i<$article_count; $i++) - { - /* fid = Icard */ - $icard=new ICard(); - $icard->jrn=0; - $icard->table=0; - $icard->noadd="no"; - $icard->extra='all'; - $icard->name="e_march".$i; - $tmp_ad=(isset($this->aAction_detail[$i]))?$this->aAction_detail[$i]:false; - $icard->readOnly=$readonly; - $icard->value=''; - $aCard[$i]=0; - if ($tmp_ad) - { - $march=new Fiche($this->db); - $f=$tmp_ad->get_parameter('qcode'); - if ($f!=0) - { - $march->id=$f; - $icard->value=$march->get_quick_code(); - $aCard[$i]=$f; - } - } - $icard->set_dblclick("fill_ipopcard(this);"); - // name of the field to update with the name of the card - $icard->set_attribute('label', "e_march".$i."_label"); - // name of the field to update with the name of the card - $icard->set_attribute('typecard', $icard->extra); - $icard->set_attribute('ipopup', 'ipopcard'); - $icard->set_function('fill_data'); - $icard->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name); - - $aArticle[$i]['fid']=$icard->search().$icard->input(); - - $text->javascript=' onchange="clean_tva('.$i.');compute_ledger('.$i.')"'; - $text->css_size="100%"; - $text->name="e_march".$i."_label"; - $text->id="e_march".$i."_label"; - $text->size=40; - $text->value=($tmp_ad)?$tmp_ad->get_parameter('text'):""; - $text->readOnly=$readonly; - $aArticle[$i]['desc']=$text->input(); - - $num->javascript=' onchange="format_number(this,4);clean_tva('.$i.');compute_ledger('.$i.')"'; - $num->name="e_march".$i."_price"; - $num->id="e_march".$i."_price"; - $num->size=8; - $num->readOnly=$readonly; - $num->value=($tmp_ad)?$tmp_ad->get_parameter('price_unit'):0; - $aArticle[$i]['pu']=$num->input(); - - $num->name="e_quant".$i; - $num->id="e_quant".$i; - $num->size=8; - $num->value=($tmp_ad)?$tmp_ad->get_parameter('quantity'):0; - $aArticle[$i]['quant']=$num->input(); - - $itva->name='e_march'.$i.'_tva_id'; - $itva->id='e_march'.$i.'_tva_id'; - $itva->value=($tmp_ad)?$tmp_ad->get_parameter('tva_id'):0; - $itva->readOnly=$readonly; - $itva->js=' onchange="format_number(this);clean_tva('.$i.');compute_ledger('.$i.')"'; - $itva->set_attribute('compute', $i); - - $aArticle[$i]['tvaid']=$itva->input(); - - $num->name="e_march".$i."_tva_amount"; - $num->id="e_march".$i."_tva_amount"; - $num->value=($tmp_ad)?$tmp_ad->get_parameter('tva_amount'):0; - $num->javascript=" onchange=\"compute_ledger('".$i." ')\""; - $num->size=8; - $aArticle[$i]['tva']=$num->input(); - $tot_vat=bcadd($tot_vat,$num->value); - - $num->name="tvac_march".$i; - $num->id="tvac_march".$i; - $num->value=($tmp_ad)?$tmp_ad->get_parameter('total'):0; - $num->size=8; - $aArticle[$i]['tvac']=$num->input(); - $tot_item=bcadd($tot_item,$num->value); - - $aArticle[$i]['hidden_htva']=HtmlInput::hidden('htva_march'.$i, 0); - $aArticle[$i]['hidden_tva']=HtmlInput::hidden('tva_march'.$i, 0); - $aArticle[$i]['ad_id']=($tmp_ad)?HtmlInput::hidden('ad_id'.$i, $tmp_ad->get_parameter('id')):HtmlInput::hidden('ad_id'.$i, 0); - } - /* Add the needed hidden values */ $r.=dossier::hidden(); - /* add the number of item */ - $Hid=new IHidden(); - $r.=$Hid->input("nb_item", $article_count); $r.=HtmlInput::request_to_hidden(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag")); $a_tag=$this->tag_get(); $menu=new Default_Menu(); @@ -671,9 +574,10 @@ class Follow_Up $this->ag_remind_date /* 13 */ ) ); - + $http=new HttpInput(); + $nb_item=$http->post("nb_item","number",0); /* insert also the details */ - for ($i=0; $i<$_POST['nb_item']; $i++) + for ($i=0; $i<$nb_item; $i++) { $act=new Follow_Up_Detail($this->db); $act->from_array($_POST, $i); @@ -712,7 +616,7 @@ class Follow_Up $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd'); $table->add('Date Comm.', $url, 'order by last_comment', 'order by last_comment desc', 'dca', 'dcd'); $table->add('Date Limite', $url, 'order by ag_remind_date asc', 'order by ag_remind_date desc', 'ra', 'rd'); - $table->add('Tag', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad'); + $table->add('Etiquette', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad'); $table->add('Réf.', $url, 'order by ag_ref asc', 'order by ag_ref desc', 'ra', 'rd'); $table->add('Groupe', $url, "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded'); $table->add('Dest/Exp', $url, 'order by name asc', 'order by name desc', 'ea', 'ed'); @@ -762,7 +666,7 @@ class Follow_Up $r.=''.$table->get_header(0).''; $r.=''.$table->get_header(1).''; $r.=''.$table->get_header(2).''; - $r.=''.$table->get_header(3).''; + $r.=''.$table->get_header(3).''; $r.=''.$table->get_header(4).''; $r.=''.$table->get_header(5).''; $r.=''.$table->get_header(6).''; @@ -861,7 +765,7 @@ class Follow_Up * * \return true on success otherwise false */ - function Update() + function update() { // if ag_id == 0 nothing to do @@ -966,7 +870,9 @@ class Follow_Up $doc->Upload($this->ag_id); /* save action details */ - for ($i=0; $i<$_POST['nb_item']; $i++) + $http=new HttpInput(); + $nb_item=$http->post("nb_item","number",0); + for ($i=0; $i< $nb_item ; $i++) { $act=new Follow_Up_Detail($this->db); $act->from_array($_POST, $i); @@ -1211,7 +1117,7 @@ class Follow_Up /* State of documents */ $type_state=new ISelect('state'); $aState=$cn->make_array('select s_id,s_value from document_state order by s_value'); - $aState[]=array('value'=>'-1', 'label'=>_('Tous les Etats')); + $aState[]=array('value'=>'-1', 'label'=>_('Tous les actions ouvertes')); $type_state->value=$aState; $type_state->selected=(isset($_GET['state']))?$_GET['state']:-1; @@ -1296,15 +1202,26 @@ class Follow_Up if ($p_array==null) $p_array=$_GET; - $query=""; if (count($p_array['searchtag'])==0) return ""; + $query=""; + $operand = "1 = 0 "; + if ($p_array['tag_option'] == 0 ) + { + $operand=" and "; + } elseif ($p_array['tag_option']==1) + { + $operand=" or "; + } + $and=" "; for ($i=0; $i= ag_remind_date"; } - if (!isset($p_array['closed_action'])) + // only for open action or a closing status is selected + if (!isset($p_array['closed_action']) && $ag_state == "") { $action_query.=" and s_status is null "; } @@ -1573,20 +1493,21 @@ class Follow_Up $c=count($a_tag); for ($e=0; $e<$c; $e++) { - echo ''; + echo ''; echo $a_tag[$e]['t_tag']; if ($g_user->can_write_action($this->ag_id)==true) { - $js_remove=sprintf("onclick=\"action_tag_remove('%s','%s','%s')\"", dossier::id(), $this->ag_id, $a_tag[$e]['t_id']); - echo HtmlInput::anchor(SMALLX, "javascript:void(0)", $js_remove, ' class="smallbutton" style="padding:0px;display:inline" '); + $js_remove=sprintf("action_tag_remove('%s','%s','%s')", dossier::id(), $this->ag_id, $a_tag[$e]['t_id']); + echo Icon_Action::trash(uniqid(), $js_remove); } echo ''; echo ' '; echo ' '; } - $js=sprintf("onclick=\"action_tag_select('%s','%s')\"", dossier::id(), $this->ag_id); + if ($g_user->can_write_action($this->ag_id)==true) { + $js=sprintf("onclick=\"action_tag_select('%s','%s')\"", dossier::id(), $this->ag_id); echo HtmlInput::button('tag_bt', 'Ajout tag', $js, 'smallbutton'); } } @@ -1749,14 +1670,16 @@ class Follow_Up $a_linked=$this->db->get_array('select ap_id,f_id from action_person where ag_id=$1', array($this->ag_id)); if (count($a_linked)==0) return ""; + $dossier_id=Dossier::id(); for ($i=0; $idb, $a_linked[$i]['f_id']); $qc=$fiche->get_quick_code(); - $js_remove=sprintf("onclick=\"action_remove_concerned('%s','%s','%s')\"", dossier::id(), $a_linked[$i]['f_id'], $this->ag_id); - echo ''; - echo $qc; - echo HtmlInput::anchor(SMALLX, "javascript:void(0)", $js_remove, ' class="smallbutton" style="padding:0px;display:inline" '); + $js_remove=sprintf("action_remove_concerned('%s','%s','%s')", dossier::id(), $a_linked[$i]['f_id'], $this->ag_id); + echo ''; + echo HtmlInput::anchor($qc,"", sprintf("onclick=\"linked_card_option('%s','%s')\"", + $a_linked[$i]['ap_id'],$dossier_id)); + echo Icon_Action::trash(uniqid(), $js_remove); echo ''; echo ' '; echo ' '; diff --git a/include/class/follow_up_detail.class.php b/include/class/follow_up_detail.class.php index fdb39abfd..2cdd338cb 100644 --- a/include/class/follow_up_detail.class.php +++ b/include/class/follow_up_detail.class.php @@ -233,14 +233,14 @@ class Follow_Up_Detail if (trim($this->ad_total_amount)==""||isNumber($this->ad_total_amount)==0) $this->ad_total_amount=0; if (trim($this->ad_tva_id)=="" || isNumber($this->ad_tva_id)==0) $this->ad_tva_id=0; } - /*!\brief - *\param - *\return - *\note - *\see - */ - static function test_me() -{} + + public static function display(Follow_Up $p_follow_up,$p_view) + { + $option=$p_follow_up->db->get_value("select do_option from document_option " + . " where document_type_id=$1 and do_code='detail_operation'",[$p_follow_up->dt_id]); + + require NOALYSS_TEMPLATE."/follow_up_detail_display.php"; + } } diff --git a/include/class/operation_predef_mtable.class.php b/include/class/operation_predef_mtable.class.php index 2ac3634b5..a425c3e46 100644 --- a/include/class/operation_predef_mtable.class.php +++ b/include/class/operation_predef_mtable.class.php @@ -29,6 +29,13 @@ require_once NOALYSS_INCLUDE."/database/op_predef_sql.class.php"; require_once NOALYSS_INCLUDE."/class/pre_operation.class.php"; require_once NOALYSS_INCLUDE."/lib/select_box.class.php"; +/*! + * \brief Display a table and allow to change the predefined operation, insert or delete. Used the + * class Manage_Table_SQL and the SQL Object for the tables op_predef and op_predef_detail. + * + * @see include/preod.inc.php + * @see include/ajax/ajax_save_predf_op.php + */ class Operation_Predef_MTable extends Manage_Table_SQL { @@ -60,7 +67,7 @@ class Operation_Predef_MTable extends Manage_Table_SQL // create our own "Append button" $this->set_append_row(false); $this->set_dialog_box("prdfop"); - $this->set_dialogbox_style(["position"=>"absolute","top"=>"5%","width:auto","min-width"=>"80%"]); + $this->set_dialogbox_style(["position"=>"fixed","top"=>"5%","width:auto","min-width"=>"80%"]); } /** diff --git a/include/class/pre_op_advanced.class.php b/include/class/pre_op_advanced.class.php index b870ef17a..e1e45ec14 100644 --- a/include/class/pre_op_advanced.class.php +++ b/include/class/pre_op_advanced.class.php @@ -191,8 +191,8 @@ class Pre_Op_Advanced extends Pre_operation_detail $ret.=HtmlInput::hidden('jrn_type', "ODS"); $info = Icon_Action::infobulle(0); $info_poste = Icon_Action::infobulle(9); - if ($g_user->check_action(FICADD) == 1) - $ret.=$f_add_button->input(); + if ($g_user->check_action(FICADD) == 1) $ret.=$f_add_button->input(); + $ret.='
    '; $ret.=''; $ret.='' . '' . @@ -287,6 +287,7 @@ class Pre_Op_Advanced extends Pre_operation_detail // If readonly == 1 then show CA } $ret.='
    Quickcode' . $info . '
    '; + $ret.="
    "; $ret.=Html_Input_Noalyss::ledger_add_item("M"); return $ret; } diff --git a/include/class/profile_menu.class.php b/include/class/profile_menu.class.php index 145f5fd4f..96b06ca58 100644 --- a/include/class/profile_menu.class.php +++ b/include/class/profile_menu.class.php @@ -244,7 +244,8 @@ class Profile_Menu extends Profile_Menu_sql ", array($this->p_id)); $aright_value=array( array('value'=>'R', 'label'=>_('Lecture')), - array('value'=>'W', 'label'=>_('Ecriture')), + array('value'=>'W', 'label'=>_('Ecriture et suppression')), + array('value'=>'O', 'label'=>_('Ecriture')), array('value'=>'X', 'label'=>_('Aucun accès')) ); require_once NOALYSS_TEMPLATE.'/user_sec_profile.php'; diff --git a/include/class/tag.class.php b/include/class/tag.class.php index a6a6855f0..2f3b0a1c0 100644 --- a/include/class/tag.class.php +++ b/include/class/tag.class.php @@ -42,6 +42,11 @@ class Tag function select() { $ret=$this->data->seek("where t_actif='Y' order by t_tag"); + $ret=$this->cn->exec_sql(" select t_id,t_tag,t_description,'t' as tag_type + from tags + where t_actif='Y' + union all + select tg_id,tg_name ,'G','g' from tag_group order by 2"); require_once NOALYSS_TEMPLATE.'/tag_select.php'; } /** @@ -90,18 +95,20 @@ class Tag */ function select_search($p_prefix) { + $res=""; $ret=$this->data->seek(' order by t_tag'); require_once NOALYSS_TEMPLATE.'/tag_search_select.php'; + return HtmlInput::title_box('Tag', $p_prefix.'tag_div').$res; } /** * In the screen search add this data to the cell */ function update_search_cell($p_prefix) { - echo ''; + echo ''; echo h($this->data->t_tag); echo HtmlInput::hidden($p_prefix.'tag[]', $this->data->t_id); $js=sprintf("$('sp_".$p_prefix.$this->data->t_id."').remove();"); - echo HtmlInput::anchor( SMALLX, "javascript:void(0)", "onclick=\"$js\"", ' class="smallbutton " style="padding:0px;display:inline" '); + echo Icon_Action::trash(uniqid(), $js); echo ''; } /** diff --git a/include/class/tag_group_mtable.class.php b/include/class/tag_group_mtable.class.php new file mode 100644 index 000000000..b99350118 --- /dev/null +++ b/include/class/tag_group_mtable.class.php @@ -0,0 +1,95 @@ + + + +/** + * @file + * @brief manage tag_group table + * + * + */ +require_once NOALYSS_INCLUDE.'/lib/manage_table_sql.class.php'; +require_once NOALYSS_INCLUDE.'/database/tag_group_sql.class.php'; + +class Tag_Group_MTable extends Manage_Table_SQL +{ + + function __construct(Tag_Group_SQL $p_obj) + { + parent::__construct($p_obj); + $this->set_property_visible("tg_id", false); + $this->set_property_updatable("tg_id", false); + $this->set_col_label("tg_name", _('Nom')); + } + + function input() + { + + + parent::input(); + + + echo '
    '; + $this->input_tag(); + echo '
    '; + } + + /** + * Display a select widget for adding new tag + */ + function input_tag() + { + $cn=Dossier::connect(); + $data_sql=$this->get_table(); + + // Display containing tag_id + $aTag=$cn->get_array("select jt_id,t_tag + from tags join jnt_tag_group_tag on (tag_id=t_id) + where tag_group_id=$1 order by 2", [$data_sql->tg_id]); + // not possible to add tag to inexisting group + if ( $data_sql->tg_id == -1){ + return; + } + echo '
      '; + $nb=count($aTag); + $dossier_id=Dossier::id(); + for ($i=0; $i<$nb; $i++) + { + // js to remove id + $js=Icon_Action::trash(uniqid(), sprintf("o_tagGroup.remove('%s','%s')", $aTag[$i]['jt_id'], $dossier_id)); + printf('
    1. %s %s %s
    2. ', $aTag[$i]['jt_id'],$aTag[$i]['t_tag'],$dossier_id,$js); + } + echo '
    '; + + + // Add new tag + $select=new ISelect("is_tag", [], "s_tag_group"); + $select->value=$cn->make_array("select t_id,t_tag + from tags + where + t_id not in (select tag_id from jnt_tag_group_tag + where tag_group_id=$1 ) order by 2", 0,[$data_sql->tg_id]); + echo $select->input(); + echo HtmlInput::button('b_add_group', _("Ajout"), + sprintf("onclick=\"o_tagGroup.add_tag('%s','%s','%s'); \"", $data_sql->tg_id, $select->id, $dossier_id)); + } + +} diff --git a/include/class/user.class.php b/include/class/user.class.php index 5cee77543..23051d0f7 100644 --- a/include/class/user.class.php +++ b/include/class/user.class.php @@ -1191,6 +1191,22 @@ class User * @return true if he can write otherwise false */ function can_write_action($dtoc) + { + if ( $this->Admin() == 1 ) return TRUE; + if ( $this->get_status_security_action()==0) return TRUE; + $profile = $this->get_profile(); + $r = $this->db->get_value(" select count(*) from action_gestion where ag_id=$1 and ag_dest in + (select p_granted from user_sec_action_profile where ua_right in ('W','O') and p_id=$2) ", array($dtoc, $profile)); + if ($r == 0) + return FALSE; + return true; + } + /** + *Check if the profile of the user can write AND delete for this profile + * @param $dtoc action_gestion.ag_id + * @return true if he can write otherwise false + */ + function can_delete_action($dtoc) { if ( $this->Admin() == 1 ) return TRUE; if ( $this->get_status_security_action()==0) return TRUE; diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index 2059cf74c..d02c09736 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -240,7 +240,7 @@ else $Ledger->id = $request_jrn; if (isset ($_REQUEST['p_jrn_predef'])){ - $Ledger->id=$_REQUEST['p_jrn_predef']; + $Ledger->id=$http->request('p_jrn_predef'); } // pre defined operation // @@ -259,6 +259,7 @@ try $acompte=$http->request("acompte", "string",0); echo ""; + echo HtmlInput::hidden("ac", $ac); /* request for a predefined operation */ if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']) && ! isset($correct) ) { diff --git a/include/constant.php b/include/constant.php index 966ef5dcb..7382a81e2 100644 --- a/include/constant.php +++ b/include/constant.php @@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) { if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",144); +define ("DBVERSION",146); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",18); define ('NOTFOUND','--not found--'); @@ -212,6 +212,7 @@ define( 'ATTR_DEF_ACCOUNT_ND_TVA',50); define('ATTR_DEF_ACCOUNT_ND_TVA_ND',51); define ('ATTR_DEF_ACCOUNT_ND_PERSO',52); define ('ATTR_DEF_ACCOUNT_ND',53); +define ('ATTR_DEF_ACTIF',54); define ("FICHE_TYPE_CLIENT",9); define ("FICHE_TYPE_VENTE",1); diff --git a/include/constant.security.php b/include/constant.security.php index baf161e46..c395bed64 100644 --- a/include/constant.security.php +++ b/include/constant.security.php @@ -22,6 +22,7 @@ define ('FICADD',800); /* Ajout de fiche */ define ("FIC",805); //Création, modification et effacement de fiche define ("FICCAT",910); //création, modification et effacement de catégorie de fiche define ('RMDOC',1020); // Effacement de document pour follow up & comptabilité +define ('TAGADD',1025); // Ajout de tag define ('VIEWDOC',1010); // Voir document pour follow up define ('PARCATDOC',1050); // modifier type document pour follow up define ('RMRECEIPT',1110); // Effacer un document d'une pièce comptable diff --git a/include/contact_option_ref.inc.php b/include/contact_option_ref.inc.php new file mode 100644 index 000000000..a78cc4d57 --- /dev/null +++ b/include/contact_option_ref.inc.php @@ -0,0 +1,58 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); +require_once NOALYSS_INCLUDE."/class/contact_option_ref_mtable.class.php"; +echo '
    '; +/** + * @file + * @brief add option for contact + * @see contact_option_list + * @see action_document_type_mtable::input() + */ +$http=new HttpInput(); +try +{ + $action=$http->request("sa", "string", "list"); +} +catch (Exception $ex) +{ + record_log(__FILE__." no p_id"); + return; +} +$cn=Dossier::connect(); + +// document_option id from document_option where do_code='contact_multiple' and document_type_id=p_id +$obj=new Contact_option_ref_SQL($cn); + +$contact_mtable=new Contact_Option_Ref_MTable($obj); + +$contact_mtable->set_callback("ajax_misc.php"); +$contact_mtable->set_object_name("s_contact_option"); +$contact_mtable->set_dialog_box("db_contact_option"); +$contact_mtable->add_json_param("op", "contact_option_list"); + +$contact_mtable->create_js_script(); +$contact_mtable->display_table(); + + +echo '
    '; \ No newline at end of file diff --git a/include/database/attr_def_sql.class.php b/include/database/attr_def_sql.class.php new file mode 100644 index 000000000..450a1203a --- /dev/null +++ b/include/database/attr_def_sql.class.php @@ -0,0 +1,68 @@ +table="public.attr_def"; + $this->primary_key="ad_id"; + /* + * List of columns + */ + $this->name=array( + "id"=>"ad_id" + , "desc"=>"ad_text" + , "type"=>"ad_type" + , "size"=>"ad_size" + , "extra"=>"ad_extra" + , "search_followup"=>"ad_search_followup" + ); + /* + * Type of columns + */ + $this->type=array( + "ad_id"=>"numeric" + , "ad_text"=>"text" + , "ad_type"=>"text" + , "ad_size"=>"text" + , "ad_extra"=>"text" + , "ad_search_followup"=>"numeric" + ); + + + $this->default=array( + "ad_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} diff --git a/include/database/contact_option_ref_sql.class.php b/include/database/contact_option_ref_sql.class.php new file mode 100644 index 000000000..5e3906094 --- /dev/null +++ b/include/database/contact_option_ref_sql.class.php @@ -0,0 +1,66 @@ + + +require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php'; +require_once NOALYSS_INCLUDE.'/class/database.class.php'; + +/** + * class_contact_option_ref_sql.php + * + * @file + * @brief abstract of the table public.contact_option_ref */ +class Contact_option_ref_SQL extends Noalyss_SQL +{ + + function __construct(Database $p_cn, $p_id=-1) + { + $this->table="public.contact_option_ref"; + $this->primary_key="cor_id"; + /* + * List of columns + */ + $this->name=array( + "cor_id"=>"cor_id" + , "cor_label"=>"cor_label" + , "cor_type"=>"cor_type" + , "cor_value_select"=>"cor_value_select" + ); + /* + * Type of columns + */ + $this->type=array( + "cor_id"=>"numeric" + , "cor_label"=>"text" + , "cor_type"=>"numeric" + , "cor_value_select"=>"text" + ); + + + $this->default=array( + "cor_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} diff --git a/include/database/document_type_sql.class.php b/include/database/document_type_sql.class.php new file mode 100644 index 000000000..cd493e3aa --- /dev/null +++ b/include/database/document_type_sql.class.php @@ -0,0 +1,68 @@ +table="public.document_type"; + $this->primary_key="dt_id"; + /* + * List of columns + */ + $this->name=array( + "dt_id"=>"dt_id" + , "dt_value"=>"dt_value" + , "dt_prefix"=>"dt_prefix" + ); + /* + * Type of columns + */ + $this->type=array( + "dt_id"=>"numeric" + , "dt_value"=>"text" + , "dt_prefix"=>"text" + ); + + + $this->default=array( + "dt_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} diff --git a/include/database/tag_group_sql.class.php b/include/database/tag_group_sql.class.php new file mode 100644 index 000000000..279232377 --- /dev/null +++ b/include/database/tag_group_sql.class.php @@ -0,0 +1,62 @@ +table = "public.tag_group"; + $this->primary_key = "tg_id"; +/* + * List of columns + */ + $this->name=array( + "tg_id"=>"tg_id" + ,"tg_name"=>"tg_name" + ); +/* + * Type of columns + */ + $this->type = array( + "tg_id"=>"numeric" + ,"tg_name"=>"text" + ); + + + $this->default = array( + "tg_id" => "auto" + ); + + $this->date_format = "DD.MM.YYYY"; + parent::__construct($p_cn,$p_id); + } + + +} \ No newline at end of file diff --git a/include/export/export_follow_up_contact_csv.php b/include/export/export_follow_up_contact_csv.php new file mode 100644 index 000000000..569f94f12 --- /dev/null +++ b/include/export/export_follow_up_contact_csv.php @@ -0,0 +1,68 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); +require_once NOALYSS_INCLUDE.'/class/follow_up.class.php'; +require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php'; + +$http=new HttpInput(); +$ag_id=$http->get("ag_id", "number"); + +if ( $g_user->can_read_action($ag_id) == false ) return; + + +/** + * @file + * @brief export a follow up in CSV + */ +$csv=new Noalyss_CSV("followup".$ag_id); +$csv->send_header(); + +$document=new Follow_Up($cn); +echo $document->export_csv(["tdoc"=>$ag_id]); + +$ret=$cn->exec_sql("select f_id,(select ad_value from fiche_detail where f_id=a.f_id and ad_id=25) as company, +(select ad_value from fiche_detail where f_id=a.f_id and ad_id=1) as name, +(select ad_value from fiche_detail where f_id=a.f_id and ad_id=32) as first_name, +(select ad_value from fiche_detail where f_id=a.f_id and ad_id=23) as quick_code, +cor.cor_label, +apo.ap_value +from action_person a +left join action_person_option apo ON (a.ap_id=apo.action_person_id) +left join contact_option_ref cor on (apo.contact_option_ref_id=cor.cor_id) +where ag_id=$1",[$ag_id]); +$aTitle= array ( + array("title"=>_("fiche_id"), "type"=>"string"), + array("title"=>_("société"), "type"=>"string"), + array("title"=>_("nom"), "type"=>"string"), + array("title"=>_("prénom"), "type"=>"string"), + array("title"=>_("qcode"), "type"=>"string"), + array("title"=>_("option"), "type"=>"string"), + array("title"=>_("valeur"), "type"=>"string")); +$cn->query_to_csv($ret,$aTitle); + +$ret=$cn->exec_sql('select t_tag,t_description from action_tags join tags using (t_id) where ag_id=$1',[$ag_id]); +$aTitle=array( + array('title'=>_('Etiquette'),"type"=>"string"), + array('title'=>_("Description"),"type"=>"string") +); +$cn->query_to_csv($ret,$aTitle); \ No newline at end of file diff --git a/include/lib/function_javascript.php b/include/lib/function_javascript.php index 10079acf5..b34b68cb0 100644 --- a/include/lib/function_javascript.php +++ b/include/lib/function_javascript.php @@ -2782,6 +2782,7 @@ function load_all_script() echo js_include('sorttable.js'); echo js_include('nicEdit.js'); echo js_include('managetable.js'); + echo js_include('taggroup.js'); } diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 7dd1ccdf3..7ca7c5516 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -828,12 +828,12 @@ class HtmlInput /** * Title for boxes, you can customize the symbol thanks symbol with * the mode "custom" - * @param type $name Title - * @param type $div element id, except for mode none or custom - * @param type $mod hide , close , zoom , custom or none, with + * @param string $p_name Title + * @param string $div element id, except for mode none or custom + * @param string $p_mod hide , close , zoom , custom or none, with * custom , the $name contains all the code - * @param type $p_js contains the javascript if mod = "custom" or "zoom" contains button + code - * @param type $p_draggable , if set to yes the box will be draggable + * @param string $p_js contains the javascript if mod = "custom" or "zoom" contains button + code + * @param char $p_draggable , y = yes n = no ,if set to yes the box will be draggable * @return type */ static function title_box($p_name, $p_div, $p_mod="close", $p_js="", @@ -868,7 +868,9 @@ class HtmlInput $r.=""; } else - die(__FILE__.":".__LINE__._('Paramètre invaide')); + { + throw new Exception(__FILE__.":".__LINE__._("Paramètre invalide p_mod = '$p_mod'")); + } $r.=''; @@ -912,7 +914,7 @@ class HtmlInput { if ($p_js!="") { - $p_url="javascript:void(0)"; + $p_url='href="#"'; } else { $p_url=sprintf('href="%s"',$p_url); } @@ -1138,7 +1140,7 @@ class HtmlInput { $dossier=Dossier::id(); $javascript=<<style=' '; $this->accvis=1; //!< account_visible =1 otherwise 0 $this->limit=12; //!< Max of row show + $this->amount_from_type=''; //!< in the follow up ,when a card is selected you take Prix Vente or Prix Achat } /** @@ -322,7 +323,7 @@ class ICard extends HtmlInput if (!isset($this->id)) $this->id=$this->name; $a=""; - foreach (array('typecard', 'jrn', 'label', 'price', 'tvaid', 'accvis') as + foreach (array('typecard', 'jrn', 'label', 'price', 'tvaid', 'accvis','amount_from_type') as $att) { if (isset($this->$att)) diff --git a/include/lib/iconcerned.class.php b/include/lib/iconcerned.class.php index d43fa3e4c..2c4a4187f 100644 --- a/include/lib/iconcerned.class.php +++ b/include/lib/iconcerned.class.php @@ -1,4 +1,5 @@ name=$p_name; - $this->value=$p_value; - $this->amount_id=null; - $this->paid=''; - $this->id=$p_id; - $this->tiers=""; // id of the field for the tiers to be updated - $this->div=""; // Dom Element to show the search result - $this->hideOperation=""; // string of j_id to hide, separated by comma to avoid to reconcile an operation with itself - } - /*!\brief show the html input of the widget*/ - public function input($p_name=null,$p_value=null) + private $hideOperation; //!< string of j_id to hide, separated by comma to avoid to reconcile an operation with itself + private $singleOperation; //!< do not allow to select several operations + + public function __construct($p_name='', $p_value='', $p_id="") + { + $this->name=$p_name; + $this->value=$p_value; + $this->amount_id=null; + $this->paid=''; + $this->id=$p_id; + // id of the field for the tiers to be updated + $this->tiers=""; + // Dom Element to show the search result + $this->div=""; + // string of j_id to hide, separated by comma to avoid to reconcile an operation with itself + $this->hideOperation=""; + // by default we can select several operation + $this->singleOperation=0; + } + + /* !\brief show the html input of the widget */ + + public function input($p_name=null, $p_value=null) { $this->name=($p_name==null)?$this->name:$p_name; $this->value=($p_value==null)?$this->value:$p_value; - if ( $this->readOnly==true) return $this->display(); + if ($this->readOnly==true) + return $this->display(); $this->id=($this->id=="")?$this->name:$this->id; - $javascript=sprintf("search_reconcile(".dossier::id().",'%s','%s','%s','%s','%s')", - $this->name, - $this->amount_id, - $this->paid, - $this->div, - $this->tiers ); + $javascript=sprintf("search_reconcile(".dossier::id().",'%s','%s','%s','%s','%s')", $this->name, + $this->amount_id, $this->paid, $this->div, $this->tiers); $r=Icon_Action::icon_magnifier(uniqid(), $javascript); $r.=sprintf(" - + - ", - $this->name, - $this->id, - $this->value, - $this->hideOperation, - $this->id - ); + ", $this->name, $this->id, $this->value, $this->hideOperation,$this->singleOperation, + $this->id + ); return $r; } /** * setter - * @param $p_string + * @param number $p_string jrn.jr_id of the operation to hide */ function set_hideOperation($p_string) { $this->hideOperation=strip_tags($p_string); } - /*!\brief print in html the readonly value of the widget*/ + + /** + * Set the value of single operation, limit to one operation if TRUE + * @param bool $p_value TRUE or false + */ + function set_singleOperation($p_value){ + if ( $p_value == TRUE ) { + $this->singleOperation=1; + return; + } + if ( $p_value == FALSE ) { + $this->singleOperation=0; + return; + } + throw new Exception (_("setSingleOperation failed")); + } + + function get_singleOperation(){ + return $this->singleOperation; + } + + /* !\brief print in html the readonly value of the widget */ + public function display() { - $r=sprintf("%s",$this->value); - $r.=sprintf('', $this->name,$this->value); + $r=sprintf("%s", $this->value); + $r.=sprintf('', $this->name, $this->value); return $r; - } + static public function test_me() { + } + } diff --git a/include/lib/inplace_switch.class.php b/include/lib/inplace_switch.class.php index 77d395331..914ca0fe2 100644 --- a/include/lib/inplace_switch.class.php +++ b/include/lib/inplace_switch.class.php @@ -70,16 +70,17 @@ class Inplace_Switch throw new Exception(_("Invalide value")); } - printf('', $color,$this->name); - echo $icon; - echo ''; - echo <<', $color,$this->name); + $r.=$icon; + $r.= '
    '; + $r.=<< {$this->name}.onclick=function() {new Ajax.Updater({$this->name},'{$this->callback}',{method:"get",parameters:{$this->json},evalScripts:true} ); {$this->jscript} } EOF; + return $r; } public function get_jscript() { diff --git a/include/lib/input_switch.class.php b/include/lib/input_switch.class.php index ba67d7f55..3d8345cfe 100644 --- a/include/lib/input_switch.class.php +++ b/include/lib/input_switch.class.php @@ -45,6 +45,7 @@ class InputSwitch extends HtmlInput function input($p_name=NULL, $p_value=NULL) { + $r=""; if ($p_name!=NULL) $this->value_container=$p_name; if ($p_value!==NULL) @@ -56,25 +57,25 @@ class InputSwitch extends HtmlInput throw new Exception(_("Valeur invalide"),1); } if ($this->readOnly == TRUE) { - $this->display(); - return; + return $this->display(); } - echo HtmlInput::hidden($this->value_container, $this->value); + $r.= HtmlInput::hidden($this->value_container, $this->value); $this->javascript=sprintf('toggle_onoff(\'%s\',\'%s\');%s;',$this->icon,$this->value_container,$this->javascript); if ($this->value=='1') { - echo Icon_Action::iconon($this->icon, $this->javascript); + $r.=Icon_Action::iconon($this->icon, $this->javascript); } else { - echo Icon_Action::iconoff($this->icon, $this->javascript); + $r.=Icon_Action::iconoff($this->icon, $this->javascript); } + return $r; } function display() { if ($this->value=='1') { - echo Icon_Action::iconon($this->icon, ""); + return Icon_Action::iconon($this->icon, ""); } else { - echo Icon_Action::iconoff($this->icon, ""); + return Icon_Action::iconoff($this->icon, ""); } } diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index 20784304a..b0e8cfa1f 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -61,6 +61,7 @@ * @see sorttable.js * */ +require_once NOALYSS_INCLUDE."/lib/http_input.class.php"; class Manage_Table_SQL { @@ -102,7 +103,7 @@ class Manage_Table_SQL foreach ($this->table->name as $key=> $value) { - $this->a_label_displaid[$value]=$value; + $this->a_label_displaid[$value]=$key; $this->a_order[$order]=$value; $this->a_prop[$value]=self::UPDATABLE|self::VISIBLE; $this->a_type[$value]=$this->table->type[$value]; @@ -258,7 +259,7 @@ class Manage_Table_SQL } /** - * This function can be overrided to check the data before + * @brief This function can be overrided to check the data before * inserting , updating or removing, above an example of an overidden check. * * Usually , you get the row of the table (get_table) , you check the conditions @@ -268,7 +269,8 @@ class Manage_Table_SQL * * @see set_error get_error count_error * @return boolean - * @code + * +@code function check() { global $cn; @@ -292,7 +294,7 @@ function check() if ( $is_error > 0 ) return false; return true; } - * @endcode +@endcode */ function check() { @@ -690,10 +692,12 @@ function check() if ($i==0) { $this->display_table_header(); + echo ''; } $row=Database::fetch_array($ret, $i); $this->display_row($row); } + echo ''; echo ""; if ($this->can_append_row()==TRUE) { @@ -713,6 +717,7 @@ function check() function display_table_header() { $nb=count($this->a_order); + echo ''; echo ""; if ($this->can_update_row() && $this->icon_mod=="left") @@ -743,6 +748,7 @@ function check() echo th(" ", 'style="width:40px" class="sorttable_nosort" '); } echo ""; + echo ''; } /** * set the column to sort by default @@ -776,6 +782,7 @@ function check() function from_request() { $nb=count($this->a_order); + $http=new HttpInput(); for ($i=0; $i<$nb; $i++) { @@ -783,7 +790,7 @@ function check() if ($this->get_property_visible($key)==TRUE&&$this->get_property_updatable($key) ==TRUE) { - $v=HtmlInput::default_value_request($this->a_order[$i], ""); + $v=$http->request($this->a_order[$i],"string",""); $this->table->$key=strip_tags($v); } } @@ -826,9 +833,10 @@ function check() */ function display_row($p_row) { - + + $pk_id=$p_row[$this->table->primary_key]; printf('', $this->object_name, - $p_row[$this->table->primary_key]) + $pk_id) ; if ($this->icon_mod=="left") @@ -840,10 +848,11 @@ function check() for ($i=0; $i<$nb_order; $i++) { $v=$this->a_order[$i]; + if ($i==0&&$this->icon_mod=="first"&&$this->can_update_row()) { $js=sprintf("onclick=\"%s.input('%s','%s');\"", $this->object_name, - $p_row[$this->table->primary_key], $this->object_name); + $pk_id, $this->object_name); $td=($i == $this->col_sort ) ? sprintf('',$p_row[$v]):""; echo $td.HtmlInput::anchor($p_row[$v], "", $js).''; } @@ -871,7 +880,7 @@ function check() $nb_search=(is_array($array_to_search))?count($array_to_search):0; $found=FALSE; for ( $e=0;$e< $nb_search;$e++) { - if (isset ($array_to_search[$e]['value']) && $array_to_search[$e]['value']==$value ) { + if (isset ($array_to_search[$e]['value']) && $array_to_search[$e]['value']==$value ) { $found=TRUE; echo td($array_to_search[$e]['label']); } @@ -884,7 +893,7 @@ function check() } elseif ($this->get_col_type($v)=="custom") { // For custom col - echo td($this->display_row_custom($v,$p_row[$v])); + echo td($this->display_row_custom($v,$p_row[$v],$pk_id)); } else { echo td($p_row[$v]); @@ -904,12 +913,13 @@ function check() * For the type custom , we can call a function to display properly the value * @param $p_key string key name * @param $p_value string value + * @param int $p_id id of the row (optional default 0) * @see input_custom * @see set_type * @note must return a string which will be in surrounded by td in the function display_row * @return string */ - function display_row_custom($p_key,$p_value) { + function display_row_custom($p_key,$p_value,$p_id=0) { return $p_value; } /** @@ -1094,7 +1104,7 @@ function check() ob_start(); - echo HtmlInput::title_box("Donnée", $this->dialog_box,"close","","y"); + echo HtmlInput::title_box(_("Donnée"), $this->dialog_box,"close","","y"); printf('', $this->object_name, $this->table->get_pk_value(), $this->object_name, $this->object_name, diff --git a/include/lib/message_javascript.php b/include/lib/message_javascript.php index e9b9d1ebf..cebdf2245 100644 --- a/include/lib/message_javascript.php +++ b/include/lib/message_javascript.php @@ -107,4 +107,5 @@ content[73]=""; content[75]=""; content[76]=""; +content[77]=""; diff --git a/include/param_sec.inc.php b/include/param_sec.inc.php index 997cb2649..0b5436ca8 100644 --- a/include/param_sec.inc.php +++ b/include/param_sec.inc.php @@ -50,7 +50,7 @@ require_once NOALYSS_INCLUDE.'/lib/user_menu.php'; ///////////////////////////////////////////////////////////////////////// if ( ! isset($_REQUEST['action'])) { - $base_url=$_SERVER['PHP_SELF']."?ac=".$_REQUEST['ac']."&".dossier::get(); + $base_url=NOALYSS_URL."/do.php?".http_build_query(array("ac"=>$http->request("ac"),"gDossier"=>dossier::id())); echo '
    '; $header=new Sort_Table(); @@ -59,7 +59,7 @@ if ( ! isset($_REQUEST['action'])) $header->add(_("Type d'utilisateur"),$base_url,"order by use_admin asc,use_login asc","order by use_admin desc,use_login desc",'ta','td'); - $order=(isset($_REQUEST['ord']))?$_REQUEST['ord']:'la'; + $order=$http->request("ord","string","la"); $ord_sql=$header->get_sql_order($order); @@ -73,12 +73,13 @@ if ( ! isset($_REQUEST['action'])) use_admin from ac_users left join jnt_use_dos using (use_id) where use_login != $2 and use_active=1 - and (dos_id=$1 or (dos_id is null and use_admin=1))" . $ord_sql, array($gDossier,NOALYSS_ADMINISTRATOR)); + and (dos_id=$1 or (dos_id is null and use_admin=1))" . $ord_sql, + array($gDossier,NOALYSS_ADMINISTRATOR)); $MaxUser = Database::num_row($user_sql); - echo ''; + echo '
    '; echo ""; echo ''; echo ''; @@ -98,26 +99,28 @@ if ( ! isset($_REQUEST['action'])) if ( $l_line['use_admin'] == 1 ) $str=_('Administrateur'); - // get profile - $profile=$cn->get_value("select p_name from profile - join profile_user using(p_id) where user_name=$1",array($l_line['use_login'])); + // get profile + $profile=$cn->get_value("select p_name from profile + join profile_user using(p_id) where user_name=$1",array($l_line['use_login'])); - $url=$base_url."&action=view&user_id=".$l_line['use_id']; - echo ""; - echo td($l_line['use_name']); - echo td($l_line['use_first_name']); - echo td($profile); - // status of security on ledger and action + $url=$base_url."&action=view&user_id=".$l_line['use_id']; + echo ""; + echo td($l_line['use_name']); + echo td($l_line['use_first_name']); + echo td($profile); + // status of security on ledger and action $a_sec=$cn->get_row("select us_ledger,us_action from user_active_security where us_login =$1", - [$l_line['use_login']]); - if ( ! empty ($a_sec)) { + [$l_line['use_login']]); + if ( ! empty($a_sec ) ) { echo td($a_sec['us_ledger']); echo td($a_sec['us_action']); + } else { + echo td(_("Erreur sécurité")); } - echo td($str); - echo ""; + echo td($str); + echo ""; } echo '
    '.$header->get_header(0).''.$header->get_header(1).'"; - echo HtmlInput::anchor($l_line['use_login'], $url); - echo ""; + echo HtmlInput::anchor($l_line['use_login'], $url); + echo "
    '; } @@ -140,7 +143,7 @@ if ( isset ($_GET["action"] )) if ( $action == "view" ) { $l_Db=sprintf("dossier%d",$gDossier); - $return= HtmlInput::button_anchor(_('Retour à la liste'),'?&ac='.$_REQUEST['ac'].'&'.dossier::get(),_('retour'),"",'smallbutton'); + $return= HtmlInput::button_anchor(_('Retour à la liste'),'?&ac='.$http->request('ac').'&'.dossier::get(),_('retour'),"",'smallbutton'); $repo=new Database(); $user_id=$http->get('user_id',"number"); @@ -223,9 +226,7 @@ if ( $action == "view" ) echo _("Profil")." ".$ie_profile->input(); echo "

    "; echo '
    '._('Journaux').''; - echo HtmlInput::button("grant_all", _("Accès à tout"), " onclick=\" grant_ledgers ('W') \""); - echo HtmlInput::button("grant_readonly", _("Uniquement Lecture"), " onclick=\" grant_ledgers ('R') \""); - echo HtmlInput::button("revoke_all", _("Aucun accès"), " onclick=\" grant_ledgers ('X') \""); + //------------------------------------------------------------------------- // Enable or not the security on ledger //------------------------------------------------------------------------- @@ -240,6 +241,7 @@ if ( $action == "view" ) $status_sec_ledger=0; $sec_User->set_status_security_ledger(0); } else { + $sec_ledger=new Inplace_Switch("sec_ledger", $status_sec_ledger); $sec_ledger->set_callback("ajax_misc.php"); $sec_ledger->add_json_param("gDossier", $n_dossier_id); @@ -247,12 +249,19 @@ if ( $action == "view" ) $sec_ledger->add_json_param("op", "user_sec_ledger"); $sec_ledger->set_jscript(" if ( $('security_ledger_tbl').visible() || {$sec_User->Admin()}==1) { $('security_ledger_tbl').hide();} else { $('security_ledger_tbl').show();}"); echo $sec_ledger->input(); + echo "

    "; + echo _("La sécurité sur les journaux, permet de limiter l'accès de l'utilisateur aux journaux, si cette ". + " sécurité n'est pas activée , l'utilisateur a accès à tous les journaux en lecture et écriture"); + echo "

    "; } echo "

    "; //------------------------------------------------------------------------ // Access by ledgers, needed if the security on ledger is enable //------------------------------------------------------------------------ echo '
    '; + echo HtmlInput::button("grant_all", _("Accès à tout"), " onclick=\" grant_ledgers ('W') \""); + echo HtmlInput::button("grant_readonly", _("Uniquement Lecture"), " onclick=\" grant_ledgers ('R') \""); + echo HtmlInput::button("revoke_all", _("Aucun accès"), " onclick=\" grant_ledgers ('X') \""); echo ''; $MaxJrn=Database::num_row($Res); $jrn_priv=new ISelect("iledger"); @@ -287,12 +296,12 @@ if ( $action == "view" ) echo ''; echo ''; + echo '
    '; //********************************************************************** // Show Priv. for actions //********************************************************************** echo '
    '._('Actions').''; - echo HtmlInput::button("grant_all_action", _("Toutes les actions"), " onclick=\" grant_action(1) \""); - echo HtmlInput::button("revoke_all_action", _("Aucune action"), " onclick=\" grant_action (0) \""); + //------------------------------------------------------------------------- // Enable or not the security on ledger //------------------------------------------------------------------------- @@ -305,7 +314,7 @@ if ( $action == "view" ) $status_sec_action=0; $sec_User->set_status_security_action(0); } else { - + $status_sec_action=$sec_User->get_status_security_action(); $sec_action=new Inplace_Switch("sec_action", $status_sec_action); $sec_action->set_callback("ajax_misc.php"); @@ -314,6 +323,10 @@ if ( $action == "view" ) $sec_action->add_json_param("op", "user_sec_action"); $sec_action->set_jscript(" if ( $('security_action_tbl').visible() ) { $('security_action_tbl').hide();} else { $('security_action_tbl').show();}"); echo $sec_action->input(); + echo "

    "; + echo _("La sécurité sur les actions permet de limiter ce que l'utilisateur peut faire, si " + . " elle n'est pas active l'utilisateur a donc accès à toutes ces actions"); + echo "

    "; } echo "

    "; @@ -360,7 +373,11 @@ if ( $action == "view" ) var i=0; var str_id=""; for (i = 0;i < a_select.length;i++) { + str_id = new String( a_select[i].id); + if ( str_id == 'sec_action') { + continue; + } if ( str_id.search(/action/) > -1 ) { if ( p_value == 0 ) { a_select[i].setStyle("color:red"); diff --git a/include/sql/patch/upgrade144.sql b/include/sql/patch/upgrade144.sql new file mode 100644 index 000000000..700f2e44a --- /dev/null +++ b/include/sql/patch/upgrade144.sql @@ -0,0 +1,188 @@ +begin; + + +CREATE OR REPLACE FUNCTION comptaproc.jrn_check_periode() + RETURNS trigger +AS $function$ +declare +bClosed bool; +str_status text; +ljr_tech_per jrn.jr_tech_per%TYPE; +ljr_def_id jrn.jr_def_id%TYPE; +lreturn jrn%ROWTYPE; +begin +if TG_OP='UPDATE' then + ljr_tech_per :=OLD.jr_tech_per ; + NEW.jr_tech_per := comptaproc.find_periode(to_char(NEW.jr_date,'DD.MM.YYYY')); + ljr_def_id :=OLD.jr_def_id; + lreturn :=NEW; + if NEW.jr_date = OLD.jr_date then + return NEW; + end if; + if comptaproc.is_closed(NEW.jr_tech_per,NEW.jr_def_id) = true then + raise exception 'Periode fermee'; + end if; +end if; + +if TG_OP='INSERT' then + NEW.jr_tech_per := comptaproc.find_periode(to_char(NEW.jr_date,'DD.MM.YYYY')); + ljr_tech_per :=NEW.jr_tech_per ; + ljr_def_id :=NEW.jr_def_id; + lreturn :=NEW; +end if; + +if TG_OP='DELETE' then + ljr_tech_per :=OLD.jr_tech_per; + ljr_def_id :=OLD.jr_def_id; + lreturn :=OLD; +end if; + +if comptaproc.is_closed (ljr_tech_per,ljr_def_id) = true then + raise exception 'Periode fermee'; +end if; + +return lreturn; +end; +$function$ +LANGUAGE plpgsql; + + +-- New right for action : delete +ALTER TABLE public.user_sec_action_profile drop CONSTRAINT user_sec_action_profile_ua_right_check; +ALTER TABLE public.user_sec_action_profile ADD CONSTRAINT user_sec_action_profile_ua_right_check check (ua_right in ('R','W','X','O')); + +-- extension CRM : definition des options qu'on peut ajouter +-- public.document_option_ref definition + +-- Drop table + +-- DROP TABLE public.document_option_ref; + + +CREATE TABLE public.contact_option_ref ( + cor_id bigserial NOT NULL, + cor_label varchar NOT NULL, -- Label de l'option + cor_type int4 NOT NULL DEFAULT 0, -- 0 text , 1 select ,2 nombre , 3 date + cor_value_select varchar NULL, -- Select values + CONSTRAINT contact_option_ref_pk PRIMARY KEY (cor_id) +); +COMMENT ON TABLE public.contact_option_ref IS 'Option for the contact'; + +-- Column comments + +COMMENT ON COLUMN public.contact_option_ref.cor_label IS 'Label de l''option'; +COMMENT ON COLUMN public.contact_option_ref.cor_type IS '0 text , 1 select ,2 nombre , 3 date'; +COMMENT ON COLUMN public.contact_option_ref.cor_value_select IS 'Select values'; + + + + +-- renomme le menu +update menu_ref set me_description = 'Configuration des documents dans le suivi' ,me_file='cfg_action.inc.php' , +me_description_etendue ='Vous permet d''ajouter de nouveaux type de documents pour le suivi (bordereau de livraison, devis..)',me_code='CFGACTION', +me_menu='Document Suivi' +where me_code='CFGCATDOC'; + + +-- ajoute un menu pour les options de contacts +INSERT INTO public.menu_ref (me_code,me_menu,me_file,me_url,me_description,me_parameter,me_javascript,me_type,me_description_etendue) VALUES +('CFGCONTACT','Contact','contact_option_ref.inc.php',NULL,'Configure les options pours les contacts multiples',NULL,NULL,'ME',NULL) +; + +INSERT INTO public.profile_menu (me_code,me_code_dep,p_id,p_order,p_type_display,pm_default,pm_id_dep) VALUES +('CFGCONTACT','DIVPARM',1,85,'E',0,56) +; + + + +CREATE TABLE public.tag_group ( + tg_id bigserial NOT NULL, + tg_name varchar NOT NULL +); +COMMENT ON TABLE public.tag_group IS 'Group of tags'; + +-- Column comments + +COMMENT ON COLUMN public.tag_group.tg_name IS 'Nom du groupe'; +ALTER TABLE public.tag_group ADD CONSTRAINT tag_group_pk PRIMARY KEY (tg_id); + +-- public.jnt_tag_group_tag definition + +-- Drop table + +-- DROP TABLE public.jnt_tag_group_tag; + +CREATE TABLE public.jnt_tag_group_tag ( + tag_group_id int8 NOT NULL, + tag_id int8 NOT NULL, + jt_id serial NOT NULL, + CONSTRAINT jnt_tag_group_tag_pkey PRIMARY KEY (jt_id), + CONSTRAINT jnt_tag_group_tag_un UNIQUE (tag_id, tag_group_id) +); +COMMENT ON TABLE public.jnt_tag_group_tag IS 'Many to Many table betwwen tag and tag group'; + + +-- public.jnt_tag_group_tag foreign keys + +ALTER TABLE public.jnt_tag_group_tag ADD CONSTRAINT jnt_tag_group_tag_fk FOREIGN KEY (tag_id) REFERENCES tags(t_id) ON UPDATE CASCADE ON DELETE CASCADE; +ALTER TABLE public.jnt_tag_group_tag ADD CONSTRAINT jnt_tag_group_tag_fk_1 FOREIGN KEY (tag_group_id) REFERENCES tag_group(tg_id) ON UPDATE CASCADE ON DELETE CASCADE; + + +insert into action values (1025,'Ajout d''étiquette','followup','TAGADD'); + +-- public.action_person_option definition + +-- Drop table + +-- DROP TABLE public.action_person_option; + +CREATE TABLE public.action_person_option ( + ap_id bigserial NOT NULL, + ap_value varchar NULL, -- Value of the option + contact_option_ref_id int8 NOT NULL, -- FK to contact_option + action_person_id int8 NOT NULL, -- FK to action_person + CONSTRAINT action_person_option_pk PRIMARY KEY (ap_id) +); +COMMENT ON TABLE public.action_person_option IS 'option for each contact'; + +-- Column comments + +COMMENT ON COLUMN public.action_person_option.ap_value IS 'Value of the option'; +COMMENT ON COLUMN public.action_person_option.contact_option_ref_id IS 'FK to contact_option'; +COMMENT ON COLUMN public.action_person_option.action_person_id IS 'FK to action_person'; + + +-- public.action_person_option foreign keys + +ALTER TABLE public.action_person_option ADD CONSTRAINT action_person_option_fk FOREIGN KEY (action_person_id) REFERENCES action_person(ap_id) ON UPDATE CASCADE ON DELETE CASCADE; +ALTER TABLE public.action_person_option ADD CONSTRAINT contact_option_ref_fk FOREIGN KEY (contact_option_ref_id) REFERENCES contact_option_ref(cor_id) ON UPDATE CASCADE ON DELETE CASCADE; + +-- public.document_option definition + +-- Drop table + +-- DROP TABLE public.document_option; + +CREATE TABLE public.document_option ( + do_id bigserial NOT NULL, + do_code varchar(20) NOT NULL, -- Code of the option to add + document_type_id int8 NULL, -- FK to document_type + do_enable int4 NOT NULL DEFAULT 1, -- 1 the option is activated, 0 is inativated + CONSTRAINT document_option_ref_pk PRIMARY KEY (do_id), + CONSTRAINT document_option_un UNIQUE (do_code, document_type_id) +); +COMMENT ON TABLE public.document_option IS 'Reference of option addable to document_type'; + +-- Column comments + +COMMENT ON COLUMN public.document_option.do_code IS 'Code of the option to add'; +COMMENT ON COLUMN public.document_option.document_type_id IS 'FK to document_type'; +COMMENT ON COLUMN public.document_option.do_enable IS '1 the option is activated, 0 is inativated'; + + +-- public.document_option foreign keys + +ALTER TABLE public.document_option ADD CONSTRAINT document_option_ref_fk FOREIGN KEY (document_type_id) REFERENCES document_type(dt_id) ON UPDATE CASCADE ON DELETE CASCADE; + +insert into version (val,v_description) values (145,'Improve tags , add multiple contacts with options'); +commit; diff --git a/include/sql/patch/upgrade145.sql b/include/sql/patch/upgrade145.sql new file mode 100644 index 000000000..cd5a13cfb --- /dev/null +++ b/include/sql/patch/upgrade145.sql @@ -0,0 +1,33 @@ +begin; + +ALTER TABLE public.document_option ADD do_option varchar NULL; +COMMENT ON COLUMN public.document_option.do_option IS 'Option for the detail'; + +alter table attr_def add column ad_search_followup int; +alter table attr_def alter column ad_search_followup set default 1; +update attr_def set ad_search_followup=1; +comment on column attr_def.ad_search_followup is '1 : search available from followup , 0 : search not available in followup'; + + +create table jnt_document_option_contact +( +jdoc_id bigserial primary key, +jdoc_enable int not null, +document_type_id bigint references document_type (dt_id) on delete cascade on update cascade, +contact_option_ref_id bigint references contact_option_ref(cor_id) on delete cascade on update cascade +); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_check CHECK (jdoc_enable in (0,1)); + +insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1'); +insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; +insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; +insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1 and f_id not in (select f_id from fiche_detail where ad_id=54); +update fiche_detail set ad_value='1' where ad_id=54; +insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR'); +insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile; + + + +insert into version (val,v_description) values (146,'Export CSV for Multiple card, contact option by document type'); +commit; diff --git a/include/template/action_button.php b/include/template/action_button.php index 0d7287910..04a621d3c 100644 --- a/include/template/action_button.php +++ b/include/template/action_button.php @@ -26,19 +26,39 @@ * @brief show button in the list of actions * */ +$http=new HttpInput(); ?>
    + + + \ No newline at end of file +
    +
    + \ No newline at end of file diff --git a/include/template/action_document_type_mtable_input.php b/include/template/action_document_type_mtable_input.php new file mode 100644 index 000000000..784a4f069 --- /dev/null +++ b/include/template/action_document_type_mtable_input.php @@ -0,0 +1,123 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief called from p_id already set, + * @see action_document_type_mtable::input + * @see + */ +// SQL Object Document_Type +$table=$this->get_table(); +// db connx +$cn=$table->cn; +?> + + +

    + ( + +dt_id > 0) { + $ret=$cn->get_array("select last_value,is_called from seq_doc_type_".$table->dt_id); + + $last=$ret[0]['last_value']; + /* ! + * \note With PSQL sequence , the last_value column is 1 when before AND after the first call, to make the difference between them + * I have to check whether the sequence has been already called or not */ + if ($ret[0]['is_called']=='f') + $last--; +} +echo $last; +?> + ) +

    + + +input(); +?> +
    +

    +
      +
    • +dt_id)) $i->set_check(1);else $i->set_check(0); +echo $i->input(); +echo _("Détail opération"); +$select_detail_operation=new ISelect("select_option_operation"); +$select_detail_operation->value=array(["value"=>"VEN","label"=>_("Prix vente")], + ["value"=>"ACH","label"=>_("Prix achat")]); +$select_detail_operation->set_value(Document_Option::option_operation_detail($table->dt_id)); +echo $select_detail_operation->input(); +?> +
    • +
    • +dt_id)) $i->set_check(1); else $i->set_check(0); +echo $i->input(); +echo _("Contacts multiples"); +?> +
    • +
    • +dt_id)) $i->set_check(1); else $i->set_check(0); +echo $i->input(); +echo _("Création de facture"); +?> +
    • +
    + +
    +
    +

    +
      +'; + + echo HtmlInput::hidden("cor_id[]", $aOption[$i]["cor_id"]); + $is=new ICheckBox("contact_option$i",1); + if ($aOption[$i]['jdoc_enable'] ==1 ) { + $is->set_check(1); + } else { + $is->set_check(0); + } + echo $is->input(); + echo "   "._($aOption[$i]['cor_label']); + echo ''; +} +?> +
    +
    diff --git a/include/template/action_search.php b/include/template/action_search.php index e7bb169e9..58cab5517 100644 --- a/include/template/action_search.php +++ b/include/template/action_search.php @@ -56,6 +56,10 @@
    + + + + @@ -103,10 +107,7 @@ input();?> - - - - +
    input()?>
    input();?>
    input()?>
    input();?>
    @@ -140,6 +141,18 @@ ?>

    +

    + value=array( + array("value"=>0,"label"=>_("Toutes les étiquettes")), + array("value"=>1,"label"=>_("Au moins une étiquette")) + ); + $iselect->set_value($http->request("tag_option","number",0)); + echo $iselect->input(); + ?> +

    diff --git a/include/template/card_multiple_display_option.php b/include/template/card_multiple_display_option.php new file mode 100644 index 000000000..9e37e481a --- /dev/null +++ b/include/template/card_multiple_display_option.php @@ -0,0 +1,120 @@ + + +if (!defined('ALLOWED')) + die('Appel direct ne sont pas permis'); + +/** + * @file + * @brief Show the option of a contact, + * parameters received + * - $fiche_id + * - $ag_id + * - $a_option array + * - $a_option.cor_id + * - $a_option.cor_label + * - $a_option.cor_type + * - $a_option.ap_id (-1 if option for this contact doesn't exist) + * @see Card_Multiple + */ +?> +

    + +

    +
    + + + + + + + + value=array(); + // for select , we need to take the list + if (!empty($a_option[$i]['cor_value_select'])) + { + $a_select=explode("|", $a_option[$i]['cor_value_select']); + if (is_array($a_select)) + { + $nb=count($a_select); + $array=[]; + for ($e=0; $e<$nb; $e++) + { + $a["label"]=$a_select[$e]; + $a["value"]=$a_select[$e]; + $array[$e]=$a; + } + $input->value=$array; + $input->selected = $a_option[$i]['ap_value'] ; + } + } + break; + case 4: + $input=new InputSwitch("ap_value[]"); + if ( $a_option[$i]['ap_value'] =="") { + $a_option[$i]['ap_value']=0; + } + break; + + } + $input->set_value ($a_option[$i]['ap_value']); + echo ''; + echo ''; + echo $a_option[$i]['cor_label']; + echo HtmlInput::hidden("f_id",$fiche_id); + echo HtmlInput::hidden("ap_id[]",$a_option[$i]['ap_id']); + echo HtmlInput::hidden("cor_id[]",$a_option[$i]['cor_id']); + echo ''; + echo ''; + echo $input->input(); + echo ''; + echo ''; + + endfor; + + ?> +
      +
    • + +
    • +
    • + +
    • + +
    + + +
    \ No newline at end of file diff --git a/include/template/card_multiple_result.php b/include/template/card_multiple_result.php new file mode 100644 index 000000000..8c16fc32e --- /dev/null +++ b/include/template/card_multiple_result.php @@ -0,0 +1,51 @@ + +
    + +
    + 10) : + echo _("recherche rapide"); + echo HtmlInput::filter_table("card_list", '1,2,3', 0); + endif; + ?> + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + +
    + + + +
    +
    +
    diff --git a/include/template/card_result.php b/include/template/card_result.php index 6c38fad65..7c86f3938 100644 --- a/include/template/card_result.php +++ b/include/template/card_result.php @@ -5,6 +5,34 @@
    + '; + if ( $page_card != 0 ) { + // show previous arrow to left + echo '
  • '; + echo '
    '; + $url=$sql_array; + $url["page_card"]=$page_card-1; + echo HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query','inactive_card'), $url); + echo HtmlInput::submit("previous","<"); + echo '
    '; + echo '
  • '; + } + if ( $record_start < $total_card && $nb_found >= MAX_SEARCH_CARD) { + echo '
  • '; + echo '
    '; + $url=$sql_array; + $url["page_card"]=$page_card+1; + echo HtmlInput::array_to_hidden(array('accvis','inp','jrn','label','typecard','price','tvaid','amount_from_type','page_card','query','inactive_card'), $url); + + echo HtmlInput::submit("next",">"); + echo '
    '; + echo '
  • '; + } + echo ''; + ?> + @@ -40,7 +68,7 @@ if ( $accvis == 1 ) :
    - +
    diff --git a/include/template/detail-action.php b/include/template/detail-action.php index 0ecc3bd3f..fc5c20b28 100644 --- a/include/template/detail-action.php +++ b/include/template/detail-action.php @@ -7,7 +7,7 @@ $uniq=uniqid("tab",TRUE); - + @@ -57,6 +57,7 @@ $uniq=uniqid("tab",TRUE); echo _('Pas de catégorie de contact'); endif; endif; + ?> @@ -65,7 +66,7 @@ $uniq=uniqid("tab",TRUE); input(); ?> - ag_id > 0 ): ?> + ag_id > 0 && Document_Option::is_enable_contact_multiple($this->dt_id)): ?> @@ -148,7 +155,7 @@ $uniq=uniqid("tab",TRUE); ag_id > 0 ): ?> request("ag_id","number"); +if (isNumber($ag_id) == 0 ) die ('ERROR : parameters invalid'); for ($i=0;$i<$max;$i++): $row=Database::fetch_array($ret, $i); ?> diff --git a/scenario/HtmlInput.test.php b/scenario/HtmlInput.test.php index 027f4eb73..363a8fdc3 100644 --- a/scenario/HtmlInput.test.php +++ b/scenario/HtmlInput.test.php @@ -61,25 +61,25 @@ $http=new HttpInput();
             
         $input_switch=new InputSwitch('input_switch_value',get("input_switch_value","string","0")?>);
    -    $input_switch->input();
    +    echo $input_switch->input();
         
    input_switch get("input_switch_value","string","0")); - $input_switch->input(); + echo $input_switch->input(); ?>

    ReadOnly

         $input_switch=new InputSwitch('input_switch_readonly',0);
         $input_switch->readOnly=TRUE;
    -    $input_switch->input();
    +    echo  $input_switch->input();
         
    input_switch readOnly=TRUE; - $input_switch->input(); + echo $input_switch->input(); ?>

    Submit

    diff --git a/sql/upgrade.sql b/sql/upgrade.sql
    index fb36c0d2a..e69de29bb 100644
    --- a/sql/upgrade.sql
    +++ b/sql/upgrade.sql
    @@ -1,44 +0,0 @@
    -CREATE OR REPLACE FUNCTION comptaproc.jrn_check_periode()
    - RETURNS trigger
    - LANGUAGE plpgsql
    -AS $function$
    -declare
    -bClosed bool;
    -str_status text;
    -ljr_tech_per jrn.jr_tech_per%TYPE;
    -ljr_def_id jrn.jr_def_id%TYPE;
    -lreturn jrn%ROWTYPE;
    -begin
    -if TG_OP='UPDATE' then
    -    ljr_tech_per :=OLD.jr_tech_per ;
    -    NEW.jr_tech_per := comptaproc.find_periode(to_char(NEW.jr_date,'DD.MM.YYYY'));
    -    ljr_def_id :=OLD.jr_def_id;
    -    lreturn :=NEW;
    -    if NEW.jr_date = OLD.jr_date then
    -        return NEW;
    -    end if;
    -    if comptaproc.is_closed(NEW.jr_tech_per,NEW.jr_def_id) = true then
    -              raise exception 'Periode fermee';
    -    end if;
    -end if;
    -
    -if TG_OP='INSERT' then
    -    NEW.jr_tech_per := comptaproc.find_periode(to_char(NEW.jr_date,'DD.MM.YYYY'));
    -    ljr_tech_per :=NEW.jr_tech_per ;
    -    ljr_def_id :=NEW.jr_def_id;
    -    lreturn :=NEW;
    -end if;
    -
    -if TG_OP='DELETE' then
    -    ljr_tech_per :=OLD.jr_tech_per;
    -    ljr_def_id :=OLD.jr_def_id;
    -    lreturn :=OLD;
    -end if;
    -
    -if comptaproc.is_closed (ljr_tech_per,ljr_def_id) = true then
    -       raise exception 'Periode fermee';
    -end if;
    -
    -return lreturn;
    -end;$function$
    -;
    \ No newline at end of file
    diff --git a/unit-test/include/class/acc_ledger.Test.php b/unit-test/include/class/acc_ledger.Test.php
    index 93e8af5bc..8edb68d36 100644
    --- a/unit-test/include/class/acc_ledger.Test.php
    +++ b/unit-test/include/class/acc_ledger.Test.php
    @@ -443,31 +443,56 @@ class Acc_LedgerTest extends TestCase
          */
         public function testVerify_Ledger()
         {
    -        global $g_connection;
    +       global $g_connection;
            $ledger=new Acc_Ledger($g_connection,4);
            $array=[
    -           "p_jrn"=>"15",
    -           "p_jrn_deb_max_line"=>5,
    -           "p_jrn_name"=>"New ledger",
    -           "p_jrn_type"=>"ODS"
    -       ];
    -       // Must success
    -       try {
    -           $ledger->verify_ledger($array);
    -           $this->assertTrue(TRUE);
    -       } catch (Exception $ex) {
    -           var_dump($ex->getMessage());
    -           var_dump($ex->getTraceAsString());
    -       }
    +            "p_jrn"=>"15",
    +            "p_jrn_deb_max_line"=>5,
    +            "p_jrn_name"=>"New ledger",
    +            "p_jrn_type"=>"ODS"
    +            ];
    +       //-----------------------------------------------
    +       // Must succeed
    +       //-----------------------------------------------
    +      $ledger->verify_ledger($array);
    +      
            
    +       // succeeds if negative amount  1
    +       $array["negative_amount"]=1;
    +       $ledger->verify_ledger($array);
    +       
    +       //-----------------------------------------------
            // Must fail
    -       $a_ledger["p_jrn"]="a";
    +       //-----------------------------------------------
            try {
    -           $ledger->verify_ledger($array);
    -           $this->assertTrue(FALSE);
    -       } catch (Exception $ex) {
    -           $this->assertTrue(TRUE);
    -       }
    +            $array["p_jrn"]="a";
    +            $ledger->verify_ledger($array);
    +            $this->assertTrue(FALSE,"p_jrn is invalide");
    +        }catch (\Exception $e) {
    +            $this->assertTrue(TRUE);
    +        }
    +       // reset properly ,
    +       $array["p_jrn"]="15";
    +       $ledger->verify_ledger($array);
    +
    +       
    +       // fails if negative amount neither 1 nor 0
    +       try {
    +            $array["negative_amount"]=2;
    +            $ledger->verify_ledger($array);
    +            $this->assertTrue(FALSE,"negative_amount must be 1 or 0");
    +        }catch (\Exception $e) {
    +            $this->assertTrue(TRUE);
    +        }
    +       
    +        // negative amount not set , so fails
    +       try {
    +            $array["negative_warning"]="Yes";
    +            $ledger->verify_ledger($array);
    +            $this->assertTrue(FALSE,"negative_warning must be a string");
    +        }catch (\Exception $e) {
    +            $this->assertTrue(TRUE);
    +        }
         }
     
         /**
    
    @@ -79,7 +80,13 @@ $uniq=uniqid("tab",TRUE); ?> - + Dossier::id(), + "act"=>"CSV:FollowUpContactOption", + "ag_id"=>$ag_id]); + echo HtmlInput::anchor(_("Export CSV"), $csv); + ?>
    - Dossier / tags + Dossier / Etiquette @@ -280,132 +287,52 @@ echo ''; - - - - ag_id > 0 && Document_Option::is_enable_operation_detail($this->dt_id)) Follow_Up_Detail::display($this,$p_view); - ?> -
    - - - -
    - - - - - - - - - + + +
    - - - - - - - - - - - - - - -
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    -
    Total HTVA -
    Total TVA -
    Total TVAC -
    +
    + + + +
    + - -
    - - "> -
    - - - + - -
    -ag_id != 0 && ! $readonly) : ?> -
    -

    - Dossier::id(),'ag_id'=>$this->ag_id,'create_invoice'=>1,'ac'=>$menu->get('code_invoice'))); - echo HtmlInput::button_anchor(_("Transformer en facture"),"do.php?".$query,"create_invoice", ' target="_blank" ',"button"); - ?> -

    -
    - - -
    - - -
    - - - -
    - - - + + +
    ag_timestamp ?> par ag_ow - + + dt_id)): + ?> +

    + Dossier::id(), 'ag_id'=>$p_follow_up->ag_id, 'create_invoice'=>1, 'ac'=>$menu->get('code_invoice'))); + echo HtmlInput::button_anchor(_("Transformer en facture"), "do.php?".$query, "create_invoice", + ' target="_blank" ', "button"); + ?> +

    + \ No newline at end of file diff --git a/include/template/param_jrn.php b/include/template/param_jrn.php index 6c73529d9..1d0ce32bb 100644 --- a/include/template/param_jrn.php +++ b/include/template/param_jrn.php @@ -98,7 +98,7 @@ if ( $type == 'ACH' || $type == 'VEN'||$new): diff --git a/include/template/predf_ledger_detail.php b/include/template/predf_ledger_detail.php index d46eff899..2174ea1d1 100644 --- a/include/template/predf_ledger_detail.php +++ b/include/template/predf_ledger_detail.php @@ -8,7 +8,7 @@ -
    +

    javascript="toggle_row_warning_enable('negative_amount','row_warning')"; - $negative->input(); + echo $negative->input(); ?>
    diff --git a/include/template/security_list_action.php b/include/template/security_list_action.php index 6f1840895..c9ff9e60f 100644 --- a/include/template/security_list_action.php +++ b/include/template/security_list_action.php @@ -5,7 +5,8 @@
    cn->count($ret); echo HtmlInput::filter_table("tag_tb", '0,1', '1'); $nDossier=Dossier::id(); @@ -14,13 +15,19 @@ $nDossier=Dossier::id();
    + + + request('ac'); + for ($i=0;$i<$max;$i++): - $row=Database::fetch_array($ret, $i); -?> + $row=Database::fetch_array($ret, $i); + ?> + class="">
    + +
    cn->count($ret); if ( $max == 0 ) { echo h2(_("Aucune étiquette disponible"),' class="notice"'); return; } +require_once NOALYSS_INCLUDE."/lib/output_html_tab.class.php"; +$tab_tag=new Html_Tab($p_prefix."tab_tag",_("Etiquettes")); +ob_start(); ?> @@ -30,13 +33,13 @@ $gDossier=Dossier::id();
    @@ -51,7 +54,55 @@ $gDossier=Dossier::id(); endfor; ?>
    + +set_content(ob_get_contents()); + ob_end_clean(); +// Tab for the groups +// +$tab_tag_group=new Html_Tab($p_prefix."tab_tag_group",_("Groupe")); +$aGroup=$this->cn->get_array("select tg_id, tg_name from tag_group order by 2 desc"); +$nb_agroup=count($aGroup); +?> + + + + + + + + + + +
    + +
    +set_content(ob_get_contents()); +ob_end_clean(); + +// Both tab +$output=new Output_Html_Tab(); +$output->add($tab_tag); +$output->add($tab_tag_group); +ob_start(); +$output->output(); + +?> + + + - \ No newline at end of file + build_js($p_prefix."tab_tag");?> + + \ No newline at end of file diff --git a/include/template/tag_select.php b/include/template/tag_select.php index ea6d4bb12..475e9594a 100644 --- a/include/template/tag_select.php +++ b/include/template/tag_select.php @@ -5,7 +5,9 @@ * @file * @brief list of tags */ -?> +cn->count($ret); if ( $max == 0 ) { @@ -25,14 +27,15 @@ if ( $max == 0 ) {