Merge extension-crm

This commit is contained in:
Dany De Bontridder 2020-10-12 10:43:18 +02:00
commit e78e40a994
98 changed files with 3895 additions and 1256 deletions

View file

@ -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;
</data>
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 <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<dtid>$html</dtid>
<message>$message</message>
</data>
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 <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<dtid>$html</dtid>
<message>$message</message>
</data>
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 <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<dtid>$html</dtid>
<message>$message</message>
</data>
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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

70
html/js/taggroup.js Normal file
View file

@ -0,0 +1,70 @@
/*
* Copyright (C) 2020 Dany De Bontridder <dany@alchimerys.be>
*
* 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 <danydb@noalyss.eu>
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);
}
});
};
};

View file

@ -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 {
}
/* Cell with tag */
span.tagcell {
border:1px solid darkgray;
padding:2px;margin:1px;
display: inline-block;
color:black;
}

View file

@ -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;
}
}
/* Cell with tag */
span.tagcell {
border-radius:3px;
border:1px solid darkblue;
padding:3px;margin:1px;
display: inline-block;
}

View file

@ -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 {
}
/* Cell with tag */
span.tagcell {
border:1px solid blue;
padding:1px;margin:1px;
display: inline-block;
color:black;
}

View file

@ -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 '<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php" method="post" >';
echo $supl_hidden;
echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo dossier::hidden();
echo $act->Display('UPD', false, $base, $retour);
echo '<input type="hidden" name="sa" value="update">';
echo '<input type="hidden" id="delete" name="delete" value="0">';
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 '</form>';
echo '<form enctype="multipart/form-data" id="action_common_frm" class="print" action="do.php" method="post" >';
echo $supl_hidden;
echo HtmlInput::hidden('ac', $http->request('ac'));
echo dossier::hidden();
echo $act->Display('UPD', false, $base, $retour);
echo '<input type="hidden" name="sa" value="update">';
echo '<input type="hidden" id="delete" name="delete" value="0">';
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 '</form>';
}
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 '<p><a class="mtitle" href="' . $url . '">' . hb(_('Evènement Sauvée').' : ' . $act->ag_ref) . '</a></p>';
@ -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 '<div class="content">';
// Add hidden tag
echo '<form method="post" action="do.php" name="form_add" id="form_add" enctype="multipart/form-data" >';

View file

@ -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 '<div class="content">';
require_once NOALYSS_INCLUDE.'/action.common.inc.php';
echo "</div>";

View file

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

View file

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

View file

@ -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 <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl>unused</ctl>
<ctl>$ctl</ctl>
<code>$html</code>
</data>
EOF;

View file

@ -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 id="search_card1_frm" method="GET" onsubmit="action_add_concerned_card(this);return false;">';
//--------------------------------------------------------------------------------------------------------------------
// Form search
//--------------------------------------------------------------------------------------------------------------------
$r.='<form id="search_card1_frm" method="GET" onsubmit="action_concerned_search_card(this);return false;">';
$q=new IText('query');
$q->value=(isset($query))?$query:'';
$r.='<span style="margin-left:50px">';
$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.='</span>';
$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.='</form>';
$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.='<form id="search_card2_frm" method="POST" onsubmit="action_concerned_save_card(this);return false;" '
. ' style="height:45rem">';
$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; $i<count($a); $i++)
{
$ic=new ICheckBox("selected_card[]");
$ic->value=$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 '<ul class="aligned-block">';
echo '<li>';
echo HtmlInput::submit("add_concerned_card",_("Ajouter"));
echo '</li>';
echo '<li>';
echo HtmlInput::button_close("search_card");
echo '</li>';
echo '</ul>';
echo '</form>';
$response=ob_get_contents();
ob_end_clean();

View file

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

View file

@ -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.='</span>';
$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.="</form>";
$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.='<div> '.h2info(_('Recherche de fiche')).'</div>';
$html="";
$html.=HtmlInput::title_box(_('Recherche de fiche'), 'search_card');
$html.='<h3 class="notice">';
$html.=_("Aucune catégorie de fiche ne correspond à".
" votre demande, le journal pourrait n'avoir accès à aucune fiche");
$html.='</h3>';
$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;$i<count($a);$i++)
{
$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']);
$sql=$sql.' order by vw_name ';
$total_card=$cn->get_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);

View file

@ -0,0 +1,103 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @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;
}
}
?>

View file

@ -0,0 +1,82 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
// 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();
}

View file

@ -0,0 +1,67 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE."/class/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();
}

View file

@ -0,0 +1,44 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @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);

View file

@ -55,7 +55,7 @@ $a_tab[$call_tab]='tabs_selected';
<li class="<?php echo $a_tab['profile_gen_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_gen_div')"><?php echo _('Nom')?></a></li>
<li class="<?php echo $a_tab['profile_menu_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_menu_div')"><?php echo _('Détail Menus')?></a></li>
<li class="<?php echo $a_tab['profile_print_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_print_div')"><?php echo _('Détail Impressions')?></a></li>
<li class="<?php echo $a_tab['profile_gestion_div']?>"><a href="javascript:void(0)" style="" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_gestion_div')"><?php echo _('Action Gestion')?> </a></li>
<li class="<?php echo $a_tab['profile_gestion_div']?>"><a href="javascript:void(0)" style="" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_gestion_div')"><?php echo _('Groupe Gestion')?> </a></li>
<li class="<?php echo $a_tab['profile_repo_div']?>"><a href="javascript:void(0)" onclick="unselect_other_tab(this.parentNode.parentNode);this.parentNode.className='tabs_selected';profile_show('profile_repo_div')"><?php echo _('Dépôts')?></a>&nbsp;
</ul>
@ -111,7 +111,6 @@ if ($profile->p_id > 0)
echo '</div>';
echo '<div class="myfieldset" style="display:none" id="profile_menu_div">';
//Menu / Module /plugin in this profile
echo "<h1 class=\"legend\">"._("Menu")."</h2>";
$profile_menu = new Profile_Menu($cn);
$profile_menu->p_id=$p_id;
$profile_menu->display_profile_menu_detail();
@ -122,7 +121,7 @@ if ($profile->p_id > 0)
echo $add_impression;
echo '</div>';
echo '<div class="myfieldset" style="display:none" id="profile_gestion_div">';
echo "<h1 class=\"legend\">".('Groupe gestion')."</h1>";
$profile_menu->available_profile();
echo '</div>';
echo '<div class="myfieldset" style="display:none" id="profile_repo_div">';

View file

@ -0,0 +1,55 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief save option of card into action_person_option
*/
try {
$ap_value=$http->post("ap_value","array",[]);
$ap_id=$http->post("ap_id","array",[]);
$cor_id=$http->post("cor_id","array",[]);
$fiche_id=$http->post("f_id");
$ag_id=$http->post("ag_id");
$action_person_id=$http->post("action_person_id");
} catch (Exception $ex) {
record_log("ASCO01".$ex->getMessage().$ex->getTraceAsString());
return;
}
/// If cannot write we stop it
if ( ! $g_user->can_write_action($ag_id)) {
record_log("ASCO02 Security ");
}
$nb=count($ap_value);
// nothing to save
if ($nb == 0) return;
for ($i=0;$i<$nb; $i++) {
$cn->exec_sql("UPDATE public.action_person_option SET ap_value=$1 WHERE ap_id=$2",
[$ap_value[$i],$ap_id[$i]]);
}

View file

@ -1,4 +1,5 @@
<?php
/*
* This file is part of NOALYSS.
*
@ -17,23 +18,42 @@
* 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
*@brief add tag , used for follow up
*@see Tag
* @file
* @brief add tag , used for follow up
* @see Tag
*/
require_once NOALYSS_INCLUDE.'/class/tag.class.php';
//Single Tag
ob_start();
if ($_GET['clear']==1) {
if ($_GET['clear']==1)
{
/* Add a clear button */
echo Tag::add_clear_button($_GET['pref']);
}
$tag=new Tag($cn,$_GET['id']);
$tag->update_search_cell($_GET['pref']);
if ($http->request("obj")=='t')
{
$response= ob_get_clean();
$tag=new Tag($cn, $http->get("id", "number"));
$tag->update_search_cell($http->get("pref"));
}
elseif ($http->request("obj")=="g")
{
// Add all the tag from the group
$aTag=$cn->get_array("select t_id,t_tag from jnt_tag_group_tag jtgt join tags on (tag_id=t_id) where tag_group_id=$1 order by 2 ",[$http->get("id", "number")]);
$nb_atag=count($aTag);
$pref=$http->get("pref");
if ( $nb_atag > 0) {
for ($i=0;$i<$nb_atag;$i++){
$tag=new Tag($cn,$aTag[$i]['t_id']);
$tag->update_search_cell($pref);
}
}
}
$response=ob_get_clean();
$html=escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
@ -44,7 +64,5 @@ echo <<<EOF
</data>
EOF;
exit();
?>

View file

@ -25,11 +25,10 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
*/
require_once NOALYSS_INCLUDE.'/class/tag.class.php';
ob_start();
$tag=new Tag($cn);
$tag->select_search($_GET['pref']);
$response= ob_get_clean();
$response= $tag->select_search($_GET['pref']);
$html=escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF

View file

@ -109,6 +109,8 @@ if (isset($_GET['viewsearch']))
list($array['date_start'], $array['date_end'])=$g_user->get_limit_current_exercice();
}
$array['hide_operation']=$hide_operation;
$array['single_operation']=$http->get("single_operation");
list($sql, $where)=$ledger->build_search_sql($array);
// Count nb of line
$max_line=$cn->count_sql($sql);
@ -128,6 +130,7 @@ if (isset($_GET['viewsearch']))
}
}
echo '<form method="get" onsubmit="set_reconcile(this);return false">';
echo HtmlInput::hidden("single_operation", $array['single_operation']);
echo HtmlInput::hidden("tiers", $tiers);
echo HtmlInput::submit("upd_rec", _("Mettre à jour"));
echo HtmlInput::get_to_hidden(array('ctlc', 'amount_id', 'ledger'));

View file

@ -24,11 +24,26 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
*@see Follow_Up
*@see Tag
*/
$http=new HttpInput();
$fl=new Follow_Up($cn);
$fl->ag_id=$_REQUEST['ag_id'];
if ( $g_user->can_write_action($fl->ag_id) == TRUE )
$fl->tag_add($_REQUEST['t_id']);
$fl->ag_id=$http->request("ag_id","number");
if ( $g_user->can_write_action($fl->ag_id) != TRUE ) return;
if ( $http->request("isgroup") == 't') {
$fl->tag_add($http->request('t_id',"number"));
} else {
// Add all the tag from the group
$aTag=$cn->get_array("select t_id,t_tag from jnt_tag_group_tag jtgt join tags on (tag_id=t_id) where tag_group_id=$1 order by 2 ",[$http->request("t_id","number")]);
$nb_atag=count($aTag);
if ( $nb_atag > 0) {
for ($i=0;$i<$nb_atag;$i++){
$fl->tag_add($aTag[$i]['t_id']);
}
}
}
ob_start();

View file

@ -11,9 +11,11 @@ require_once NOALYSS_INCLUDE.'/lib/single_record.class.php';
require_once NOALYSS_INCLUDE.'/class/tag.class.php';
ob_start();
$tag=new Tag($cn);
$tag->data->t_id=$_GET['tag'];
$http=new HttpInput();
$tag->data->t_id=$http->get("tag","number");
if ($tag->data->t_id == -1 && $g_user->check_action(TAGADD) == 0 ) return;
$tag->data->load();
echo HtmlInput::title_box(_("Détail du dossier ou étiquette"), "tag_div");
echo HtmlInput::title_box(_("Détail du dossier ou étiquette"), "tag_div","close","","y");
?>
<?php

View file

@ -0,0 +1,64 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE."/class/tag_group_mtable.class.php";
/**
* @file
* @brief Manage the group of tags
*/
try {
$table=$http->request('table');
$action=$http->request('action');
$p_id=$http->request('p_id', "number");
$ctl_id=$http->request('ctl');
} catch(Exception $e) {
echo $e->getMessage();
return;
}
$obj=new Tag_Group_SQL($cn,$p_id);
$obj_manage=new Tag_Group_MTable($obj);
$obj_manage->set_callback("ajax_misc.php");
$obj_manage->add_json_param("op", "tag_group");
$obj_manage->set_object_name($ctl_id);
if ($action=="input")
{
header('Content-type: text/xml; charset=UTF-8');
echo $obj_manage->ajax_input()->saveXML();
return;
}
elseif ($action=="save")
{
$xml=$obj_manage->ajax_save();
header('Content-type: text/xml; charset=UTF-8');
echo $xml->saveXML();
}
elseif ($action=="delete")
{
$xml=$obj_manage->ajax_delete();
header('Content-type: text/xml; charset=UTF-8');
echo $xml->saveXML();
}

View file

@ -31,7 +31,7 @@ $tag->select();
//------------------- Propose to add a tag
$js=sprintf("onclick=\"show_tag('%s','%s','%s','j')\"",Dossier::id(),'','-1');
echo HtmlInput::button("tag_add", _("Ajout d'un tag"), $js);
if ( $g_user->check_action(TAGADD) == 1) { echo HtmlInput::button("tag_add", _("Ajout d'un tag"), $js);}
echo HtmlInput::button_close("tag_div");
$response= ob_get_clean();

View file

@ -12,7 +12,7 @@ $op=$http->request("op");
global $g_user;
$nDossier=Dossier::id();
///check security
if ( $g_user->check_module('CFGTAG')==0)
if ( $g_user->check_module('CFGTAG')==0 && $g_user->check_action(TAGADD) == 0)
{
die(_("non permis"));
}

View file

@ -0,0 +1,77 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE."/class/tag_group_mtable.class.php";
/**
* @file
* @brief
*/
global $g_user;
$g_user->can_request('CFGTAG');
/*
* Received parameter
* gDossier
* act : action to perform
* tag_group : tag_group.tg_id
* tag=tags.t_id
*
*/
try
{
$act=$http->request("act");
}
catch (Exception $e)
{
record_log(__FILE__.$e->getMessage()." ".$e->getTraceAsString());
echo $e->getMessage()." ".$e->getTraceAsString();
}
$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");
if ($act=="add")
{
$tag_group_id=$http->request("tag_group");
$tag=$http->request("tag");
$obj_manage->set_pk($tag_group_id);
// add tag to group tag
// protect against duplicate
if ($cn->get_value("select count (*) from jnt_tag_group_tag where tag_id = $1 and tag_group_id = $2",
[$tag, $tag_group_id])==0)
{
$cn->exec_sql("insert into jnt_tag_group_tag(tag_id,tag_group_id) values ($1,$2)", [$tag, $tag_group_id]);
}
}
elseif ($act=="remove")
{
$tag=$http->request("jt_tag");
$tag_group_id=$cn->get_value("select tag_group_id from jnt_tag_group_tag where jt_id = $1",[$tag]);
$obj_manage->set_pk($tag_group_id);
// remove tag from tag_group
$cn->exec_sql("delete from jnt_tag_group_tag where jt_id=$1", [$tag]);
}
$obj_manage->input_tag();

View file

@ -20,146 +20,18 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
* \brief Manage the attributs
* \brief Manage the attributs ,CFGATCARD
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/fiche_attr.class.php';
global $http;
$fa=new Fiche_Attr($cn);
/////////////////////////////////////////////////////////////////////////////
// If data are post we save them first
/////////////////////////////////////////////////////////////////////////////
if ( isset($_POST['save']))
{
try
{
$ad_id=$http->post('ad_id');
$ad_text=$http->post('desc');
$ad_type=$http->post('type');
$ad_size=$http->post('size');
$ad_extra=$http->post('extra');
$cn->start();
for ($e=0;$e<count($ad_id);$e++)
{
$fa->set_parameter('id',$ad_id[$e]);
$fa->set_parameter('desc',$ad_text[$e]);
$fa->set_parameter('type',$ad_type[$e]);
$fa->set_parameter('size',$ad_size[$e]);
$fa->set_parameter('extra',$ad_extra[$e]);
if ( trim($ad_text[$e])!='' && trim($ad_type[$e])!='')
$fa->save();
}
$cn->commit();
}
catch (Exception $e)
{
record_log($e);
alert($e->getMessage());
$cn->rollback();
}
}
/* show list of existing */
$gDossier=dossier::id();
$array=$fa->seek();
$select_type=new ISelect('type[]');
$select_type->table=0;
$desc=new IText('desc[]');
$desc->size=50;
$size=new INum('size[]');
$size->size=5;
$extra=new IText('extra[]');
$select_type->value=array(
array('value'=>'text','label'=>_('Texte')),
array('value'=>'numeric','label'=>_('Nombre')),
array('value'=>'date','label'=>_('Date')),
array('value'=>'zone','label'=>_('Zone de texte')),
array('value'=>'poste','label'=>_('Poste Comptable')),
array('value'=>'card','label'=>_('Fiche')),
array('value'=>'select','label'=>_('Selection'))
);
require_once NOALYSS_INCLUDE.'/class/card_attribut_mtable.class.php';
$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->create_js_script();
echo '<div class="content">';
echo '<form method="post">';
echo HtmlInput::hidden('sa','fat');
echo HtmlInput::hidden('p_action','divers');
echo '<table id="tb_rmfa">';
echo '<tr>';
echo th(_("id"));
echo th(_("Description"));
echo th(_("Type"));
echo th(_("Taille"));
echo th(_("Paramètre"));
echo '</tr>';
for ($e=0;$e<count($array);$e++)
{
$row=$array[$e];
$r='';
$r.=td(HtmlInput::hidden('ad_id[]',$row->get_parameter('id')).$row->get_parameter('id'));
$select_type->selected=$row->get_parameter('type');
$desc->value=$row->get_parameter('desc');
$size->value=$row->get_parameter('size');
$extra->value=$row->get_parameter('extra');
$remove=new IButton('rmfa'.$e);
$remove->label=_('Effacer');
if ( $row->get_parameter('id')>= 9000)
{
$select_type->readOnly=false;
$desc->readOnly=false;
$size->readOnly=false;
$extra->readOnly=false;
$desc->style=' class="input_text" ';
$r.=td($desc->input());
$r.=td($select_type->input());
$r.=td($size->input());
$r.=td($extra->input());
$remove->javascript=sprintf('confirm_box(\'tb_rmfa\',\'Vous confirmez ?\',function() { removeCardAttribut(%d,%d,\'tb_rmfa\',$(\'rmfa%d\') );})',
$row->get_parameter('id'),$gDossier,$e);
$msg='<span class="notice">'._("Attention : effacera les données qui y sont liées").' </span>';
$r.=td($remove->input().$msg);
}
else
{
$select_type->readOnly=true;
$desc->readOnly=true;
$size->readOnly=true;
$extra->readOnly=true;
$r.=td($desc->input().HtmlInput::hidden('type[]',''));
$r.=td($select_type->input());
$r.=td($size->input());
$r.=td($extra->input());
$r.=td("");
}
echo tr($r);
}
$desc->readOnly=false;
$select_type->readOnly=false;
$size->readOnly=false;
$extra->readOnly=false;
$desc->value='';
$select_type->selected=-1;
$r=td(_("Nouvel attribut").HtmlInput::hidden('ad_id[]','0'),'class="highlight"');
$r.=td($desc->input());
$r.=td($select_type->input());
$r.=td($size->input());
$r.=td($extra->input());
echo tr($r);
echo '</table>';
echo HtmlInput::submit('save',_('Sauver'));
echo '</form>';
echo $mtable->display_table("order by ad_text");
echo '</div>';

View file

@ -1,90 +0,0 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
* \brief this file is included to perform modification on category of document
* table document_type
*/
// show list of document
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
global $http;
if (isset($_POST['add']))
{
$catDoc=new Document_Type($cn);
try
{
$cat=$http->post('cat');
$prefix=$http->post('prefix');
$catDoc->insert($cat, $prefix);
}
catch (Exception $exc)
{
echo $exc->getMessage();
error_log($exc->getTraceAsString());
}
}
if (isset($_POST['save']))
{
try
{
$dt_id=$http->post("dt_id", "number");
$name=
$prefix=
$catDoc=new Document_Type($cn, $dt_id);
$catDoc->get();
$catDoc->dt_value=trim($http->post("dt_name"));;
$catDoc->dt_prefix=trim($http->post("dt_prefix"));
if ($catDoc->dt_value=="")
{
alert(_("Le nom ne peut pas être vide"));
}
else
{
$catDoc->update();
}
if ($_POST['seq']!=0&&isNumber($_POST['seq'])==1)
{
$catDoc->set_number($_POST['seq']);
}
}
catch (Exception $exc)
{
alert ($exc->getMessage());
error_log($exc->getTraceAsString());
}
}
$aList=Document_Type::get_list($cn);
$addCat=new IText('cat');
$addPrefix=new IText('prefix');
$str_addCat=$addCat->input();
$str_addPrefix=$addPrefix->input();
$str_submit=HtmlInput::submit('add', _('Ajout'));
echo '<div class="content">';
require_once NOALYSS_TEMPLATE.'/list_category_document.php';
echo '</div>';
?>

View file

@ -0,0 +1,44 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
* \brief this file is included to perform modification on category of document (= action)
* table document_type
*/
// show list of document
if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE."/class/action_document_type_mtable.class.php";
echo '<div class="content">';
$doc_type=new Document_type_SQL($cn);
$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->create_js_script();
$action_document_type->display_table("order by dt_value");
?>
</div>

View file

@ -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);
}
}
?>
<div style="margin-left:10%;width:80%">
<p class="notice">
<?php echo _("Vous pouvez utiliser ceci comme des étiquettes pour marquer des documents ou
<div style="margin-left:5%;width:90%">
<p class="info">
<?php echo _("Vous pouvez utiliser ceci comme des étiquettes pour marquer des documents ou
comme des dossiers pour rassembler des documents. Un document peut appartenir
à plusieurs dossiers ou avoir plusieurs étiquettes.");?>
</p>
<?php
$tag->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);
?>
à plusieurs dossiers ou avoir plusieurs étiquettes."); ?>
</p>
<?php
$tag->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);
?>
</div>
<?php
$tabs->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();
?>
<script>
$('divtg').show();
$('tabtg').className = 'tabs_selected';
$('divgrp_tg').hide();
$('tabgrp_tg').className = 'tabs';
var o_tagGroup=new TagGroup();
</script>

View file

@ -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"));
}
}

View file

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

View file

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

View file

@ -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('<form id="%s" method="POST" ACTION="%s">',$p_id,NOALYSS_URL."/do.php?".Dossier::get());
$r.=Dossier::hidden();
// select the menu where the operation will be duplicated
$r=sprintf('<form id="%s" method="POST" ACTION="%s">',$p_id,NOALYSS_URL."/do.php?".http_build_query([
"ac"=>$a_code[0]['code'],"gDossier"=>Dossier::id()
]));

View file

@ -0,0 +1,244 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
/* @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]);
}
}
}
}

View file

@ -0,0 +1,199 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @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é"));
}
}
}

View file

@ -0,0 +1,164 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @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";
}
}

View file

@ -0,0 +1,50 @@
<?php
/*
* Copyright (C) 2020 Dany De Bontridder <dany@alchimerys.be>
*
* 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 <danydb@noalyss.eu>
/**
* @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]
]);
}
}

View file

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

View file

@ -0,0 +1,102 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @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;
}
}

View file

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

View file

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

View file

@ -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%'))";
}

View file

@ -1,286 +1,165 @@
<?php
//This file is part of NOALYSS and is under GPL
//see licence.txt
/**
*@brief Manage the table attr_def
* @brief Manage the table attr_def
*
*
*/
require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE."/database/attr_def_sql.class.php";
class Fiche_Attr
class Fiche_Attr extends Attr_def_SQL
{
/* example private $variable=array("easy_name"=>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();

View file

@ -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.='<th>'.$table->get_header(0).'</th>';
$r.='<th>'.$table->get_header(1).'</th>';
$r.='<th>'.$table->get_header(2).'</th>';
$r.='<th>'.$table->get_header(3).'</th>';
$r.='<th style="width:5.57%">'.$table->get_header(3).'</th>';
$r.='<th>'.$table->get_header(4).'</th>';
$r.='<th>'.$table->get_header(5).'</th>';
$r.='<th>'.$table->get_header(6).'</th>';
@ -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<count($p_array['searchtag']); $i++)
{
if (isNumber($p_array['searchtag'][$i])==1)
$query .= ' and ag_id in (select ag_id from action_tags where t_id= '.sql_string($p_array['searchtag'][$i]).')';
if (isNumber($p_array['searchtag'][$i])==1) {
$query .= $and .' ag_id in (select ag_id from action_tags where t_id= '.sql_string($p_array['searchtag'][$i]).')';
$and = $operand;
}
}
return $query;
return "and (".$query.")";
}
/**
@ -1318,7 +1235,7 @@ class Follow_Up
if ($p_array==null) $p_array=$_GET;
$action_query="";
$ag_state=""; //<! selected status of the event , if not set or equal to -1 , it is all of them
if (isset($_REQUEST['action_query']))
{
// if a query is request build the sql stmt
@ -1351,6 +1268,8 @@ class Follow_Up
if (isset($p_array['state'])&&$p_array['state'] !=-1)
{
$action_query .= ' and ag_state= '.sql_string($p_array['state']);
// a status is selected
$ag_state=$p_array['state'];
}
if (isset($p_array['hsstate'])&&$p_array['hsstate']!=-1)
{
@ -1396,7 +1315,8 @@ class Follow_Up
{
$action_query .= " and to_date('".sql_string($p_array['remind_date_end'])."','DD.MM.YYYY')>= 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 '<span style="border:1px solid black;margin-right:5px;">';
echo '<span class="tagcell">';
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 '</span>';
echo '&nbsp;';
echo '&nbsp;';
}
$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; $i<count($a_linked); $i++)
{
$fiche=new Fiche($this->db, $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 '<span style="border:1px solid black;margin-right:5px;">';
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 '<span class="tagcell">';
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 '</span>';
echo '&nbsp;';
echo '&nbsp;';

View file

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

View file

@ -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%"]);
}
/**

View file

@ -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.='<div class="fieldset" style="overflow:auto;height:400px">';
$ret.='<table id="quick_item" style="width:100%">';
$ret.='<tr>' .
'<th style="text-align:left">Quickcode' . $info . '</th>' .
@ -287,6 +287,7 @@ class Pre_Op_Advanced extends Pre_operation_detail
// If readonly == 1 then show CA
}
$ret.='</table>';
$ret.="</div>";
$ret.=Html_Input_Noalyss::ledger_add_item("M");
return $ret;
}

View file

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

View file

@ -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 '<span id="sp_'.$p_prefix.$this->data->t_id.'" style="border:1px solid black;margin-right:5px;">';
echo '<span id="sp_'.$p_prefix.$this->data->t_id.'" class="tagcell">';
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 '</span>';
}
/**

View file

@ -0,0 +1,95 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @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 '<div id="d_tag_group_add">';
$this->input_tag();
echo '</div>';
}
/**
* 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 '<ol id="ol_tag_group">';
$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('<li id="t%s"> %s %s %s</li>', $aTag[$i]['jt_id'],$aTag[$i]['t_tag'],$dossier_id,$js);
}
echo '</ol>';
// 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));
}
}

View file

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

View file

@ -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 "<FORM class=\"print\"NAME=\"form_detail\" METHOD=\"POST\" >";
echo HtmlInput::hidden("ac", $ac);
/* request for a predefined operation */
if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']) && ! isset($correct) )
{

View file

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

View file

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

View file

@ -0,0 +1,58 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE."/class/contact_option_ref_mtable.class.php";
echo '<div class="content">';
/**
* @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 '</div>';

View file

@ -0,0 +1,68 @@
<?php
/**
* Autogenerated file
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
* class_attr_def_sql.php
*
* @file
* @brief abstract of the table public.attr_def */
class Attr_def_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
{
$this->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);
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* Autogenerated file
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
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);
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* Autogenerated file
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
* class_document_type_sql.php
*
* @file
* @brief abstract of the table public.document_type
*/
/**
* @class
* @brief abstract of the table public.document_type
*/
class Document_type_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn, $p_id=-1)
{
$this->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);
}
}

View file

@ -0,0 +1,62 @@
<?php
/**
* Autogenerated file
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
* class_tag_group_sql.php
*
*@file
*@brief abstract of the table public.tag_group */
class Tag_group_SQL extends Noalyss_SQL
{
function __construct(Database $p_cn,$p_id=-1)
{
$this->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);
}
}

View file

@ -0,0 +1,68 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/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);

View file

@ -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');
}

View file

@ -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.='</div>';
@ -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=<<<EOF
obj={dossier:$dossier,ag_id:$p_agid};action_add_concerned_card(obj);
obj={dossier:$dossier,ag_id:$p_agid};action_concerned_search_card(obj);
EOF;
$js=HtmlInput::button_action(_('Ajout autres'), $javascript, 'xx',
'smallbutton');

View file

@ -136,6 +136,7 @@ class ICard extends HtmlInput
$this->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))

View file

@ -1,4 +1,5 @@
<?php
/*
* This file is part of NOALYSS.
*
@ -15,78 +16,105 @@
* You should have received a copy of the GNU General Public License
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
/* !\file
* \brief Html Input
* - name is the name and id of the input
* - extra amount of the operation to reconcile
* - extra2 ledger paid
*/
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
class IConcerned extends HtmlInput
{
private $hideOperation; //!< string of j_id to hide, separated by comma to avoid to reconcile an operation with itself
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;
$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("
<INPUT TYPE=\"text\" style=\"color:black;background:lightyellow;border:solid 1px grey;\" NAME=\"%s\" ID=\"%s\" VALUE=\"%s\" SIZE=\"8\" hide_operation=\"%s\" readonly>
<INPUT TYPE=\"text\" style=\"color:black;background:lightyellow;border:solid 1px grey;\" NAME=\"%s\" ID=\"%s\" VALUE=\"%s\" SIZE=\"8\" hide_operation=\"%s\" readonly single_operation=\"%s\">
<INPUT class=\"smallbutton\" TYPE=\"button\" onClick=\"$('%s').value=''\" value=\"X\">
",
$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("<span><b>%s</b></span>",$this->value);
$r.=sprintf('<input type="hidden" name="%s" value="%s">', $this->name,$this->value);
$r=sprintf("<span><b>%s</b></span>", $this->value);
$r.=sprintf('<input type="hidden" name="%s" value="%s">', $this->name, $this->value);
return $r;
}
static public function test_me()
{
}
}

View file

@ -70,16 +70,17 @@ class Inplace_Switch
throw new Exception(_("Invalide value"));
}
printf('<span style="text-decoration: none;color:%s" class="inplace_edit icon" id="%s">', $color,$this->name);
echo $icon;
echo '</span>';
echo <<<EOF
$r=sprintf('<span style="text-decoration: none;color:%s" class="inplace_edit icon" id="%s">', $color,$this->name);
$r.=$icon;
$r.= '</span>';
$r.=<<<EOF
<script>
{$this->name}.onclick=function() {new Ajax.Updater({$this->name},'{$this->callback}',{method:"get",parameters:{$this->json},evalScripts:true} );
{$this->jscript}
}
</script>
EOF;
return $r;
}
public function get_jscript()
{

View file

@ -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, "");
}
}

View file

@ -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 '<tbody>';
}
$row=Database::fetch_array($ret, $i);
$this->display_row($row);
}
echo '</tbody>';
echo "</table>";
if ($this->can_append_row()==TRUE)
{
@ -713,6 +717,7 @@ function check()
function display_table_header()
{
$nb=count($this->a_order);
echo '<thead>';
echo "<tr>";
if ($this->can_update_row() && $this->icon_mod=="left")
@ -743,6 +748,7 @@ function check()
echo th(" ", 'style="width:40px" class="sorttable_nosort" ');
}
echo "</tr>";
echo '</thead>';
}
/**
* 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('<tr id="%s_%s">', $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('<td sort_value="X%s" >',$p_row[$v]):"<td>";
echo $td.HtmlInput::anchor($p_row[$v], "", $js).'</td>';
}
@ -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('<form id="frm%s_%s" method="POST" onsubmit="%s.save(\'frm%s_%s\');return false;">',
$this->object_name, $this->table->get_pk_value(),
$this->object_name, $this->object_name,

View file

@ -107,4 +107,5 @@ content[73]="<?php echo _("Mettre à oui pour un journal dédié uniquement aux
content[74]="<?php echo _('TVA due ou récupérable quand l\'opération est payée ou exécutée')?>";
content[75]="<?php echo _('Journaux Achat ou vente en mode simple, TVA ou détaillé')?>";
content[76]="<?php echo _('Il est conseillé d\'avoir un quickcode de moins de 9 car.')?>";
content[77]="<?php echo _("Permet de chercher dans le suivi pour les contacts multiques")?>";
</script>

View file

@ -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 '<DIV class="content" >';
$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 '<TABLE class="result" style="width:80%;margin-left:10%">';
echo '<TABLE class="result" >';
echo "<tr>";
echo '<th>'.$header->get_header(0).'</th>';
echo '<th>'.$header->get_header(1).'</th>';
@ -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 "<td>";
echo HtmlInput::anchor($l_line['use_login'], $url);
echo "</td>";
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 "<td>";
echo HtmlInput::anchor($l_line['use_login'], $url);
echo "</td>";
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 "</TR>";
echo td($str);
echo "</TR>";
}
echo '</TABLE>';
}
@ -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 "</p>";
echo '<Fieldset><legend>'._('Journaux').'</legend>';
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 "<p class='info'>";
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 "</p>";
}
echo "</p>";
//------------------------------------------------------------------------
// Access by ledgers, needed if the security on ledger is enable
//------------------------------------------------------------------------
echo '<div id="security_ledger_tbl">';
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 '<table>';
$MaxJrn=Database::num_row($Res);
$jrn_priv=new ISelect("iledger");
@ -287,12 +296,12 @@ if ( $action == "view" )
echo '</div>';
echo '</fieldset>';
echo '<hr>';
//**********************************************************************
// Show Priv. for actions
//**********************************************************************
echo '<fieldset> <legend>'._('Actions').'</legend>';
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 "<p class='info'>";
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 "</p>";
}
echo "</p>";
@ -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");

View file

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

View file

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

View file

@ -26,19 +26,39 @@
* @brief show button in the list of actions
*
*/
$http=new HttpInput();
?>
<div class="content" style="display:inline" >
<div style="display:inline">
<input id="bt_search" type="button" class="smallbutton" onclick="$('search_action').style.display='block'" value="<?php echo _('Recherche') ?>">
<input id="bt_add" type="button" class="smallbutton" onclick="$('b_add_action').style.display='block';document.getElementById('action_type').focus()" value="<?php echo _('Ajout') ?>">
<div id="b_add_action" style="display:none" class="inner_box">
<?php echo HtmlInput::title_box(_("Ajout d'une action"), "b_add_action","hide");?>
<form method="get" style="display:inline" action="do.php">
<?php echo dossier::hidden();
$a_typeAction=new ISelect("action_type");
$a_typeAction->rowsize=10;
$a_typeAction->value=$cn->make_array("select dt_id,dt_value from document_type order by 2");
echo _("Type action ");
echo $a_typeAction->input();
?>
<input type="submit" class="smallbutton" name="submit_query" value="<?php echo _("Ajout Action")?>">
<input type="hidden" name="ac" value="<?php echo $_REQUEST['ac']?>">
<input type="hidden" name="ac" value="<?php echo $http->request('ac')?>">
<input type="hidden" name="sa" value="add_action">
<?php echo $supl_hidden?>
<input id="bt_search" type="button" class="smallbutton" onclick="$('search_action').style.display='block'" value="<?php echo _('Recherche')?>">
<ul class="aligned-block">
<li>
<input type="submit" class="smallbutton" name="submit_query" value="<?php echo _("Ajout Action")?>">
</li>
<li>
<?php echo HtmlInput::button_hide("b_add_action");?>
</li>
</ul>
</form>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,123 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2019) Author Dany De Bontridder <danydb@noalyss.eu>
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;
?>
<?php echo _('Prochain numéro') ?>
<p class="info" style="display:inline">
(
<?php echo _('numéro actuel') ?>
<?php
$last=0;
if ( $table->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;
?>
)
</p>
<?php
echo
Icon_Action::infobulle(15);
?>
<?php
$seq=new INum('seq', 0);
echo $seq->input();
?>
<div>
<h3 class="info" sytle="margin-block: 4px"><?php echo _("Détail") ?></h3>
<ul class="tab_row" style="padding-top: 0px">
<li>
<?php
$i=new ICheckBox("detail_operation",1);
if ( Document_Option::is_enable_operation_detail($table->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();
?>
</li>
<li>
<?php
$i=new ICheckBox("det_contact_mul",1);
if ( Document_Option::is_enable_contact_multiple($table->dt_id)) $i->set_check(1); else $i->set_check(0);
echo $i->input();
echo _("Contacts multiples");
?>
</li>
<li>
<?php
$i=new ICheckBox("make_invoice",1);
if ( Document_Option::is_enable_make_invoice($table->dt_id)) $i->set_check(1); else $i->set_check(0);
echo $i->input();
echo _("Création de facture");
?>
</li>
</ul>
</div>
<div>
<h3 class="info" sytle="margin-block: 4px"><?php echo _("Options contact") ?></h3>
<ul class="tab_row" style="padding-top: 0px">
<?php
$nb_option=count($aOption);
for ($i=0;$i<$nb_option;$i++)
{
echo '<li>';
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 "&nbsp;&nbsp;&nbsp;"._($aOption[$i]['cor_label']);
echo '</li>';
}
?>
</ul>
</div>

View file

@ -56,6 +56,10 @@
<td style="text-align:right" ><?php echo _("Etat")?></td>
<td><?php echo $type_state->input()?></td>
</tr>
<tr>
<td style="text-align:right"> <?php echo _("Affiche aussi les actions fermées");?></td>
<td><?php echo $closed_action->input();?></td>
</tr>
<tr>
<td style="text-align:right" ><?php echo _("Exclure Etat")?></td>
<td><?php echo $hsExcptype_state->input()?></td>
@ -103,10 +107,7 @@
<?php echo $remind_date_end->input();?>
</td>
</tr>
<tr>
<td style="text-align:right"> <?php echo _("Affiche aussi les actions fermées");?></td>
<td><?php echo $closed_action->input();?></td>
</tr>
</table>
@ -140,6 +141,18 @@
?>
</span>
</p>
<p>
<?php
echo _("Option étiquettes");
$iselect= new ISelect("tag_option");
$iselect->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();
?>
</p>
<input type="hidden" name="sa" value="list">
<?php echo $supl_hidden?>

View file

@ -0,0 +1,120 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @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
*/
?>
<h3 class="info" style="margin:1px">
<?=$aIdentity['name']." ".$aIdentity['first_name']." ".$aIdentity['qcode']?>
</h2>
<form method="POST" onsubmit="save_linked_card_option(this);return false">
<input type="hidden" name="op" value="card">
<input type="hidden" name="op2" value="save_card_option">
<input type="hidden" name="ctl" value="notused">
<input type="hidden" name="ag_id" value="<?=$ag_id?>">
<input type="hidden" name="f_id" value="<?=$fiche_id?>">
<input type="hidden" name="action_person_id" value="<?=$p_action_person_id?>">
<?= Dossier::hidden() ?>
<?php
$nb_option=count($a_option);
for ($i=0; $i<$nb_option; $i++):
switch ($a_option[$i]['cor_type'])
{
case 0:
$input=new IText("ap_value[]");
break;
case 2:
$input=new IDate("ap_value[]");
break;
case 1:
$input=new INum("ap_value[]");
break;
case 3:
$input=new ISelect("ap_value[]");
$input->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 '<span style="display:table-row">';
echo '<span style="display:table-cell">';
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 '</span>';
echo '<span style="display:table-cell">';
echo $input->input();
echo '</span>';
echo '</span>';
endfor;
?>
<ul class="aligned-block">
<li>
<?=HtmlInput::button_close("d_linked_card_option")?>
</li>
<li>
<?=HtmlInput::submit("save",_("Sauver"))?>
</li>
</ul>
</form>

View file

@ -0,0 +1,51 @@
<?php
//This file is part of NOALYSS and is under GPL
//see licence.txt
$nb_array=count($array);
?>
<fieldset id="asearch" style="height:41rem">
<legend><?php echo _('Résultats'); ?></legend>
<div style="height:100%;overflow:auto;">
<?php if ($nb_array > 10) :
echo _("recherche rapide");
echo HtmlInput::filter_table("card_list", '1,2,3', 0);
endif;
?>
<?php printf (_("Nombre de fiches trouvées %d montrées %d"),$count_card,$nb_array);?>
<table id="card_list" class="result" >
<th><?= ICheckBox::toggle_checkbox("all", "search_card2_frm")?></th>
<th><?=_("QCode")?></th>
<th><?=_("Société")?></th>
<th><?=_("Nom")?></th>
<th><?=_("Description")?></th>
<?php for ($i=0; $i<$nb_array; $i++) : ?>
<?php $class=($i%2==0)?'odd':'even'; ?>
<tr class="<?php echo $class; ?>">
<td style="padding-right:55px">
<?php echo $array[$i]['checkbox'] ?>
</td>
<td style="padding-right:55px">
<?php echo $array[$i]['quick_code'] ?>
</td>
<td>
<?php echo $array[$i]['company'] ?>
</td>
<td>
<?php echo $array[$i]['name'] ?>
<?php echo $array[$i]['first_name'] ?>
</td>
<td>
<?php echo $array[$i]['description'] ?>
</td>
</tr>
<?php endfor; ?>
</table>
<span style="font-style: italic;">
<?php echo _("Nombre d'enregistrements:$i"); ?>
</span>
<br>
</div>
</fieldset>

View file

@ -5,6 +5,34 @@
<fieldset id="asearch" style="height:88%">
<legend><?php echo _('Résultats'); ?></legend>
<div style="height:88%;overflow:auto;">
<?php
// compute the url, $sql_array is defined in ajax_card.php
echo '<ul class="aligned-block" style="padding:1px;margin-top: 0px;margin-bottom: 0px;">';
if ( $page_card != 0 ) {
// show previous arrow to left
echo '<li style="padding:1px">';
echo '<form method="GET" onsubmit="this.ctl=\'ipop_card\';search_get_card(this);return false;">';
$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 '</form>';
echo '</li>';
}
if ( $record_start < $total_card && $nb_found >= MAX_SEARCH_CARD) {
echo '<li style="padding:1px">';
echo '<form method="GET" onsubmit="this.ctl=\'ipop_card\';search_get_card(this);return false;">';
$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 '</form>';
echo '</li>';
}
echo '</ul>';
?>
<table class="result" >
<?php for ($i=0;$i<sizeof($array);$i++) : ?>
<?php $class=($i%2==0)?'odd':'even';?>
@ -40,7 +68,7 @@ if ( $accvis == 1 ) :
<?php endfor; ?>
</table>
<span style="font-style: italic;">
<?php echo _("Nombre d'enregistrements:$i"); ?>
<?php echo _("Nombre d'enregistrements trouvé:$total_card"); ?>
</span>
<br>
</div>

View file

@ -7,7 +7,7 @@ $uniq=uniqid("tab",TRUE);
<table>
<tr class="highlight">
<tr class="highlight">
<TD>
<?php echo _('N° document')?>
</TD>
@ -57,6 +57,7 @@ $uniq=uniqid("tab",TRUE);
echo _('Pas de catégorie de contact');
endif;
endif;
?>
</td>
</Tr>
@ -65,7 +66,7 @@ $uniq=uniqid("tab",TRUE);
<?php echo $spcontact->input(); ?>
</td>
</Tr>
<?php if ($this->ag_id > 0 ): ?>
<?php if ($this->ag_id > 0 && Document_Option::is_enable_contact_multiple($this->dt_id)): ?>
<tr>
<td>
<?php echo _('Autres concernés')?>
@ -79,7 +80,13 @@ $uniq=uniqid("tab",TRUE);
?>
</td>
<td>
<?php
$csv="export.php?".
http_build_query(["gDossier"=>Dossier::id(),
"act"=>"CSV:FollowUpContactOption",
"ag_id"=>$ag_id]);
echo HtmlInput::anchor(_("Export CSV"), $csv);
?>
</td>
</tr>
<?php endif; ?>
@ -148,7 +155,7 @@ $uniq=uniqid("tab",TRUE);
<?php if ($this->ag_id > 0 ): ?>
<tr>
<TD>
Dossier / tags
Dossier / Etiquette
</TD>
<td id="action_tag_td">
@ -280,132 +287,52 @@ echo '</span>';
<?php endif; ?>
</div>
</div>
<?php if ( $p_view !='READ' ) :?>
<input type='button' class="button" class="noprint" value="<?php echo _('Montrer articles');?>" id="toggleButton" onclick='toggleShowDetail()'>
<?php endif; ?>
<?php
/**
* check if there card to show,
*/
$show_row=0;
for ($i=0;$i<count($aArticle);$i++) :
if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ $show_row=1;break;}
endfor;
<?php
/**********************************************************************************************************************
* START BLOCK Display Detail of follow up
*
**********************************************************************************************************************/
?>
<?php
/*
* display detail if there card or if we are in UPDATE or NEW mode
*/
if ($show_row !=0 ) :
// Display detail if detail_operation is set
if ( $this->ag_id > 0 && Document_Option::is_enable_operation_detail($this->dt_id)) Follow_Up_Detail::display($this,$p_view);
?>
<div id="fldDetail" class="myfieldset" style='padding-bottom: 100px;display:block;top:2px'>
<LEGEND> <?php echo _('Détail')?>
</LEGEND>
<?php // hidden fields
$show_row=0;
for ($i=0;$i<count($aArticle);$i++) :
echo $aArticle[$i]['ad_id'];
echo $aArticle[$i]['hidden_tva'];
echo $aArticle[$i]['hidden_htva'];
if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ $show_row=1;}
endfor;
?>
<div>
<table style="width:100%" id="art" >
<tr>
<th><?php echo _('Fiche')?></th>
<th><?php echo _('Description')?></th>
<th><?php echo _('prix unitaire')?></th>
<th><?php echo _('quantité')?></th>
<th><?php echo _('Code TVA')?></th>
<th><?php echo _('Montant TVA')?></th>
<th><?php echo _('Montant TVAC')?></th>
<?php
/**********************************************************************************************************************
* END BLOCK Display Detail of follow up
**********************************************************************************************************************/
?>
<div style="clear:both"></div>
</tr>
<?php for ($i=0;$i<count($aArticle);$i++): ?>
<?php
if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'):
$show_row++;
?>
<TR>
<TD><?php echo $aArticle[$i]['fid'] ?></TD>
<TD><?php echo $aArticle[$i]['desc'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['pu'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['quant'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['tvaid'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['tva'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['tvac'] ?></TD>
</TR>
<?php endif; ?>
<?php endfor; ?>
</table>
</div>
<?php if ($p_view != "READ" ): ?>
<script language="JavaScript">
if ( $('e_march0') && $('e_march0').value =='') { toggleShowDetail();}
function toggleShowDetail() {
try {var detail=g('fldDetail');
var but=g('toggleButton');
if (detail.style.display=='block' ) { but.value="<?php echo _("Montrer les détails")?>";detail.style.display='none';}
else { but.value="<?php echo _("Cacher les détails")?>";detail.style.display='block';} }
catch (error) {alert(error);}
}
</script>
<?php endif; ?>
<?php if ( $show_row != 0 ): ?>
<div>
<div style=" float:right;margin-right: 2px" id="sum">
<br><span style="text-align: right;" class="highlight" id="htva"><?php echo bcsub($tot_item,$tot_vat) ?></span>
<br><span style="text-align: right" class="highlight" id="tva"><?php echo $tot_vat?></span>
<br><span style="text-align: right" class="highlight" id="tvac"><?php echo $tot_item?></span>
</div>
<div style="float:right;margin-right: 230px" >
<br>Total HTVA
<br>Total TVA
<br>Total TVAC
</div>
<div class="myfieldset" id="div_action_attached_doc">
<legend>
<?php echo _('Pièces attachées')?>
</legend>
<div class="noprint">
<?php
/**********************************************************************************************************************
* start BLOCK generate document
**********************************************************************************************************************/
?>
<?php if ( ! $readonly ) : ?>
<div style="float:right" >
<input name="act" id="act_bt" class="smallbutton" value="<?php echo _('Actualiser')?>" onclick="compute_all_ledger();" type="button">
<input type="button" class="smallbutton" onclick="gestion_add_row()" value="<?php echo _("Ajouter une ligne")?>">
</div>
<?php endif; ?>
<?php if ($p_view != 'READ' && $str_select_doc != '') : ?>
<?php if ($p_view != 'READ' && $str_select_doc != '') : ?>
<?php echo _('Document à générer')?>
</legend>
<?php echo $str_select_doc;
echo $str_submit_generate;
endif; ?>
<legend>
</div>
<?php if ( $this->ag_id != 0 && ! $readonly) : ?>
<div >
<p>
<?php
$query= http_build_query(array('gDossier'=>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");
?>
</p>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<div style="clear:both"></div>
<div class="myfieldset" id="div_action_attached_doc">
<legend>
<?php echo _('Pièces attachées')?>
</legend>
<?php
/**********************************************************************************************************************
* end BLOCK generate document
**********************************************************************************************************************/
?>
</div>
<div class="print">
<table>
<?php
@ -483,7 +410,7 @@ Document créé le <?php echo $this->ag_timestamp ?> par <?php echo $this->ag_ow
<?php endif; ?>
</div>
<script>compute_all_ledger()</script>
<script>
$('related_action_tab<?php echo $uniq?>').onclick=function() {
$('related_action_tab<?php echo $uniq?>').className='tabs_selected';

View file

@ -1,87 +0,0 @@
<?php
/*
* This file is part of NOALYSS.
*
* NOALYSS 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.
*
* NOALYSS 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 NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**\file
* \brief this file respond to an ajax request to modify a type of document
*/
require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
echo HtmlInput::title_box(_('Type de document'),'change_doc_div');
$doc_type=new Document_type($cn,$dt_id);
$doc_type->get();
?>
<form method="POST" id="cat_doc_f" onsubmit="cat_doc_change_record('cat_doc_f');">
<?php echo HtmlInput::request_to_hidden(array("ac","gDossier","dt_id"))?>
<table>
<tr>
<td> <?php echo _('Nom')?>
</td>
<td>
<?php
$name=new IText('dt_name',$doc_type->dt_value);
echo $name->input();
?>
</td>
</tr>
<tr>
<td><?php echo _('Préfixe')?>
</td>
<td>
<?php
$prefix=new IText('dt_prefix',$doc_type->dt_prefix);
echo $prefix->input();
?>
</td>
</tr>
<tr>
<td><?php echo _('numéro actuel')?>
</td>
<td>
<?php
$ret= $cn->get_array("select last_value,is_called from seq_doc_type_".$doc_type->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;
?>
</td>
<tr>
<td><?php echo _('Prochain numéro')?>
<?php echo
Icon_Action::infobulle(15);
?>
</td>
<td>
<?php
$seq=new INum('seq',0);
echo $seq->input();
?>
</td>
</tr>
</table>
<?php echo HtmlInput::submit("save",_('Sauver'));?>
</form>

View file

@ -0,0 +1,207 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
/**
* @file
* @brief Called from Follow_Up_Detail for displaying detail
* @see Follow_Up_Detail::display
*/
// Number of articles
$article_count=(count($p_follow_up->aAction_detail)==0)?MAX_ARTICLE:count($p_follow_up->aAction_detail);
// total item and vat
$tot_item=0;
$tot_vat=0;
$text=new IText();
$num=new INum();
$itva=new ITva_Popup();
$readonly=($p_view == "READ")?true:false;
// Check for the Price on ACH or VEN
$cn=Dossier::connect();
$document_type=$p_follow_up->db->get_value("select ag_type from action_gestion where ag_id = $1",[$p_follow_up->ag_id]);
$option_detail= Document_Option::option_operation_detail($document_type);
// default menu for invoice
$menu=new Default_Menu();
?>
<div id="follow_up_detail">
<?php echo HtmlInput::hidden("nb_item", $article_count); ?>
<table style="width:100%" id="sold_item">
<tr>
<th><?php echo _('Fiche') ?></th>
<th><?php echo _('Description') ?></th>
<th><?php echo _('prix unitaire') ?></th>
<th><?php echo _('quantité') ?></th>
<th><?php echo _('Code TVA') ?></th>
<th><?php echo _('Montant TVA') ?></th>
<th><?php echo _('Montant TVAC') ?></th>
</tr>
<?php
for ($i=0; $i<$article_count; $i++):
/* fid = Icard */
$icard=new ICard();
$icard->jrn=-10;
$icard->table=0;
$icard->noadd="no";
$icard->extra='all';
$icard->name="e_march".$i;
$tmp_ad=(isset($p_follow_up->aAction_detail[$i]))?$p_follow_up->aAction_detail[$i]:false;
$icard->readOnly=$readonly;
$icard->value='';
$aCard[$i]=0;
if ($tmp_ad)
{
$march=new Fiche($p_follow_up->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);
// name of the field to update with the name of the card
$icard->set_attribute('label', 'e_march' . $i . '_label');
// name of the field with the price autocomplete
if ( $option == 'ACH'){
$icard->set_attribute('purchase', 'e_march' . $i . '_price');
} else {
$icard->set_attribute('price','e_march'.$i.'_price');
}
// name of the field with the TVA_ID
$icard->set_attribute('tvaid', 'e_march' . $i . '_tva_id');
$icard->amount_from_type=$option_detail;
$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);
?>
<TR>
<TD><?php echo $aArticle[$i]['fid'] ?></TD>
<TD><?php echo $aArticle[$i]['desc'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['pu'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['quant'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['tvaid'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['tva'] ?></TD>
<TD class="num"><?php echo $aArticle[$i]['tvac'] ?>
<?php echo $aArticle[$i]['hidden_tva']; ?>
<?php echo $aArticle[$i]['hidden_htva']; ?>
<?php echo $aArticle[$i]['ad_id']; ?>
</TD>
</TR>
<?php
endfor;
?>
</table>
<div>
<div style=" float:right;margin-right: 2px" id="sum">
<br><span style="text-align: right;" class="highlight" id="htva"><?php echo bcsub($tot_item, $tot_vat) ?></span>
<br><span style="text-align: right" class="highlight" id="tva"><?php echo $tot_vat ?></span>
<br><span style="text-align: right" class="highlight" id="tvac"><?php echo $tot_item ?></span>
</div>
<div style="float:right;margin-right: 230px" >
<br>Total HTVA
<br>Total TVA
<br>Total TVAC
</div>
</div>
<div id="d_add_rows">
<?php echo Html_Input_Noalyss::ledger_add_item("O"); ?>
<?php echo HtmlInput::button('actualiser', _('Recalculer'), ' onClick="compute_all_ledger();"'); ?>
</div>
<script>compute_all_ledger()</script>
<?php
if (Document_Option::is_enable_make_invoice($p_follow_up->dt_id)):
?>
<p id="follow_up_detail_invoice">
<?php
$query=http_build_query(array('gDossier'=>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");
?>
</p>
<?php
endif;
?>

View file

@ -98,7 +98,7 @@ if ( $type == 'ACH' || $type == 'VEN'||$new):
<td>
<?php
$negative->javascript="toggle_row_warning_enable('negative_amount','row_warning')";
$negative->input();
echo $negative->input();
?>
</td>
</tr>

View file

@ -8,7 +8,7 @@
<?php echo $str_add_button?>
</fieldset>
<div class="fieldset">
<div class="fieldset" style="overflow:auto;height:400px">
<h1 class="fiedset"><?php echo $f_legend_detail?></h1>
<table id="sold_item" width="100%" border="0">

View file

@ -5,7 +5,8 @@
<div id="security_action_tbl">
<?php
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) \"");
function display_security_fieldset($p_legend,$p_array,$sec_User) {
$gDossier=dossier::id();

View file

@ -2,6 +2,7 @@
//This file is part of NOALYSS and is under GPL
//see licence.txt
?><?php
$http=new HttpInput();
$max=$this->cn->count($ret);
echo HtmlInput::filter_table("tag_tb", '0,1', '1');
$nDossier=Dossier::id();
@ -14,13 +15,19 @@ $nDossier=Dossier::id();
<th>
<?php echo _("Description")?>
</th>
<th>
<?php echo _("Actif")?>
</th>
</tr>
<?php
$gDossier=Dossier::id();
$ac=$_REQUEST['ac'];
$ac=$http->request('ac');
for ($i=0;$i<$max;$i++):
$row=Database::fetch_array($ret, $i);
?>
$row=Database::fetch_array($ret, $i);
?>
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
@ -33,6 +40,7 @@ $ac=$_REQUEST['ac'];
echo $row['t_description'];
?>
</td>
<td>
<?php
$id=sprintf("tag_onoff%d",$row['t_id']);

View file

@ -2,12 +2,15 @@
//This file is part of NOALYSS and is under GPL
//see licence.txt
?><?php
echo HtmlInput::title_box('Tag', $p_prefix.'tag_div');
$max=$this->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();
?>
<?php echo _("Cherche")." ".HtmlInput::filter_table($p_prefix.'tag_tb_id', '0,1', 1); ?>
<?php echo HtmlInput::button_action(_('Uniquement actif'), 'show_only_row(\''.$p_prefix.'tag_tb_id'.'\',\'tag_status\',\'Y\')');?>
@ -30,13 +33,13 @@ $gDossier=Dossier::id();
<tr <?=$attr?> class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
$js=sprintf("search_add_tag('%s','%s','%s')",$gDossier,$row['t_id'],$p_prefix);
$js=sprintf("search_add_tag('%s','%s','%s','t')",$gDossier,$row['t_id'],$p_prefix);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
?>
</td>
<td>
<?php
echo $row['t_description'];
echo h($row['t_description']);
?>
</td>
<td>
@ -51,7 +54,55 @@ $gDossier=Dossier::id();
endfor;
?>
</table>
<?php
$tab_tag->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);
?>
<table class="result">
<tr>
<th><?=_("Groupe")?></th>
</tr>
<?php for ($i=0;$i<$nb_agroup;$i++):?>
<tr>
<td>
<?php
$js=sprintf("search_add_tag('%s','%s','%s','g')",$gDossier,$aGroup[$i]['tg_id'],$p_prefix);
echo HtmlInput::anchor($aGroup[$i]['tg_name'], "", "onclick=\"$js\"");
?>
</td>
</tr>
<?php endfor;?>
</table>
<?php
$tab_tag_group->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();
?>
<?=HtmlInput::button_close($p_prefix.'tag_div')?>
<script>
show_only_row('<?=$p_prefix?>tag_tb_id','tag_status','Y');
</script>
<?=HtmlInput::button_close($p_prefix.'tag_div')?>
<?=$output->build_js($p_prefix."tab_tag");?>
</script>
<?php
$res =ob_get_contents();
ob_end_clean();
return $res;
?>

View file

@ -5,7 +5,9 @@
* @file
* @brief list of tags
*/
?><?php
$http=new HttpInput();
?>
<?php
echo HtmlInput::title_box('Tag', 'tag_div');
$max=$this->cn->count($ret);
if ( $max == 0 ) {
@ -25,14 +27,15 @@ if ( $max == 0 ) {
</tr>
<?php
$gDossier=Dossier::id();
if (isNumber($_REQUEST['ag_id']) == 0 ) die ('ERROR : parameters invalid');
$ag_id=$http->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);
?>
<tr class="<?php echo (($i%2==0)?'even':'odd');?>">
<td>
<?php
$js=sprintf("action_tag_add('%s','%s','%s')",$gDossier,$_REQUEST['ag_id'],$row['t_id']);
$js=sprintf("action_tag_add('%s','%s','%s','%s')",$gDossier,$ag_id,$row['t_id'],$row['tag_type']);
echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
?>
</td>

View file

@ -61,25 +61,25 @@ $http=new HttpInput();
<pre>
$input_switch=new InputSwitch('input_switch_value',<?php echo $http->get("input_switch_value","string","0")?>);
$input_switch->input();
echo $input_switch->input();
</pre>
input_switch
<?php
$input_switch=new InputSwitch('input_switch_value',$http->get("input_switch_value","string","0"));
$input_switch->input();
echo $input_switch->input();
?>
<h2>ReadOnly</h2>
<pre>
$input_switch=new InputSwitch('input_switch_readonly',0);
$input_switch->readOnly=TRUE;
$input_switch->input();
echo $input_switch->input();
</pre>
input_switch
<?php
$input_switch=new InputSwitch('input_switch_readonly',0);
$input_switch->readOnly=TRUE;
$input_switch->input();
echo $input_switch->input();
?>
<h1>Submit</h1>
<pre>

View file

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

View file

@ -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);
}
}
/**