';
// Add hidden tag
echo '";
+
+ $sql_array["query"]=$query;
+ $sql_array["inactive_card"]=$inactive;
/* what is the type of the ledger */
$type="GL";
if (isset($jrn) && $jrn > 1)
@@ -456,50 +452,69 @@ case 'fs':
$ledger=new Acc_Ledger($cn,$jrn);
$type=$ledger->get_type();
}
+ // if jrn == -10 , the search is called from the detail operation from an action follow-up
+ if ( isset($jrn) && $jrn == -10){
+ $type=$http->request("amount_from_type","string","VEN");
+ }
$fiche=new Fiche($cn);
/* Build the SQL and show result */
$sql=$fiche->build_sql($sql_array);
if ( strpos($sql," in ()") != 0)
{
- $html=Icon_Action::close('search_card');
- $html.='
'.h2info(_('Recherche de fiche')).'
';
+ $html="";
+ $html.=HtmlInput::title_box(_('Recherche de fiche'), 'search_card');
$html.='
';
$html.=_("Aucune catégorie de fiche ne correspond à".
" votre demande, le journal pourrait n'avoir accès à aucune fiche");
$html.='
';
+ $html.=HtmlInput::button_close("search_card");
break;
}
+ /**
+ * if inactive == 0 , then only active card
+ */
+ if ( $inactive == 0 ) {
+ $sql.=" and f_id in (select f_id from fiche_detail where ad_id=54 and ad_value='1') ";
+ }
+
/* We limit the search to MAX_SEARCH_CARD records */
- $sql=$sql.' order by vw_name limit '.MAX_SEARCH_CARD;
- $a=$cn->get_array($sql);
- for($i=0;$iget_value("select count(*) from ($sql) as c");
+
+ $record_start=$page_card*MAX_SEARCH_CARD;
+ $sql.=' limit '.MAX_SEARCH_CARD.' offset '.$record_start;
+
+ $aFound=$cn->get_array($sql);
+ $nb_found=count($aFound);
+ for($i=0;$i<$nb_found;$i++)
+ {
+ $array[$i]['quick_code']=$aFound[$i]['quick_code'];
+ $array[$i]['name']=h($aFound[$i]['vw_name']);
+ $array[$i]['accounting']=$aFound[$i]['accounting'];
+ $array[$i]['first_name']=h($aFound[$i]['vw_first_name']);
+ $array[$i]['description']=h($aFound[$i]['vw_description']);
$array[$i]['javascript']=sprintf("set_value('%s','%s');",
$inp,$array[$i]['quick_code']);
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
- $label,j(h(strip_tags($a[$i]['vw_name']))));
+ $label,j(h(strip_tags($aFound[$i]['vw_name']))));
+
/* if it is a ledger of sales we use vw_buy
if it is a ledger of purchase we use vw_sell*/
if ( $type=="ACH" ){
- $amount=(isNumber($a[$i]['vw_buy']) == 1 )?$a[$i]['vw_buy']:0;
+ $amount=(isNumber($aFound[$i]['vw_buy']) == 1 )?$aFound[$i]['vw_buy']:0;
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
$price,$amount);
}
if ( $type=="VEN" ){
- $amount=(isNumber($a[$i]['vw_buy']) == 1 )?$a[$i]['vw_sell']:0;
+ $amount=(isNumber($aFound[$i]['vw_sell']) == 1 )?$aFound[$i]['vw_sell']:0;
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
$price,$amount);
}
$array[$i]['javascript'].=sprintf("set_value('%s','%s');",
- $tvaid,$a[$i]['tva_id']);
+ $tvaid,$aFound[$i]['tva_id']);
$array[$i]['javascript'].="removeDiv('search_card');";
}//foreach
@@ -516,9 +531,11 @@ case 'fs':
require_once NOALYSS_INCLUDE.'/ajax/ajax_add_concerned_card.php';
return;
break;
- case 'action_save_concerned':
+// add several card to an action follow⁻up
+ case 'link_concerned_card':
require NOALYSS_INCLUDE.'/ajax/ajax_action_save_concerned.php';
return;
+// remove card from an action follow⁻up
case 'action_remove_concerned':
require NOALYSS_INCLUDE.'/ajax/ajax_action_remove_concerned.php';
return;
@@ -742,6 +759,23 @@ case 'upr':
}
}
break;
+ //---------------------------------------------------------------------------------------------------------------
+ // Display option of a contact in an action-followup
+ //---------------------------------------------------------------------------------------------------------------
+ case 'display_card_option':
+
+ require_once NOALYSS_INCLUDE.'/ajax/ajax_display_card_option.php';
+ return;
+ break;
+
+ //---------------------------------------------------------------------------------------------------------------
+ // Save option of a contact in an action-followup
+ //---------------------------------------------------------------------------------------------------------------
+ case 'save_card_option':
+ require_once NOALYSS_INCLUDE.'/ajax/ajax_save_card_option.php';
+ return;
+
+ break;
} // switch
$xml=escape_xml($html);
diff --git a/include/ajax/ajax_card_attribute.php b/include/ajax/ajax_card_attribute.php
new file mode 100644
index 000000000..418b103df
--- /dev/null
+++ b/include/ajax/ajax_card_attribute.php
@@ -0,0 +1,103 @@
+
+
+/**
+ * @file
+ * @brief answer to card_attr_inc.php
+ */
+global $g_user;
+// security
+$g_user->can_request("CFGATCARD");
+require_once NOALYSS_INCLUDE."/lib/inplace_switch.class.php";
+require_once NOALYSS_INCLUDE.'/class/card_attribut_mtable.class.php';
+
+$http=new HttpInput();
+
+try
+{
+ $action=$http->request("action", "string");
+}
+catch (Exception $ex)
+{
+ record_log("ACA01".$ex->getMessage().$ex->getTraceAsString());
+}
+
+if ($action=="enable_search")
+{
+ $value=$http->request("value");
+ $ad_id=$http->request("ad_id");
+ $name=$http->request("name");
+ if ($value==1)
+ {
+ $cn->exec_sql("update attr_def set ad_search_followup=0 where ad_id=$1", [$ad_id]);
+ $value=0;
+ }
+ else
+ {
+ $cn->exec_sql("update attr_def set ad_search_followup=1 where ad_id=$1", [$ad_id]);
+ $value=1;
+ }
+ $ic=new Inplace_Switch($name, $value);
+ $ic->set_callback("ajax_misc.php");
+ $ic->add_json_param("op", "card");
+ $ic->add_json_param("gDossier", Dossier::id());
+ $ic->add_json_param("op2", "attribute");
+ $ic->add_json_param("action", "enable_search");
+ $ic->add_json_param("ad_id", $ad_id);
+ $ic->add_json_param("ctl", $ad_id);
+ echo $ic->input();
+}
+else
+{
+ $obj=new Fiche_Attr($cn);
+ $mtable=new Card_Attribut_MTable($obj);
+ $mtable->add_json_param("op", "card");
+ $mtable->add_json_param("op2", "attribute");
+ $mtable->set_callback("ajax_misc.php");
+ $mtable->set_object_name($http->request("ctl"));
+ $ad_id=$http->request("p_id");
+ $mtable->get_table()->set_parameter("id", $ad_id);
+ switch ($action)
+ {
+ case "input":
+ $mtable->set_pk($ad_id);
+ if ( $ad_id < 0 ) $mtable->get_table()->set("ad_search_followup",0);
+ $mtable->send_header();
+ echo $mtable->ajax_input()->saveXML();
+
+ break;
+ case "save":
+ $mtable->set_pk($http->request("p_id"));
+ $mtable->send_header();
+ echo $mtable->ajax_save()->saveXML();
+
+
+ break;
+ case "delete":
+ $mtable->set_pk($http->request("p_id"));
+ $mtable->send_header();
+ echo $mtable->ajax_delete()->saveXML();
+ break;
+ default:
+ break;
+ }
+}
+?>
diff --git a/include/ajax/ajax_cfgaction.php b/include/ajax/ajax_cfgaction.php
new file mode 100644
index 000000000..656253194
--- /dev/null
+++ b/include/ajax/ajax_cfgaction.php
@@ -0,0 +1,82 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+// check right
+if ($g_user->check_action(PARCATDOC)==0)
+{
+
+ record_log("cfgaction01 security ");
+ return;
+}
+
+require_once NOALYSS_INCLUDE."/class/action_document_type_mtable.class.php";
+
+$http=new HttpInput();
+
+
+/**
+ * @file
+ * @brief call for document_type in follow up
+ */
+try
+{
+ $table=$http->request('table');
+ $ctl_id=$http->request('ctl');
+ $action=$http->request('action');
+ $p_id=$http->request('p_id', "number");
+}
+catch (Exception $ex)
+{
+ echo $e->getMessage();
+ return;
+}
+
+$doc_type=new Document_type_SQL($cn,$p_id);
+$action_document_type=new Action_Document_Type_MTable($doc_type);
+
+$action_document_type->set_callback("ajax_misc.php");
+$action_document_type->add_json_param("op", "cfgaction");
+$action_document_type->set_object_name($ctl_id);
+
+
+
+if ($action=="input")
+{
+
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $action_document_type->ajax_input()->saveXML();
+ return;
+}
+elseif ($action=="save")
+{
+ $xml=$action_document_type->ajax_save();
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $xml->saveXML();
+}
+elseif ($action=="delete")
+{
+ $xml=$action_document_type->ajax_delete();
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $xml->saveXML();
+}
diff --git a/include/ajax/ajax_contact_option_list.php b/include/ajax/ajax_contact_option_list.php
new file mode 100644
index 000000000..1622d1ab8
--- /dev/null
+++ b/include/ajax/ajax_contact_option_list.php
@@ -0,0 +1,67 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+require_once NOALYSS_INCLUDE."/class/contact_option_ref_mtable.class.php";
+
+/**
+ * @file
+ * @brief add option for contact
+ * @see contact_option_list
+ * @see action_document_type_mtable::input()
+ */
+try
+{
+ $contact_option_id=$http->request("p_id");
+ $ctl_id=$http->request("ctl");
+ $action=$http->request("action");
+}
+catch (Exception $ex)
+{
+ record_log(__FILE__." no p_id");
+ return;
+}
+$cn=Dossier::connect();
+
+// document_option id from document_option where do_code='contact_multiple' and document_type_id=p_id
+$obj=new Contact_option_ref_SQL($cn);
+
+$contact_mtable=new Contact_Option_Ref_MTable($obj);
+
+$contact_mtable->set_callback("ajax_misc.php");
+$contact_mtable->set_object_name("s_contact_option");
+$contact_mtable->set_dialog_box("db_contact_option");
+$contact_mtable->add_json_param("op", "contact_option_list");
+$contact_mtable->set_object_name($ctl);
+$contact_mtable->set_pk($contact_option_id);
+
+if ($action == "input") {
+ $contact_mtable->send_header();
+ echo $contact_mtable->ajax_input()->saveXML();
+} elseif($action == "save") {
+ $contact_mtable->send_header();
+
+ echo $contact_mtable->ajax_save()->saveXML();
+} elseif ($action == "delete") {
+ $contact_mtable->send_header();
+ $contact_mtable->ajax_delete();
+}
\ No newline at end of file
diff --git a/include/ajax/ajax_display_card_option.php b/include/ajax/ajax_display_card_option.php
new file mode 100644
index 000000000..464c2b574
--- /dev/null
+++ b/include/ajax/ajax_display_card_option.php
@@ -0,0 +1,44 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief display the options of a card
+ */
+require_once NOALYSS_INCLUDE."/class/card_multiple.class.php";
+
+$card_multiple=new Card_Multiple();
+try
+{
+ $ap_id=$http->get("ap_id");
+}
+catch (Exception $exc)
+{
+ echo $exc->getMessage();
+ record_log($exc->getMessage().$exc->getTraceAsString());
+}
+
+echo HtmlInput::title_box(_("Options contact"), "d_linked_card_option","close","","y");
+// display existing option
+$card_multiple->display_option($ap_id);
diff --git a/include/ajax/ajax_get_profile.php b/include/ajax/ajax_get_profile.php
index 586a92d66..9f92f8d2b 100644
--- a/include/ajax/ajax_get_profile.php
+++ b/include/ajax/ajax_get_profile.php
@@ -55,7 +55,7 @@ $a_tab[$call_tab]='tabs_selected';
-
+
@@ -111,7 +111,6 @@ if ($profile->p_id > 0)
echo '
';
echo '
';
//Menu / Module /plugin in this profile
- echo "
"._("Menu")."";
$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 '
';
echo '
';
- echo "
".('Groupe gestion')."
";
+
$profile_menu->available_profile();
echo '
';
echo '
';
diff --git a/include/ajax/ajax_save_card_option.php b/include/ajax/ajax_save_card_option.php
new file mode 100644
index 000000000..931f07ed3
--- /dev/null
+++ b/include/ajax/ajax_save_card_option.php
@@ -0,0 +1,55 @@
+
+
+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]]);
+}
\ No newline at end of file
diff --git a/include/ajax/ajax_search_add_tag.php b/include/ajax/ajax_search_add_tag.php
index 339b45cec..d1e3b853c 100644
--- a/include/ajax/ajax_search_add_tag.php
+++ b/include/ajax/ajax_search_add_tag.php
@@ -1,4 +1,5 @@
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;
exit();
-
-
?>
diff --git a/include/ajax/ajax_search_display_tag.php b/include/ajax/ajax_search_display_tag.php
index 59d962739..b4295cc38 100644
--- a/include/ajax/ajax_search_display_tag.php
+++ b/include/ajax/ajax_search_display_tag.php
@@ -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 <<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 '
';
+ 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'));
diff --git a/include/ajax/ajax_tag_add_action.php b/include/ajax/ajax_tag_add_action.php
index cdb4c4ad5..890966c0a 100644
--- a/include/ajax/ajax_tag_add_action.php
+++ b/include/ajax/ajax_tag_add_action.php
@@ -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();
diff --git a/include/ajax/ajax_tag_detail.php b/include/ajax/ajax_tag_detail.php
index 6e86e5f5b..20043000b 100644
--- a/include/ajax/ajax_tag_detail.php
+++ b/include/ajax/ajax_tag_detail.php
@@ -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");
?>
+
+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();
+}
\ No newline at end of file
diff --git a/include/ajax/ajax_tag_list.php b/include/ajax/ajax_tag_list.php
index 342a44b92..5ce78c43f 100644
--- a/include/ajax/ajax_tag_list.php
+++ b/include/ajax/ajax_tag_list.php
@@ -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();
diff --git a/include/ajax/ajax_tag_save.php b/include/ajax/ajax_tag_save.php
index 59df25eda..ade69812e 100644
--- a/include/ajax/ajax_tag_save.php
+++ b/include/ajax/ajax_tag_save.php
@@ -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"));
}
diff --git a/include/ajax/ajax_tag_set_group.php b/include/ajax/ajax_tag_set_group.php
new file mode 100644
index 000000000..4d3634830
--- /dev/null
+++ b/include/ajax/ajax_tag_set_group.php
@@ -0,0 +1,77 @@
+
+
+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();
diff --git a/include/card_attr.inc.php b/include/card_attr.inc.php
index fa8bcae8d..c098f7b0b 100644
--- a/include/card_attr.inc.php
+++ b/include/card_attr.inc.php
@@ -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;$eset_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 '
+
+
+
\ No newline at end of file
diff --git a/include/cfgtags.inc.php b/include/cfgtags.inc.php
index e9aef771f..9a6188597 100644
--- a/include/cfgtags.inc.php
+++ b/include/cfgtags.inc.php
@@ -17,7 +17,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
/**
* @file
@@ -26,34 +27,82 @@ if ( !defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
*/
require_once NOALYSS_INCLUDE.'/class/tag.class.php';
require_once NOALYSS_INCLUDE.'/lib/single_record.class.php';
+require_once NOALYSS_INCLUDE."/lib/html_tab.class.php";
+require_once NOALYSS_INCLUDE."/lib/output_html_tab.class.php";
+require_once NOALYSS_INCLUDE."/class/tag_group_mtable.class.php";
+/* * *****************************************************************************
+ * Tags
+ *
+ * ***************************************************************************** */
+$tabs=new Html_Tab("tg", _("Etiquette"));
+
+ob_start();
$tag=new Tag($cn);
$uos=new Single_Record('tag');
-if ( isset ($_POST['save_tag_sb']))
+if (isset($_POST['save_tag_sb']))
{
- if ( ! isset ($_POST['remove']))
+ if (!isset($_POST['remove']))
{
- try {
+ try
+ {
$uos->check();
$tag->save($_POST);
$uos->save();
- } catch (Exception $e)
+ }
+ catch (Exception $e)
{
alert("déjà sauvé");
}
- } else {
+ }
+ else
+ {
$tag->remove($_POST);
}
}
?>
-
-
-
+
+
-
- show_list();
- $js=sprintf("onclick=\"show_tag('%s','%s','%s','p')\"",Dossier::id(),$_REQUEST['ac'],'-1');
- echo HtmlInput::button("tag_add", "Ajout d'un tag", $js);
- ?>
\ No newline at end of file
+ à plusieurs dossiers ou avoir plusieurs étiquettes."); ?>
+
+show_list();
+$js=sprintf("onclick=\"show_tag('%s','%s','%s','p')\"", Dossier::id(), $_REQUEST['ac'], '-1');
+echo HtmlInput::button("tag_add", "Ajout d'un tag", $js);
+?>
+
+set_content(ob_get_contents());
+ob_end_clean();
+/* * *****************************************************************************
+ * Group of Tags
+ *
+ * ***************************************************************************** */
+$tag_group=new Html_Tab("grp_tg", _("Groupe étiquettes"));
+
+$obj=new Tag_Group_SQL($cn);
+$obj_manage=new Tag_Group_MTable($obj);
+$obj_manage->set_callback("ajax_misc.php");
+$obj_manage->add_json_param("op", "tag_group");
+ob_start();
+$obj_manage->display_table();
+$r=ob_get_contents();
+$tag_group->set_content($r);
+ob_end_clean();
+
+
+$out=new Output_Html_Tab();
+$out->add($tabs);
+$out->add($tag_group);
+$out->output();
+$obj_manage->create_js_script();
+?>
+
\ No newline at end of file
diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php
index c1e17f315..003513bc2 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -2354,7 +2354,12 @@ class Acc_Ledger extends jrn_def_sql
*/
function verify_ledger($array)
{
- extract($array, EXTR_SKIP);
+
+ $p_jrn=$array['p_jrn'];
+ $p_jrn_deb_max_line=$array['p_jrn_deb_max_line'];
+ $p_jrn_name=$array['p_jrn_name'];
+ $p_jrn_type=$array['p_jrn_type'];
+
try
{
if (isNumber($p_jrn)==0)
@@ -2368,8 +2373,10 @@ class Acc_Ledger extends jrn_def_sql
throw new Exception(_("Un journal avec ce nom existe déjà"));
if ($p_jrn_type=='FIN')
{
+ $http=new \HttpInput();
$a=new Fiche($this->db);
- $result=$a->get_by_qcode(trim(strtoupper($_POST['bank'])), false);
+ $bank=$http->post("bank");
+ $result=$a->get_by_qcode(trim(strtoupper($bank)), false);
if ($result==1)
throw new Exception(_("Aucun compte en banque n'est donné"));
}
@@ -2378,11 +2385,17 @@ class Acc_Ledger extends jrn_def_sql
throw new Exception(_('Choix du type de journal est obligatoire'));
}
- if (isset( $negative_warning) && $negative_amount == 1 && trim($negative_warning)=="") {
+ if ( isset( $array['negative_warning']) &&
+ isset( $array['negative_amount']) &&
+ $array['negative_amount'] == 1
+ && trim($array['negative_warning'])=="") {
throw new Exception(_("Avertissement ne peut être vide"));
}
- if ( isset( $negative_amount) && $negative_amount <> 0 && $negative_amount <> 1 ){
+ if ( isset( $array['negative_amount']) &&
+ $array['negative_amount'] <> 0 &&
+ $array['negative_amount'] <> 1 )
+ {
throw new Exception(_("Valeur invalide"));
}
}
diff --git a/include/class/acc_ledger_history_generic.class.php b/include/class/acc_ledger_history_generic.class.php
index 54ee8312b..a50f142d8 100644
--- a/include/class/acc_ledger_history_generic.class.php
+++ b/include/class/acc_ledger_history_generic.class.php
@@ -494,7 +494,7 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History
$cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
- $ledger_list=join($this->ma_ledger, ",");
+ $ledger_list=join( ",",$this->ma_ledger);
// Grand livre == 0
$Res=$this->db->exec_sql("select jr_id,j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
jr_internal,
diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php
index d7a19155a..b7ed71b3e 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -224,6 +224,9 @@ class Acc_Ledger_Search
if (isset($_REQUEST['hide_operation']))
$r.=HtmlInput::hidden("hide_operation", $http->request('hide_operation'));
+ if (isset($_REQUEST['single_operation']))
+ $r.=HtmlInput::hidden("single_operation", $http->request('single_operation'));
+
ob_start();
$search_filter=$this->build_search_filter();
require_once NOALYSS_TEMPLATE.'/ledger_search.php';
diff --git a/include/class/acc_operation.class.php b/include/class/acc_operation.class.php
index e1930efc1..06946c760 100644
--- a/include/class/acc_operation.class.php
+++ b/include/class/acc_operation.class.php
@@ -747,11 +747,11 @@ class Acc_Operation
$r.=_("Menu invalide");
return $r;
}
- /**
- * @bug : if several menu possible , will use only the first one, because request take first the GET and after
- * the POST
- */
+
// Prepare the form
+ $r=sprintf('
',$p_id,NOALYSS_URL."/do.php?".Dossier::get());
+ $r.=Dossier::hidden();
+ // select the menu where the operation will be duplicated
$r=sprintf('
',$p_id,NOALYSS_URL."/do.php?".http_build_query([
"ac"=>$a_code[0]['code'],"gDossier"=>Dossier::id()
]));
diff --git a/include/class/action_document_type_mtable.class.php b/include/class/action_document_type_mtable.class.php
new file mode 100644
index 000000000..f02f56d7b
--- /dev/null
+++ b/include/class/action_document_type_mtable.class.php
@@ -0,0 +1,244 @@
+
+
+/* @file
+ * @brief display and allow to update , add , delete document_type for the follow up
+ *
+ */
+require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
+require_once NOALYSS_INCLUDE."/database/document_type_sql.class.php";
+
+/**
+ * @class
+ * @brief display , modify and add document_type for follow up
+ * @see include/ajax/ajax_cfgaction.php
+ * @see include/cfg_action.inc.php
+ */
+class Action_Document_Type_MTable extends Manage_Table_SQL
+{
+
+ private $other; //!< Other value
+
+ public function __construct(Document_type_SQL $doc_type)
+ {
+ parent::__construct($doc_type);
+ $this->set_order(["dt_id", "dt_prefix", "dt_value",]);
+ $this->set_property_updatable("dt_id", false);
+ $this->set_property_visible("dt_id", false);
+ $this->set_property_updatable("dt_value", true);
+ $this->set_property_updatable("dt_prefix", true);
+ $this->set_col_label("dt_value", _("Nom"));
+ $this->set_col_label("dt_prefix", _("Préfixe document"));
+ $this->other=array();
+ }
+
+ /**
+ *
+ @code
+ table "public.document_type"
+ ctl_id "dtr"
+ gDossier "74"
+ op "cfgaction"
+ p_id "28"
+ action "save"
+ ctl "tbl5f785d403b123"
+ dt_prefix "ABO.HEB"
+ dt_value "Abonnements+PhpCompta"
+ seq "0"
+ det_op "1"
+ det_contact_mul "1"
+ update "OK"
+ @endcode
+ *
+ *
+ *
+ */
+ public function from_request()
+ {
+ $http=new HttpInput();
+ $this->table->dt_value=$http->request('dt_value');
+ $this->table->dt_prefix=$http->request('dt_prefix');
+ $this->other['detail_operation']=$http->request("detail_operation", "string", 0);
+ $this->other['contact_multiple']=$http->request("det_contact_mul", "string", 0);
+ $this->other['make_invoice']=$http->request("make_invoice", "string", 0);
+ $this->other['seq']=$http->request("seq", "string", 0);
+ $this->other['select_option_operation']=$http->request("select_option_operation", "string", null);
+ $this->other["cor_id"]=$http->request("cor_id","array",[]);
+ $nb_corid=count($this->other["cor_id"]);
+ $http->set_empty(0);
+ for ($i=0;$i<$nb_corid;$i++) {
+ $this->other["contact_option$i"]=$http->request("contact_option".$i,"number",0);
+ }
+
+ }
+
+ /**
+ *
+ */
+ public function check()
+ {
+ $table=$this->get_table();
+ $error=0;
+ if (empty(trim($table->dt_value)))
+ {
+ $this->set_error("dt_value", _("Nom ne peut être vide"));
+ $error++;
+ }
+ if (empty(trim($table->dt_prefix)))
+ {
+ $this->set_error("dt_prefix", _("Préfixe ne peut être vide"));
+ $error++;
+ }
+ // Check doublon
+ if ($table->cn->get_value('select count(*) from document_type where upper(dt_value)=upper($1) and dt_id <> $2',
+ [$table->dt_value, $table->dt_id])>0)
+ {
+ $this->set_error("dt_value", _("Doublon, ce nom existe déjà "));
+ $error++;
+ }
+ // Check doublon
+ if ($table->cn->get_value('select count(*) from document_type where upper(dt_prefix)=upper($1) and dt_id <> $2',
+ [$table->dt_prefix, $table->dt_id])>0)
+ {
+ $this->set_error("dt_value", _("Doublon, ce préfixe existe déjà "));
+ $error++;
+ }
+ if ($error>0)
+ return false;
+ return true;
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ function delete()
+ {
+ $table=$this->get_table();
+ try
+ {
+ // remove the cat if no action
+ $count_md=$table->cn->get_value('select count(*) from document_modele where md_type=$1',
+ array($table->dt_id));
+ $count_a=$table->cn->get_value('select count(*) from action_gestion where ag_type=$1', array($table->dt_id));
+
+ if ($count_md!=0||$count_a!=0)
+ {
+ throw new Exception(_('Des actions dépendent de cette catégorie'), 1300);
+ }
+ $table->delete();
+ }
+ catch (Exception $exc)
+ {
+ if ($exc->getCode()!=1300)
+ {
+ record_log("ADTM01".$exc->getTrace());
+ }
+ throw new Exception($exc->getMessage());
+ }
+ }
+
+ /**
+ * @brief display the box for adding, the name for p_id , are in the form
+ */
+ function input()
+ {
+ parent::input();
+
+
+
+ // Detail option contact
+ $table=$this->get_table();
+ $cn=$table->cn;
+ // insert new contact options
+ $cn->exec_sql("insert into jnt_document_option_contact (jdoc_enable,document_type_id,
+ contact_option_ref_id)
+ select 0 , $1, cor_id
+ from contact_option_ref
+ where
+ cor_id not in (select cor_id from
+ jnt_document_option_contact a
+ where a.document_type_id=$1)",[$table->dt_id]);
+
+ // Select all
+
+ $aOption=$cn->get_array("select cor_id,cor_label,cor_type,document_type_id ,coalesce(jdoc_enable,0) jdoc_enable
+ from
+ contact_option_ref cor
+ left join jnt_document_option_contact jdoc on (cor_id=contact_option_ref_id)
+ where
+ document_type_id is null
+ or document_type_id = $1
+ order by cor_label",[$this->table->dt_id]);
+
+ // Detail option
+ require NOALYSS_TEMPLATE."/action_document_type_mtable_input.php";
+ }
+
+ /**
+ * save
+ */
+ function save()
+ {
+ parent::save();
+ $cn=Dossier::connect();
+ $object_sql=$this->get_table();
+ // restart sequence
+ if ($this->other['seq']!=0)
+ {
+ $doc_type=new Document_type($cn, $object_sql->dt_id);
+ $doc_type->set_number($this->other['seq']);
+ }
+ // Save detail operation
+ $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable,do_option) values ($1,$2,$3,$4)
+ on conflict on constraint document_option_un
+ do update set do_enable=$3,do_option=$4", ["detail_operation",
+ $object_sql->dt_id,
+ $this->other['detail_operation'],
+ $this->other['select_option_operation']
+ ]);
+
+ // Save contact_multiple
+ $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3)
+ on conflict on constraint document_option_un
+ do update set do_enable=$3 ", ["contact_multiple", $object_sql->dt_id, $this->other['contact_multiple']]);
+
+ // Save make invoice
+ $cn->exec_sql("insert into document_option (do_code,document_type_id,do_enable) values ($1,$2,$3)
+ on conflict on constraint document_option_un
+ do update set do_enable=$3 ", ["make_invoice", $object_sql->dt_id, $this->other['make_invoice']]);
+
+ // Option contact to save
+ $cn->exec_sql("delete from jnt_document_option_contact where document_type_id=$1",[$object_sql->dt_id]);
+ $nb_contact_option=count($this->other["cor_id"]);
+ $aOption=$this->other["cor_id"];
+ for ( $e=0;$e<$nb_contact_option;$e++) {
+ $option_id=$aOption[$e];
+ if ( isset($this->other["contact_option".$e]) ) {
+ $cn->exec_sql("insert into jnt_document_option_contact
+ (jdoc_enable,document_type_id,contact_option_ref_id)
+ values ($1,$2,$3)",[$this->other["contact_option".$e],$object_sql->dt_id,$option_id]);
+ }
+ }
+
+ }
+
+}
diff --git a/include/class/card_attribut_mtable.class.php b/include/class/card_attribut_mtable.class.php
new file mode 100644
index 000000000..7b468f41f
--- /dev/null
+++ b/include/class/card_attribut_mtable.class.php
@@ -0,0 +1,199 @@
+
+
+/**
+ * @file
+ * @brief manage the table attr_def
+ * @see card_attr.inc.php
+ */
+require_once NOALYSS_INCLUDE."/class/fiche_attr.class.php";
+require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
+require_once NOALYSS_INCLUDE."/lib/inplace_switch.class.php";
+
+class Card_Attribut_MTable extends Manage_Table_SQL
+{
+
+ function __construct(\Data_SQL $p_table)
+ {
+ parent::__construct($p_table);
+ $this->set_property_visible("ad_id", TRUE);
+ $this->set_property_updatable("ad_id", FALSE);
+ $this->set_col_label("ad_text", _("Nom"));
+ $this->set_col_label("ad_type", _("Type"));
+ $this->set_col_label('ad_size', _("Taille"));
+ $this->set_col_label("ad_extra", _("Option sup."));
+ $this->set_col_label("ad_search_followup", _("Recherche suivi"));
+
+ $this->set_col_type("ad_search_followup", "custom");
+ $this->set_col_type("ad_text", "custom");
+ $this->set_col_type("ad_size", "numeric");
+ $this->set_col_type("ad_extra", "text");
+ $this->set_col_type("ad_type", "select",
+ array(
+ ["value"=>"text", "label"=>_("Texte")],
+ ["value"=>"date", "label"=>_("Date")],
+ ["value"=>"numeric", "label"=>_("Nombre")],
+ ["value"=>"select", "label"=>_("Choix")],
+ ["value"=>"card", "label"=>_("Fiche")],
+ ["value"=>"zone", "label"=>_("Zone de texte")],
+ ["value"=>"check", "label"=>_("Coche")],
+ ["value"=>"poste", "label"=>_("Poste comptable")]
+ ));
+ $this->set_col_tips("ad_search_followup", 77);
+ // to prevent a call to this function for each row
+ $this->dossier_id=Dossier::id();
+ $this->set_col_sort(1);
+ }
+
+ /**
+ * Display row of table attr_def
+ * @param array $row
+ */
+ function display_row($row)
+ {
+ tracedebug("card_attribute.log", $row);
+ if ($row['ad_id']>=9000)
+ {
+ $this->set_delete_row(TRUE);
+ $this->set_update_row(TRUE);
+ }
+ else
+ {
+ $this->set_delete_row(FALSE);
+ $this->set_update_row(FALSE);
+ }
+
+ parent::display_row($row);
+ }
+
+ /**
+ * For the type custom , we can call a function to display properly the value
+ * @param $p_key string key name
+ * @param $p_value string value
+ * @see input_custom
+ * @see set_type
+ * @note must return a string which will be in surrounded by td in the function display_row
+ * @return string
+ */
+ function display_row_custom($p_key, $p_value, $p_id=0)
+ {
+ if ($p_key=="ad_search_followup")
+ {
+ $ic=new Inplace_Switch(uniqid("search_follow_up"), $p_value);
+ $ic->set_callback("ajax_misc.php");
+ $ic->add_json_param("op", "card");
+ $ic->add_json_param("gDossier", $this->dossier_id);
+ $ic->add_json_param("op2", "attribute");
+ $ic->add_json_param("action", "enable_search");
+ $ic->add_json_param("ad_id", $p_id);
+ $ic->add_json_param("ctl", $p_id);
+ $ret=$ic->input();
+
+ return $ret;
+ }
+ if ($p_key == "ad_text"){
+ return $p_value;
+ }
+ return;
+ }
+
+ /**
+ * For the type custom , we can call a function to display properly the value
+ * @param $p_key string key name
+ * @param $p_value string value
+ * @see input_custom
+ * @see set_type
+ * @note must return a string which will be in surrounded by td in the function display_row
+ * @return string
+ */
+ function input_custom($p_key, $p_value)
+ {
+ if ($p_key=="ad_search_followup")
+ {
+ $p_id=$this->get_table()->get("ad_id");
+ $ic=new InputSwitch("ad_search_followup", $p_value);
+ echo $ic->input();
+ }
+ /**
+ * Bug in firefox if id=ad_text , the widget is not displaid
+ */
+ if ( $p_key == "ad_text")
+ {
+ $text=new IText("ad_text",$p_value);
+ $text->id=uniqid();
+ echo $text->input();
+ }
+ echo "";
+ return;
+ }
+
+ function check()
+ {
+ $nb_error=0;
+ $object_sql=$this->get_table();
+
+ if ($object_sql->get("ad_id")<9000 && $object_sql->get("ad_id")!=-1)
+ {
+ $this->set_error("ad_id",_("Bloqué"));
+ return false;
+ }
+
+ // Duplicate
+ $count="select count(*)
+ from attr_def as ad1
+ where
+ upper(trim(ad1.ad_text)) = upper(trim($1))
+ and ad1.ad_id != $2
+ ";
+ $count_duplicate=$object_sql->cn->get_value($count, [$object_sql->ad_text, $object_sql->ad_id]);
+ if ($count_duplicate>0)
+ {
+ $this->set_error("ad_text", _("Doublon"));
+ $nb_error++;
+ }
+
+ // Name empty
+ if (trim($object_sql->ad_text)=="")
+ {
+ $this->set_error("ad_text", _("Description ne peut pas être vide"));
+ $nb_error++;
+ }
+ // select protect
+
+
+ if ($nb_error>0)
+ return false;
+ return true;
+ }
+
+ function delete() {
+ $object_sql=$this->get_table();
+ $db=$object_sql->cn;
+ try {
+ $db->start();
+ $object_sql=$this->get_table()->delete();
+ $db->commit();
+ } catch (Exception $ex) {
+ $db->rollback();
+ throw new Exception (_("Effacement bloqué : attribut utilisé"));
+ }
+ }
+}
diff --git a/include/class/card_multiple.class.php b/include/class/card_multiple.class.php
new file mode 100644
index 000000000..60ed305b0
--- /dev/null
+++ b/include/class/card_multiple.class.php
@@ -0,0 +1,164 @@
+
+
+/**
+ * @file
+ * @brief in follow-up , add multiple cards to an event, an action
+ */
+class Card_Multiple
+{
+ private $sql ; //!< SQL with the right column name
+ function __construct()
+ {
+ $this->sql="select f_id,quick_code,vw_name,accounting,vw_first_name,vw_description,
+ (select ad_value from fiche_detail fd where fd.f_id=vw_fiche_attr.f_id and fd.ad_id=25) as company
+ from vw_fiche_attr ";
+ }
+ /**
+ *
+ * @param type $sql_array
+ * @return type
+ */
+ function build_sql($sql_array)
+ {
+ $cn=Dossier::connect();
+ $filter="";
+ if ( $sql_array["inactive_card"]==0) {
+ $filter=" and ".$this->filter_enable_card();
+ }
+ // By Cat of card
+ $sql_cat="";
+ if ( $sql_array['search_cat']!=-1) {
+ $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']);
+ }
+ $query=sql_string($sql_array['query']);
+ if ( $sql_array['search_in'] == "-1")
+ {
+ $string_sql=$this->sql."
+ where
+ (vw_name ilike '%$query%'
+ or quick_code ilike '%$query%')
+ ".$filter.$sql_cat."
+ order by vw_name
+ limit
+ ".MAX_CARD_SEARCH;
+ } else {
+ $string_sql=sprintf($this->sql." where f_id in (select f_id from fiche_detail where
+ ad_id = '%s' and ad_value ilike '%%%s%%') %s %s"
+ , sql_string($sql_array["search_in"]),$query,$filter,$sql_cat);
+ }
+ return $string_sql;
+ }
+ /**
+ *
+ * @param type $sql_array
+ * @return type
+ */
+ function count_sql($sql_array)
+ {
+ $cn=Dossier::connect();
+ $query=sql_string($sql_array['query']);
+ $filter="";
+ if ( $sql_array["inactive_card"]==0) {
+ $filter="and ".$this->filter_enable_card();
+ }
+ // By Cat of card
+ $sql_cat="";
+ if ( $sql_array['search_cat']!=-1) {
+ $sql_cat=' and fd_id = '.sql_string($sql_array['search_cat']);
+ }
+
+ $string_sql="select count(*)
+ from vw_fiche_attr
+ where
+ ( vw_name ilike '%$query%'
+ or quick_code ilike '%$query%')
+ ".$filter.$sql_cat;
+
+
+ return $cn->get_value($string_sql);
+ }
+ /**
+ *
+ * @return string
+ */
+ private function filter_enable_card()
+ {
+ $filter_enable_card=" f_id in (select f_id from fiche_detail where ad_value = '1' and ad_id=54) ";
+ return $filter_enable_card;
+ }
+ /**
+ *
+ * @global type $g_user
+ * @param type $ap_id
+ * @return type
+ */
+ function display_option($p_action_person_id)
+ {
+ global $g_user;
+ $cn=Dossier::connect();
+ // retrieve card id (fiche.f_id) and the ag_id (action_gestion.ag_id)
+ $tmp=$cn->get_row("select f_id,ag_id from action_person where ap_id=$1 ", [$p_action_person_id]);
+ if ($tmp==NULL)
+ {
+ record_log("CMDO.01nothing found ".var_export($_REQUEST, true));
+ return;
+ }
+ $fiche_id=$tmp['f_id'];
+ $ag_id=$tmp['ag_id'];
+ if ( ! $g_user->can_read_action($ag_id)) {
+ throw new Exception (_("CMCDO01"."Security"));
+ }
+ // Retrieve Name, first Name and QCODE
+ $aIdentity=$cn->get_row("select (select ad_value from fiche_detail where f_id=$1 and ad_id=1) as name ,
+ (select ad_value from fiche_detail where f_id=$1 and ad_id=32) as first_name ,
+ (select ad_value from fiche_detail where f_id=$1 and ad_id=23) as qcode ",[$fiche_id]);
+
+ // insert new , synchronized
+ $cn->exec_sql("insert into action_person_option (ap_value,contact_option_ref_id ,action_person_id )
+ select null,cor_id,$1
+ from contact_option_ref
+ where
+ cor_id not in (
+ select contact_option_ref_id
+ from action_person_option
+ join action_person a on (a.ap_id=action_person_id)
+ where f_id=$2)",[$p_action_person_id,$fiche_id]);
+
+ // delete disable
+ $cn->exec_sql("delete
+ from action_person_option apo
+ where contact_option_ref_id in
+ (select contact_option_ref_id from jnt_document_option_contact jdoc join action_gestion on (ag_type=document_type_id)
+ where ag_id=$1 and jdoc_enable=0)",[$ag_id]);
+
+ // First select the option
+ $sql="select ap_id,cor_id,ap_value,cor_type ,cor_label,cor_value_select
+ from contact_option_ref cor
+ join action_person_option apo on (cor.cor_id=apo.contact_option_ref_id)
+ where action_person_id=$1 order by cor_label ";
+
+ $a_option=$cn->get_array($sql,[$p_action_person_id]);
+ require NOALYSS_TEMPLATE."/card_multiple_display_option.php";
+
+ }
+
+}
diff --git a/include/class/contact_option_ref_mtable.class.php b/include/class/contact_option_ref_mtable.class.php
new file mode 100644
index 000000000..b6a62f9da
--- /dev/null
+++ b/include/class/contact_option_ref_mtable.class.php
@@ -0,0 +1,50 @@
+
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+// Copyright (2002-2020) Author Dany De Bontridder
+
+
+/**
+ * @file
+ * @brief
+ * @todo to be implemented
+ */
+require_once NOALYSS_INCLUDE."/database/contact_option_ref_sql.class.php";
+require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
+
+class Contact_Option_Ref_MTable extends Manage_Table_SQL{
+
+ function __construct(Contact_Option_Ref_SQL $obj)
+ {
+ parent::__construct($obj);
+ $this->set_col_label("cor_label", _("Nom"));
+ $this->set_col_label("cor_type", _("Type "));
+ $this->set_col_label("document_option_id", _("Action"));
+ $this->set_col_label("cor_value_select",_("Options"));
+ $this->set_property_visible("cor_id", false);
+ $this->set_col_type("cor_type","select",[
+ ["label"=>_("Texte"),"value"=>0],
+ ["label"=>_("Nombre"),"value"=>1],
+ ["label"=>_("Choix"),"value"=>3],
+ ["label"=>_("Date"),"value"=>2],
+ ["label"=>_("Coche"),"value"=>4]
+ ]);
+ }
+
+}
diff --git a/include/class/document.class.php b/include/class/document.class.php
index a58f1de64..2752d8827 100644
--- a/include/class/document.class.php
+++ b/include/class/document.class.php
@@ -533,6 +533,10 @@ class Document
* - [TITLE]
* - [DESCRIPTION]
* - [COMM_PAYMENT]
+ * - [LABELOP]
+ * - [COMMENT]
+ * - [DESCRIPTION]
+ * - [DOCUMENT_ID]
*
* \param $p_tag TAG
* \param $p_array data from $_POST
@@ -789,6 +793,10 @@ class Document
case 'NUMBER':
$r=$this->d_number;
break;
+ case "DOCUMENT_ID":
+ if (isset($p_array['ag_id'])) return $p_array['ag_id'];
+ return "";
+ break;
case 'USER' :
return $_SESSION['use_name'].', '.$_SESSION['use_first_name'];
@@ -814,16 +822,17 @@ class Document
* - [DATE_LIMIT]
*/
case 'DATE_LIMIT_CALC':
- extract ($p_array, EXTR_SKIP);
- $id='e_ech' ;
- if ( !isset (${$id}) ) return "";
- $r=format_date(${$id},'DD.MM.YYYY','YYYY-MM-DD');
- break;
+ if ( isset ($p_array["e_ech"] ))
+ return format_date($p_array["ech"],'DD.MM.YYYY','YYYY-MM-DD');
+ if ( isset ($p_array["ag_remind_date"] ))
+ return format_date($p_array["ag_remind_date"],'DD.MM.YYYY','YYYY-MM-DD');
+
+ break;
case 'DATE_LIMIT':
- extract ($p_array, EXTR_SKIP);
- $id='e_ech' ;
- if ( !isset (${$id}) ) return "";
- $r=${$id};
+ if ( isset ($p_array["e_ech"] ))
+ return $p_array["ech"];
+ if ( isset ($p_array["ag_remind_date"] ))
+ return $p_array["ag_remind_date"];
break;
case 'MARCH_NEXT':
$this->counter++;
@@ -1130,7 +1139,7 @@ class Document
else
return "";
break;
- case 'COMMENT':
+ case 'LABELOP':
if ( isset($p_array['e_comm']))
return $p_array['e_comm'];
break;
@@ -1160,9 +1169,36 @@ class Document
$ret=$this->db->get_value('select r_phone from public.stock_repository where r_id=$1',array($p_array['repo']));
return $ret;
case 'TITLE':
- $http=new HttpInput();
- $title=$http->request("ag_title","string", "");
- return $title;
+ if ( isset($p_array['ag_title'])) return $p_array['ag_title'];
+ return "";
+ break;
+ case 'DESCRIPTION':
+ if ( isset($p_array['ag_id'])) {
+ // retrieve first comment
+ $description=$this->db->get_value("select agc_comment "
+ . " from action_gestion_comment "
+ . "where ag_id=$1 order by 1 asc limit 1"
+ ,[$p_array['ag_id']]);
+ return $description;
+ }
+ return "";
+ break;
+ case 'COMMENT':
+ if ( isset($p_array['ag_id'])) {
+ // retrieve first comment
+ $aComment=$this->db->get_array("select agc_comment "
+ . " from action_gestion_comment "
+ . "where ag_id=$1 order by 1"
+ ,[$p_array['ag_id']]);
+ $nb_comment=count($aComment);
+ $description="";
+ for ($i=0;$i< $nb_comment;$i++) {
+ $description.=$aComment[$i]['agc_comment']."\n";
+ }
+ return $description;
+ }
+ return "";
+ break;
case 'COMM_PAYMENT':
if ( isset($p_array["e_comm_paiement"])) {
return $p_array["e_comm_paiement"];
diff --git a/include/class/document_option.class.php b/include/class/document_option.class.php
new file mode 100644
index 000000000..cc5553356
--- /dev/null
+++ b/include/class/document_option.class.php
@@ -0,0 +1,102 @@
+
+
+/**
+ * @file
+ * @brief
+ */
+
+/**
+ * @class
+ * @brief
+ */
+class Document_Option
+{
+
+ /**
+ * returns true if the operation_detail is enable, otherwise false
+ *
+ * @param int $p_document_type Document_Type.dt_id
+ * @return boolean
+ */
+ static function is_enable_operation_detail($p_document_type)
+ {
+ $display_operation=false;
+ $cn=Dossier::connect();
+ if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
+ [$p_document_type, 'detail_operation'])=='1')
+ {
+ $display_operation=true;
+ }
+ return $display_operation;
+ }
+ /**
+ * returns option from the operation_detail
+ *
+ * @param int $p_document_type Document_Type.dt_id
+ * @return string
+ */
+ static function option_operation_detail($p_document_type)
+ {
+ $cn=Dossier::connect();
+ $option_operation = $cn->get_value("select do_option from document_option where document_type_id=$1 "
+ . " and do_code = $2",
+ [$p_document_type, 'detail_operation']);
+ return $option_operation;
+ }
+
+ /**
+ * returns true if the operation_detail is enable, otherwise false
+ *
+ * @param int $p_document_type Document_Type.dt_id
+ * @return boolean
+ */
+ static function is_enable_contact_multiple($p_document_type)
+ {
+ $return=false;
+ $cn=Dossier::connect();
+ if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
+ [$p_document_type, 'contact_multiple'])=='1')
+ {
+ $return=true;
+ }
+ return $return;
+ }
+
+ /**
+ * returns true if the operation_detail is enable, otherwise false
+ *
+ * @param int $p_document_type Document_Type.dt_id
+ * @return boolean
+ */
+ static function is_enable_make_invoice($p_document_type)
+ {
+ $return=false;
+ $cn=Dossier::connect();
+ if ($cn->get_value("select do_enable from document_option where document_type_id=$1 and do_code = $2",
+ [$p_document_type, 'make_invoice'])=='1')
+ {
+ $return=true;
+ }
+ return $return;
+ }
+
+}
diff --git a/include/class/document_type.class.php b/include/class/document_type.class.php
index 8f0d2fbf1..946202604 100644
--- a/include/class/document_type.class.php
+++ b/include/class/document_type.class.php
@@ -23,7 +23,9 @@
* \brief class for the table document_type
*/
-/** \brief class for the table document_type
+/** \
+ *@brief class for the table document_type , a document_type is a kind of action in the follow up
+ *
* < dt_id pk document_type
* < dt_value value
*/
@@ -91,40 +93,10 @@ class Document_type
return $array;
}
- function insert($p_value, $p_prefix)
- {
- $sql = "insert into document_type(dt_value,dt_prefix) values ($1,$2)";
- try
- {
- if ($this->db->count_sql('select * from document_type where upper(dt_value)=upper(trim($1))', array($p_value)) > 0)
- throw new Exception('Nom en double');
- if (strlen(trim($p_value)) > 0)
- $this->db->exec_sql($sql, array($p_value, $p_prefix));
- }
- catch (Exception $e)
- {
- record_log($e);
- alert(j(_("Impossible d'ajouter [$p_value] ") . $e->getMessage()));
- }
- }
-
- /**
- * Update
- */
- function update()
- {
- try
- {
- $this->db->exec_sql("update document_type set dt_value=$1,dt_prefix=$2 where dt_id=$3", array($this->dt_value,
- $this->dt_prefix, $this->dt_id));
- }
- catch (Exception $e)
- {
- record_log($e);
- alert(" Erreur " . $e->getMessage());
- }
- }
-
+ /**
+ * Restart the increment of the document
+ * @param type $p_int
+ */
function set_number($p_int)
{
try
diff --git a/include/class/extension.class.php b/include/class/extension.class.php
index 5fad200ec..1b321fe60 100644
--- a/include/class/extension.class.php
+++ b/include/class/extension.class.php
@@ -251,6 +251,12 @@ class Extension extends Menu_Ref_sql
}
}
+ /**
+ * compare the version of the plugin and the last version , propose to update it if a new version exists
+ * @todo add a mechanism to check once a day
+ * @global User $g_user
+ * @global number $version_plugin
+ */
static function check_plugin_version()
{
global $g_user, $version_plugin;
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 214b100f8..98aee882c 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -29,6 +29,7 @@ require_once NOALYSS_INCLUDE.'/class/fiche_def.class.php';
require_once NOALYSS_INCLUDE.'/lib/iposte.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_account.class.php';
+require_once NOALYSS_INCLUDE."/lib/input_switch.class.php";
/*! \file
* \brief define Class fiche, this class are using
@@ -502,6 +503,11 @@ class Fiche
$w->table = 1;
$bulle = Icon_Action::infobulle(14);
break;
+ case 'check':
+ $w=new InputSwitch("av_text".$r->ad_id);
+ $w->value=$r->av_text;
+ $w->value=(trim($w->value)=="")?1:$w->value;
+ break;
case 'select':
$w = new ISelect("av_text" . $attr->ad_id);
$w->value = $this->cn->make_array($attr->ad_extra);
@@ -641,6 +647,11 @@ class Fiche
$w->style=' class="itextarea" style="margin:0px;width:100%"';
$w->value=$r->av_text;
break;
+ case 'check':
+ $w=new InputSwitch("av_text".$r->ad_id);
+ $w->value=$r->av_text;
+ $w->value=(trim($w->value)=="")?1:$w->value;
+ break;
case 'poste':
$w=new IPoste("av_text".$r->ad_id);
$w->set_attribute('ipopup', 'ipop_account');
@@ -711,6 +722,11 @@ class Fiche
$value=$x->display();
$w->value=$value;
break;
+ case 'check':
+ $w=new InputSwitch("av_text".$r->ad_id);
+ $w->value=$r->av_text;
+ $w->value=(trim($w->value)=="")?1:$w->value;
+ break;
default:
$w->value=$r->av_text;
}
@@ -2131,8 +2147,9 @@ class Fiche
{
$query=sql_string($query);
- if (strlen(trim($query))>1)
+ if (strlen(trim($query))>0)
{
+ $query=str_replace(" ", "%", $query);
$filter_query=$and."(vw_name ilike '%$query%' or quick_code ilike ('%$query%') "
." or vw_description ilike '%$query%' or tva_num ilike '%$query%' or accounting like upper('$query%'))";
}
diff --git a/include/class/fiche_attr.class.php b/include/class/fiche_attr.class.php
index c764731e5..ee7184195 100644
--- a/include/class/fiche_attr.class.php
+++ b/include/class/fiche_attr.class.php
@@ -1,286 +1,165 @@
column_name,"email"=>"column_name_email","val3"=>0); */
- protected $variable=array("id"=>"ad_id","desc"=>"ad_text","type"=>"ad_type","size"=>"ad_size","extra"=>"ad_extra");
- function __construct ($p_cn,$p_id=0)
+ function __construct($p_cn, $p_id=0)
{
- $this->cn=$p_cn;
- if ( $p_id == 0 )
- {
- /* Initialize an empty object */
- foreach ($this->variable as $key=>$value) $this->$value='';
- }
- else
- {
- /* load it */
- $this->ad_id=$p_id;
- $this->load();
- }
+ parent::__construct($p_cn, $p_id);
}
+
public function get_parameter($p_string)
{
- if ( array_key_exists($p_string,$this->variable) )
- {
- $idx=$this->variable[$p_string];
- return $this->$idx;
- }
- else
- throw new Exception (__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant');
+ return $this->getp($p_string);
}
- public function set_parameter($p_string,$p_value)
+
+ public function set_parameter($p_string, $p_value)
{
- if ( array_key_exists($p_string,$this->variable) )
- {
- $idx=$this->variable[$p_string];
- $this->$idx=$p_value;
- }
- else
- throw new Exception (__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant');
- }
- public function get_info()
- {
- return var_export($this,true);
+ $this->setp($p_string, $p_value);
}
+
public function verify()
{
// Verify that the elt we want to add is correct
/* verify only the datatype */
- if ( strlen(trim($this->ad_text))==0)
- throw new Exception('La description ne peut pas être vide',1);
- if ( strlen(trim($this->ad_type))==0)
- throw new Exception('Le type ne peut pas être vide',1);
+ if (strlen(trim($this->ad_text))==0)
+ throw new Exception('La description ne peut pas être vide', 1);
+ if (strlen(trim($this->ad_type))==0)
+ throw new Exception('Le type ne peut pas être vide', 1);
$this->ad_type=strtolower($this->ad_type);
- if ( in_array($this->ad_type,array('date','text','numeric','zone','poste','card','select'))==false)
- throw new Exception('Le type doit être text, numeric,poste, card, select ou date',1);
- if ( trim($this->ad_size)=='' || isNumber($this->ad_size)==0||$this->ad_size>22)
+ if (in_array($this->ad_type, array('date', 'text', 'numeric', 'zone', 'poste', 'card', 'select','check'))==false)
+ throw new Exception('Le type doit être text, numeric,poste, card, select ou date', 1);
+ if (trim($this->ad_size)==''||isNumber($this->ad_size)==0||$this->ad_size>22)
{
switch ($this->ad_type)
{
- case 'text':
+ case 'text':
$this->ad_size=22;
- break;
- case 'numeric':
- $this->ad_size=9;
- break;
- case 'date':
- $this->ad_size=8;
- break;
- case 'zone':
- $this->ad_size=22;
- break;
+ break;
+ case 'numeric':
+ $this->ad_size=9;
+ break;
+ case 'date':
+ $this->ad_size=8;
+ break;
+ case 'zone':
+ $this->ad_size=22;
+ break;
- default:
- $this->ad_size=22;
+ default:
+ $this->ad_size=22;
}
}
- if ( $this->ad_type == 'numeric' ) {
- $this->ad_extra=(trim($this->ad_extra)=='')?'2':$this->ad_extra;
- if (isNumber($this->ad_extra) == 0) throw new Exception ("La précision doit être un chiffre");
-
- }
- if ( $this->ad_type == 'select')
+ if ($this->ad_type=='numeric')
{
- if (trim($this->ad_extra)=="") throw new Exception ("La requête SQL est vide ");
- if ( preg_match('/^\h*select/i',$this->ad_extra) == 0) throw new Exception ("La requête SQL doit commencer par SELECT ");
- try{
-
- $this->cn->exec_sql($this->ad_extra);
- }catch (Exception $e)
- {
- record_log($e);
- throw new Exception ("La requête SQL ".h($this->ad_extra)." est invalide ");
- }
+ $this->ad_extra=(trim($this->ad_extra)=='')?'2':$this->ad_extra;
+ if (isNumber($this->ad_extra)==0)
+ throw new Exception("La précision doit être un chiffre");
}
- }
- public function save()
- {
-
- /* please adapt */
- if ( $this->ad_id == 0 )
- $this->insert();
- else
- $this->update();
- }
- /**
- *@brief retrieve array of object thanks a condition
- *@param $cond condition (where clause)
- *@param $p_array array for the SQL stmt
- *@see Database::get_array
- *@return an empty array if nothing is found
- */
- public function seek($cond='',$p_array=null)
- {
- if ( $cond != '')
- $sql="select * from attr_def where $cond order by ad_text";
- else
- $sql="select * from attr_def order by ad_text";
-
- $aobj=array();
- $array= $this->cn->get_array($sql,$p_array);
- // map each row in a object
- $size=$this->cn->count();
- if ( $size == 0 ) return $aobj;
- for ($i=0;$i<$size;$i++)
+ if ($this->ad_type=='select')
{
- $oobj=new Fiche_Attr ($this->cn);
- foreach ($array[$i] as $idx=>$value)
+ if (trim($this->ad_extra)=="")
+ throw new Exception("La requête SQL est vide ");
+ if (preg_match('/^\h*select/i', $this->ad_extra)==0)
+ throw new Exception("La requête SQL doit commencer par SELECT ");
+ try
{
- $oobj->$idx=$value;
+
+ $this->cn->exec_sql($this->ad_extra);
+ }
+ catch (Exception $e)
+ {
+ record_log($e);
+ throw new Exception("La requête SQL ".h($this->ad_extra)." est invalide ");
}
- $aobj[]=clone $oobj;
}
- return $aobj;
}
- public function insert()
- {
- try{
- $this->verify();
- /* please adapt */
- $sql="insert into attr_def(ad_text
- ,ad_type,ad_size,ad_extra
- ) values ($1
- ,$2,$3,$4
- ) returning ad_id";
- $this->ad_id=$this->cn->get_value(
- $sql,
- array( $this->ad_text,$this->ad_type,$this->ad_size,$this->ad_extra
- )
- );
- } catch (Exception $e)
- {
- record_log($e);
- throw $e;
- }
-
- }
public function update()
{
try
{
- $this->verify();
- if ( $this->ad_id < 9000) return;
- /* please adapt */
- $sql=" update attr_def set ad_text = $1
- ,ad_type = $2,ad_size=$4,ad_extra=$5
- where ad_id= $3";
- $res=$this->cn->exec_sql(
- $sql,
- array($this->ad_text
- ,$this->ad_type
- ,$this->ad_id,$this->ad_size,$this->ad_extra)
- );
- }catch (Exception $e)
+ $this->verify();
+ if ($this->ad_id<9000)
+ return;
+ /* please adapt */
+ parent::update();
+ }
+ catch (Exception $e)
{
- record_log($e);
+ record_log($e);
throw $e;
}
-
-
- }
- /**
- *@brief load a object
- *@return 0 on success -1 the object is not found
- */
- public function load()
- {
-
- $sql="select ad_text
- ,ad_type,ad_size,ad_extra
- from attr_def where ad_id=$1";
- /* please adapt */
- $res=$this->cn->get_array(
- $sql,
- array($this->ad_id)
- );
-
- if ( count($res) == 0 )
- {
- /* Initialize an empty object */
- foreach ($this->variable as $key=>$value) $this->$key='';
-
- return -1;
- }
- foreach ($res[0] as $idx=>$value)
- {
- $this->$idx=$value;
- }
- return 0;
}
public function delete()
{
- if ($this->ad_id < 9000) return;
- $sql=$this->cn->exec_sql("delete from fiche_detail where ad_id=$1 ",
- array($this->ad_id));
+ if ($this->ad_id<9000)
+ return;
+ $sql=$this->cn->exec_sql("delete from fiche_detail where ad_id=$1 ", array($this->ad_id));
- $sql="delete from jnt_fic_attr where ad_id=$1";
- $res=$this->cn->exec_sql($sql,array($this->ad_id));
+ $sql="delete from jnt_fic_attr where ad_id=$1";
+ $res=$this->cn->exec_sql($sql, array($this->ad_id));
$sql="delete from attr_def where ad_id=$1";
- $res=$this->cn->exec_sql($sql,array($this->ad_id));
-
+ $res=$this->cn->exec_sql($sql, array($this->ad_id));
}
- /**
- * Unit test for the class
+
+ /* !
+ * @brief used with a usort function, to sort an array of Attribut on the attribut_id (ad_id)
*/
- static function test_me()
+
+ static function sort_by_id($o1, $o2)
{
- $cn=new Database(25);
- $cn->start();
- echo h2info('Test object vide');
- $obj=new Fiche_Attr($cn);
- var_dump($obj);
-
- echo h2info('Test object NON vide');
- $obj->set_parameter('j_id',3);
- $obj->load();
- var_dump($obj);
-
- echo h2info('Update');
- $obj->set_parameter('j_qcode','NOUVEAU CODE');
- $obj->save();
- $obj->load();
- var_dump($obj);
-
- echo h2info('Insert');
- $obj->set_parameter('j_id',0);
- $obj->save();
- $obj->load();
- var_dump($obj);
-
- echo h2info('Delete');
- $obj->delete();
- echo (($obj->load()==0)?'Trouve':'non trouve');
- var_dump($obj);
- $cn->rollback();
-
- }
- /*!
- *@brief used with a usort function, to sort an array of Attribut on the attribut_id (ad_id)
- */
- static function sort_by_id($o1,$o2)
- {
- if ( $o1->ad_id > $o2->ad_id ) return 1;
- if ( $o1->ad_id == $o2->ad_id ) return 0;
+ if ($o1->ad_id>$o2->ad_id)
+ return 1;
+ if ($o1->ad_id==$o2->ad_id)
+ return 0;
return -1;
}
+ public function save()
+ {
+ /* please adapt */
+ if ($this->ad_id < 1)
+ {
+ $this->ad_id=-1;
+ $this->insert();
+ }
+ else
+ $this->update();
+ }
+ public function to_array($prefix="")
+ {
+
+ $array=array();
+ foreach ($this->name as $key=> $value)
+ {
+ $nkey=$prefix.$value;
+ $array[$nkey]=$this->$value;
+// $nkey=$prefix.$key;
+// $array[$nkey]=$this->$value;
+//
+ }
+ tracedebug("card_attribute.log",$array);
+ return $array;
+ }
}
+
//Fiche_Attr::test_me();
diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php
index 48ad1e2ea..b04bc903e 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -31,6 +31,7 @@ require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
require_once NOALYSS_INCLUDE.'/class/document.class.php';
require_once NOALYSS_INCLUDE.'/class/document_type.class.php';
require_once NOALYSS_INCLUDE.'/class/document_modele.class.php';
+require_once NOALYSS_INCLUDE.'/class/document_option.class.php';
require_once NOALYSS_INCLUDE.'/lib/user_common.php';
require_once NOALYSS_INCLUDE.'/class/follow_up_detail.class.php';
require_once NOALYSS_INCLUDE.'/lib/inum.class.php';
@@ -152,7 +153,7 @@ class Follow_Up
*
* \return string containing the html code
*/
- function Display($p_view, $p_gen, $p_base, $retour="")
+ function display($p_view, $p_gen, $p_base, $retour="")
{
global $g_user;
if ($p_view=='UPD')
@@ -164,7 +165,6 @@ class Follow_Up
{
$upd=false;
$readonly=false;
- $this->ag_ref=_("Nouveau");
}
elseif ($p_view=='READ')
{
@@ -175,6 +175,8 @@ class Follow_Up
{
throw new Exception('class_action'.__LINE__.'Follow_Up::Display error unknown parameter'.$p_view);
}
+
+
// Compute the widget
// Date
$date=new IDate();
@@ -387,7 +389,7 @@ class Follow_Up
$h_agrefid=new IHidden();
$iag_ref=new IText("ag_ref");
$iag_ref->value=$this->ag_ref;
- $iag_ref->readOnly=($p_view=="NEW"||$p_view=='READ')?true:false;
+ $iag_ref->readOnly=false;
$str_ag_ref=$iag_ref->input();
// Preparing the return string
$r="";
@@ -428,108 +430,9 @@ class Follow_Up
$text=new IText();
$num=new INum();
- /* TVA */
- $itva=new ITva_Popup($this->db);
- $itva->in_table=true;
- $aCard=array();
- /* create aArticle for the detail section */
- $article_count=(count($this->aAction_detail)==0)?MAX_ARTICLE:count($this->aAction_detail);
- /* Compute total */
- $tot_item=0;
- $tot_vat=0;
- for ($i=0; $i<$article_count; $i++)
- {
- /* fid = Icard */
- $icard=new ICard();
- $icard->jrn=0;
- $icard->table=0;
- $icard->noadd="no";
- $icard->extra='all';
- $icard->name="e_march".$i;
- $tmp_ad=(isset($this->aAction_detail[$i]))?$this->aAction_detail[$i]:false;
- $icard->readOnly=$readonly;
- $icard->value='';
- $aCard[$i]=0;
- if ($tmp_ad)
- {
- $march=new Fiche($this->db);
- $f=$tmp_ad->get_parameter('qcode');
- if ($f!=0)
- {
- $march->id=$f;
- $icard->value=$march->get_quick_code();
- $aCard[$i]=$f;
- }
- }
- $icard->set_dblclick("fill_ipopcard(this);");
- // name of the field to update with the name of the card
- $icard->set_attribute('label', "e_march".$i."_label");
- // name of the field to update with the name of the card
- $icard->set_attribute('typecard', $icard->extra);
- $icard->set_attribute('ipopup', 'ipopcard');
- $icard->set_function('fill_data');
- $icard->javascript=sprintf(' onchange="fill_data_onchange(\'%s\');" ', $icard->name);
-
- $aArticle[$i]['fid']=$icard->search().$icard->input();
-
- $text->javascript=' onchange="clean_tva('.$i.');compute_ledger('.$i.')"';
- $text->css_size="100%";
- $text->name="e_march".$i."_label";
- $text->id="e_march".$i."_label";
- $text->size=40;
- $text->value=($tmp_ad)?$tmp_ad->get_parameter('text'):"";
- $text->readOnly=$readonly;
- $aArticle[$i]['desc']=$text->input();
-
- $num->javascript=' onchange="format_number(this,4);clean_tva('.$i.');compute_ledger('.$i.')"';
- $num->name="e_march".$i."_price";
- $num->id="e_march".$i."_price";
- $num->size=8;
- $num->readOnly=$readonly;
- $num->value=($tmp_ad)?$tmp_ad->get_parameter('price_unit'):0;
- $aArticle[$i]['pu']=$num->input();
-
- $num->name="e_quant".$i;
- $num->id="e_quant".$i;
- $num->size=8;
- $num->value=($tmp_ad)?$tmp_ad->get_parameter('quantity'):0;
- $aArticle[$i]['quant']=$num->input();
-
- $itva->name='e_march'.$i.'_tva_id';
- $itva->id='e_march'.$i.'_tva_id';
- $itva->value=($tmp_ad)?$tmp_ad->get_parameter('tva_id'):0;
- $itva->readOnly=$readonly;
- $itva->js=' onchange="format_number(this);clean_tva('.$i.');compute_ledger('.$i.')"';
- $itva->set_attribute('compute', $i);
-
- $aArticle[$i]['tvaid']=$itva->input();
-
- $num->name="e_march".$i."_tva_amount";
- $num->id="e_march".$i."_tva_amount";
- $num->value=($tmp_ad)?$tmp_ad->get_parameter('tva_amount'):0;
- $num->javascript=" onchange=\"compute_ledger('".$i." ')\"";
- $num->size=8;
- $aArticle[$i]['tva']=$num->input();
- $tot_vat=bcadd($tot_vat,$num->value);
-
- $num->name="tvac_march".$i;
- $num->id="tvac_march".$i;
- $num->value=($tmp_ad)?$tmp_ad->get_parameter('total'):0;
- $num->size=8;
- $aArticle[$i]['tvac']=$num->input();
- $tot_item=bcadd($tot_item,$num->value);
-
- $aArticle[$i]['hidden_htva']=HtmlInput::hidden('htva_march'.$i, 0);
- $aArticle[$i]['hidden_tva']=HtmlInput::hidden('tva_march'.$i, 0);
- $aArticle[$i]['ad_id']=($tmp_ad)?HtmlInput::hidden('ad_id'.$i, $tmp_ad->get_parameter('id')):HtmlInput::hidden('ad_id'.$i, 0);
- }
-
/* Add the needed hidden values */
$r.=dossier::hidden();
- /* add the number of item */
- $Hid=new IHidden();
- $r.=$Hid->input("nb_item", $article_count);
$r.=HtmlInput::request_to_hidden(array("closed_action", "remind_date_end", "remind_date", "sag_ref", "only_internal", "state", "qcode", "ag_dest_query", "action_query", "tdoc", "date_start", "date_end", "hsstate", "searchtag"));
$a_tag=$this->tag_get();
$menu=new Default_Menu();
@@ -671,9 +574,10 @@ class Follow_Up
$this->ag_remind_date /* 13 */
)
);
-
+ $http=new HttpInput();
+ $nb_item=$http->post("nb_item","number",0);
/* insert also the details */
- for ($i=0; $i<$_POST['nb_item']; $i++)
+ for ($i=0; $i<$nb_item; $i++)
{
$act=new Follow_Up_Detail($this->db);
$act->from_array($_POST, $i);
@@ -712,7 +616,7 @@ class Follow_Up
$table->add('Date Doc.', $url, 'order by ag_timestamp asc', 'order by ag_timestamp desc', 'da', 'dd');
$table->add('Date Comm.', $url, 'order by last_comment', 'order by last_comment desc', 'dca', 'dcd');
$table->add('Date Limite', $url, 'order by ag_remind_date asc', 'order by ag_remind_date desc', 'ra', 'rd');
- $table->add('Tag', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad');
+ $table->add('Etiquette', $url, 'order by tags asc', 'order by tags desc', 'taa', 'tad');
$table->add('Réf.', $url, 'order by ag_ref asc', 'order by ag_ref desc', 'ra', 'rd');
$table->add('Groupe', $url, "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe')", "order by coalesce((select p_name from profile where p_id=ag_dest),'Aucun groupe') desc", 'dea', 'ded');
$table->add('Dest/Exp', $url, 'order by name asc', 'order by name desc', 'ea', 'ed');
@@ -762,7 +666,7 @@ class Follow_Up
$r.='
'.$table->get_header(0).'
';
$r.='
'.$table->get_header(1).'
';
$r.='
'.$table->get_header(2).'
';
- $r.='
'.$table->get_header(3).'
';
+ $r.='
'.$table->get_header(3).'
';
$r.='
'.$table->get_header(4).'
';
$r.='
'.$table->get_header(5).'
';
$r.='
'.$table->get_header(6).'
';
@@ -861,7 +765,7 @@ class Follow_Up
*
* \return true on success otherwise false
*/
- function Update()
+ function update()
{
// if ag_id == 0 nothing to do
@@ -966,7 +870,9 @@ class Follow_Up
$doc->Upload($this->ag_id);
/* save action details */
- for ($i=0; $i<$_POST['nb_item']; $i++)
+ $http=new HttpInput();
+ $nb_item=$http->post("nb_item","number",0);
+ for ($i=0; $i< $nb_item ; $i++)
{
$act=new Follow_Up_Detail($this->db);
$act->from_array($_POST, $i);
@@ -1211,7 +1117,7 @@ class Follow_Up
/* State of documents */
$type_state=new ISelect('state');
$aState=$cn->make_array('select s_id,s_value from document_state order by s_value');
- $aState[]=array('value'=>'-1', 'label'=>_('Tous les Etats'));
+ $aState[]=array('value'=>'-1', 'label'=>_('Tous les actions ouvertes'));
$type_state->value=$aState;
$type_state->selected=(isset($_GET['state']))?$_GET['state']:-1;
@@ -1296,15 +1202,26 @@ class Follow_Up
if ($p_array==null)
$p_array=$_GET;
- $query="";
if (count($p_array['searchtag'])==0)
return "";
+ $query="";
+ $operand = "1 = 0 ";
+ if ($p_array['tag_option'] == 0 )
+ {
+ $operand=" and ";
+ } elseif ($p_array['tag_option']==1)
+ {
+ $operand=" or ";
+ }
+ $and=" ";
for ($i=0; $i= ag_remind_date";
}
- if (!isset($p_array['closed_action']))
+ // only for open action or a closing status is selected
+ if (!isset($p_array['closed_action']) && $ag_state == "")
{
$action_query.=" and s_status is null ";
}
@@ -1573,20 +1493,21 @@ class Follow_Up
$c=count($a_tag);
for ($e=0; $e<$c; $e++)
{
- echo '';
+ echo '';
echo $a_tag[$e]['t_tag'];
if ($g_user->can_write_action($this->ag_id)==true)
{
- $js_remove=sprintf("onclick=\"action_tag_remove('%s','%s','%s')\"", dossier::id(), $this->ag_id, $a_tag[$e]['t_id']);
- echo HtmlInput::anchor(SMALLX, "javascript:void(0)", $js_remove, ' class="smallbutton" style="padding:0px;display:inline" ');
+ $js_remove=sprintf("action_tag_remove('%s','%s','%s')", dossier::id(), $this->ag_id, $a_tag[$e]['t_id']);
+ echo Icon_Action::trash(uniqid(), $js_remove);
}
echo '';
echo ' ';
echo ' ';
}
- $js=sprintf("onclick=\"action_tag_select('%s','%s')\"", dossier::id(), $this->ag_id);
+
if ($g_user->can_write_action($this->ag_id)==true)
{
+ $js=sprintf("onclick=\"action_tag_select('%s','%s')\"", dossier::id(), $this->ag_id);
echo HtmlInput::button('tag_bt', 'Ajout tag', $js, 'smallbutton');
}
}
@@ -1749,14 +1670,16 @@ class Follow_Up
$a_linked=$this->db->get_array('select ap_id,f_id from action_person where ag_id=$1', array($this->ag_id));
if (count($a_linked)==0)
return "";
+ $dossier_id=Dossier::id();
for ($i=0; $idb, $a_linked[$i]['f_id']);
$qc=$fiche->get_quick_code();
- $js_remove=sprintf("onclick=\"action_remove_concerned('%s','%s','%s')\"", dossier::id(), $a_linked[$i]['f_id'], $this->ag_id);
- echo '';
- echo $qc;
- echo HtmlInput::anchor(SMALLX, "javascript:void(0)", $js_remove, ' class="smallbutton" style="padding:0px;display:inline" ');
+ $js_remove=sprintf("action_remove_concerned('%s','%s','%s')", dossier::id(), $a_linked[$i]['f_id'], $this->ag_id);
+ echo '';
+ echo HtmlInput::anchor($qc,"", sprintf("onclick=\"linked_card_option('%s','%s')\"",
+ $a_linked[$i]['ap_id'],$dossier_id));
+ echo Icon_Action::trash(uniqid(), $js_remove);
echo '';
echo ' ';
echo ' ';
diff --git a/include/class/follow_up_detail.class.php b/include/class/follow_up_detail.class.php
index fdb39abfd..2cdd338cb 100644
--- a/include/class/follow_up_detail.class.php
+++ b/include/class/follow_up_detail.class.php
@@ -233,14 +233,14 @@ class Follow_Up_Detail
if (trim($this->ad_total_amount)==""||isNumber($this->ad_total_amount)==0) $this->ad_total_amount=0;
if (trim($this->ad_tva_id)=="" || isNumber($this->ad_tva_id)==0) $this->ad_tva_id=0;
}
- /*!\brief
- *\param
- *\return
- *\note
- *\see
- */
- static function test_me()
-{}
+
+ public static function display(Follow_Up $p_follow_up,$p_view)
+ {
+ $option=$p_follow_up->db->get_value("select do_option from document_option "
+ . " where document_type_id=$1 and do_code='detail_operation'",[$p_follow_up->dt_id]);
+
+ require NOALYSS_TEMPLATE."/follow_up_detail_display.php";
+ }
}
diff --git a/include/class/operation_predef_mtable.class.php b/include/class/operation_predef_mtable.class.php
index 2ac3634b5..a425c3e46 100644
--- a/include/class/operation_predef_mtable.class.php
+++ b/include/class/operation_predef_mtable.class.php
@@ -29,6 +29,13 @@ require_once NOALYSS_INCLUDE."/database/op_predef_sql.class.php";
require_once NOALYSS_INCLUDE."/class/pre_operation.class.php";
require_once NOALYSS_INCLUDE."/lib/select_box.class.php";
+/*!
+ * \brief Display a table and allow to change the predefined operation, insert or delete. Used the
+ * class Manage_Table_SQL and the SQL Object for the tables op_predef and op_predef_detail.
+ *
+ * @see include/preod.inc.php
+ * @see include/ajax/ajax_save_predf_op.php
+ */
class Operation_Predef_MTable extends Manage_Table_SQL
{
@@ -60,7 +67,7 @@ class Operation_Predef_MTable extends Manage_Table_SQL
// create our own "Append button"
$this->set_append_row(false);
$this->set_dialog_box("prdfop");
- $this->set_dialogbox_style(["position"=>"absolute","top"=>"5%","width:auto","min-width"=>"80%"]);
+ $this->set_dialogbox_style(["position"=>"fixed","top"=>"5%","width:auto","min-width"=>"80%"]);
}
/**
diff --git a/include/class/pre_op_advanced.class.php b/include/class/pre_op_advanced.class.php
index b870ef17a..e1e45ec14 100644
--- a/include/class/pre_op_advanced.class.php
+++ b/include/class/pre_op_advanced.class.php
@@ -191,8 +191,8 @@ class Pre_Op_Advanced extends Pre_operation_detail
$ret.=HtmlInput::hidden('jrn_type', "ODS");
$info = Icon_Action::infobulle(0);
$info_poste = Icon_Action::infobulle(9);
- if ($g_user->check_action(FICADD) == 1)
- $ret.=$f_add_button->input();
+ if ($g_user->check_action(FICADD) == 1) $ret.=$f_add_button->input();
+ $ret.='
';
$ret.='
';
$ret.='
' .
'
Quickcode' . $info . '
' .
@@ -287,6 +287,7 @@ class Pre_Op_Advanced extends Pre_operation_detail
// If readonly == 1 then show CA
}
$ret.='
';
+ $ret.="
";
$ret.=Html_Input_Noalyss::ledger_add_item("M");
return $ret;
}
diff --git a/include/class/profile_menu.class.php b/include/class/profile_menu.class.php
index 145f5fd4f..96b06ca58 100644
--- a/include/class/profile_menu.class.php
+++ b/include/class/profile_menu.class.php
@@ -244,7 +244,8 @@ class Profile_Menu extends Profile_Menu_sql
", array($this->p_id));
$aright_value=array(
array('value'=>'R', 'label'=>_('Lecture')),
- array('value'=>'W', 'label'=>_('Ecriture')),
+ array('value'=>'W', 'label'=>_('Ecriture et suppression')),
+ array('value'=>'O', 'label'=>_('Ecriture')),
array('value'=>'X', 'label'=>_('Aucun accès'))
);
require_once NOALYSS_TEMPLATE.'/user_sec_profile.php';
diff --git a/include/class/tag.class.php b/include/class/tag.class.php
index a6a6855f0..2f3b0a1c0 100644
--- a/include/class/tag.class.php
+++ b/include/class/tag.class.php
@@ -42,6 +42,11 @@ class Tag
function select()
{
$ret=$this->data->seek("where t_actif='Y' order by t_tag");
+ $ret=$this->cn->exec_sql(" select t_id,t_tag,t_description,'t' as tag_type
+ from tags
+ where t_actif='Y'
+ union all
+ select tg_id,tg_name ,'G','g' from tag_group order by 2");
require_once NOALYSS_TEMPLATE.'/tag_select.php';
}
/**
@@ -90,18 +95,20 @@ class Tag
*/
function select_search($p_prefix)
{
+ $res="";
$ret=$this->data->seek(' order by t_tag');
require_once NOALYSS_TEMPLATE.'/tag_search_select.php';
+ return HtmlInput::title_box('Tag', $p_prefix.'tag_div').$res;
}
/**
* In the screen search add this data to the cell
*/
function update_search_cell($p_prefix) {
- echo '';
+ echo '';
echo h($this->data->t_tag);
echo HtmlInput::hidden($p_prefix.'tag[]', $this->data->t_id);
$js=sprintf("$('sp_".$p_prefix.$this->data->t_id."').remove();");
- echo HtmlInput::anchor( SMALLX, "javascript:void(0)", "onclick=\"$js\"", ' class="smallbutton " style="padding:0px;display:inline" ');
+ echo Icon_Action::trash(uniqid(), $js);
echo '';
}
/**
diff --git a/include/class/tag_group_mtable.class.php b/include/class/tag_group_mtable.class.php
new file mode 100644
index 000000000..b99350118
--- /dev/null
+++ b/include/class/tag_group_mtable.class.php
@@ -0,0 +1,95 @@
+
+
+
+/**
+ * @file
+ * @brief manage tag_group table
+ *
+ *
+ */
+require_once NOALYSS_INCLUDE.'/lib/manage_table_sql.class.php';
+require_once NOALYSS_INCLUDE.'/database/tag_group_sql.class.php';
+
+class Tag_Group_MTable extends Manage_Table_SQL
+{
+
+ function __construct(Tag_Group_SQL $p_obj)
+ {
+ parent::__construct($p_obj);
+ $this->set_property_visible("tg_id", false);
+ $this->set_property_updatable("tg_id", false);
+ $this->set_col_label("tg_name", _('Nom'));
+ }
+
+ function input()
+ {
+
+
+ parent::input();
+
+
+ echo '
';
+ $this->input_tag();
+ echo '
';
+ }
+
+ /**
+ * Display a select widget for adding new tag
+ */
+ function input_tag()
+ {
+ $cn=Dossier::connect();
+ $data_sql=$this->get_table();
+
+ // Display containing tag_id
+ $aTag=$cn->get_array("select jt_id,t_tag
+ from tags join jnt_tag_group_tag on (tag_id=t_id)
+ where tag_group_id=$1 order by 2", [$data_sql->tg_id]);
+ // not possible to add tag to inexisting group
+ if ( $data_sql->tg_id == -1){
+ return;
+ }
+ echo '';
+ $nb=count($aTag);
+ $dossier_id=Dossier::id();
+ for ($i=0; $i<$nb; $i++)
+ {
+ // js to remove id
+ $js=Icon_Action::trash(uniqid(), sprintf("o_tagGroup.remove('%s','%s')", $aTag[$i]['jt_id'], $dossier_id));
+ printf('
%s %s %s
', $aTag[$i]['jt_id'],$aTag[$i]['t_tag'],$dossier_id,$js);
+ }
+ echo '';
+
+
+ // Add new tag
+ $select=new ISelect("is_tag", [], "s_tag_group");
+ $select->value=$cn->make_array("select t_id,t_tag
+ from tags
+ where
+ t_id not in (select tag_id from jnt_tag_group_tag
+ where tag_group_id=$1 ) order by 2", 0,[$data_sql->tg_id]);
+ echo $select->input();
+ echo HtmlInput::button('b_add_group', _("Ajout"),
+ sprintf("onclick=\"o_tagGroup.add_tag('%s','%s','%s'); \"", $data_sql->tg_id, $select->id, $dossier_id));
+ }
+
+}
diff --git a/include/class/user.class.php b/include/class/user.class.php
index 5cee77543..23051d0f7 100644
--- a/include/class/user.class.php
+++ b/include/class/user.class.php
@@ -1191,6 +1191,22 @@ class User
* @return true if he can write otherwise false
*/
function can_write_action($dtoc)
+ {
+ if ( $this->Admin() == 1 ) return TRUE;
+ if ( $this->get_status_security_action()==0) return TRUE;
+ $profile = $this->get_profile();
+ $r = $this->db->get_value(" select count(*) from action_gestion where ag_id=$1 and ag_dest in
+ (select p_granted from user_sec_action_profile where ua_right in ('W','O') and p_id=$2) ", array($dtoc, $profile));
+ if ($r == 0)
+ return FALSE;
+ return true;
+ }
+ /**
+ *Check if the profile of the user can write AND delete for this profile
+ * @param $dtoc action_gestion.ag_id
+ * @return true if he can write otherwise false
+ */
+ function can_delete_action($dtoc)
{
if ( $this->Admin() == 1 ) return TRUE;
if ( $this->get_status_security_action()==0) return TRUE;
diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php
index 2059cf74c..d02c09736 100644
--- a/include/compta_ach.inc.php
+++ b/include/compta_ach.inc.php
@@ -240,7 +240,7 @@ else
$Ledger->id = $request_jrn;
if (isset ($_REQUEST['p_jrn_predef'])){
- $Ledger->id=$_REQUEST['p_jrn_predef'];
+ $Ledger->id=$http->request('p_jrn_predef');
}
// pre defined operation
//
@@ -259,6 +259,7 @@ try
$acompte=$http->request("acompte", "string",0);
echo "
";
+ echo HtmlInput::hidden("ac", $ac);
/* request for a predefined operation */
if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']) && ! isset($correct) )
{
diff --git a/include/constant.php b/include/constant.php
index 966ef5dcb..7382a81e2 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
if ( ! defined ("SYSINFO_DISPLAY")) {
define ("SYSINFO_DISPLAY",TRUE);
}
-define ("DBVERSION",144);
+define ("DBVERSION",146);
define ("MONO_DATABASE",25);
define ("DBVERSIONREPO",18);
define ('NOTFOUND','--not found--');
@@ -212,6 +212,7 @@ define( 'ATTR_DEF_ACCOUNT_ND_TVA',50);
define('ATTR_DEF_ACCOUNT_ND_TVA_ND',51);
define ('ATTR_DEF_ACCOUNT_ND_PERSO',52);
define ('ATTR_DEF_ACCOUNT_ND',53);
+define ('ATTR_DEF_ACTIF',54);
define ("FICHE_TYPE_CLIENT",9);
define ("FICHE_TYPE_VENTE",1);
diff --git a/include/constant.security.php b/include/constant.security.php
index baf161e46..c395bed64 100644
--- a/include/constant.security.php
+++ b/include/constant.security.php
@@ -22,6 +22,7 @@ define ('FICADD',800); /* Ajout de fiche */
define ("FIC",805); //Création, modification et effacement de fiche
define ("FICCAT",910); //création, modification et effacement de catégorie de fiche
define ('RMDOC',1020); // Effacement de document pour follow up & comptabilité
+define ('TAGADD',1025); // Ajout de tag
define ('VIEWDOC',1010); // Voir document pour follow up
define ('PARCATDOC',1050); // modifier type document pour follow up
define ('RMRECEIPT',1110); // Effacer un document d'une pièce comptable
diff --git a/include/contact_option_ref.inc.php b/include/contact_option_ref.inc.php
new file mode 100644
index 000000000..a78cc4d57
--- /dev/null
+++ b/include/contact_option_ref.inc.php
@@ -0,0 +1,58 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+require_once NOALYSS_INCLUDE."/class/contact_option_ref_mtable.class.php";
+echo '
';
}
@@ -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('
';
$header=new Sort_Table();
@@ -59,7 +59,7 @@ if ( ! isset($_REQUEST['action']))
$header->add(_("Type d'utilisateur"),$base_url,"order by use_admin asc,use_login asc","order by use_admin desc,use_login desc",'ta','td');
- $order=(isset($_REQUEST['ord']))?$_REQUEST['ord']:'la';
+ $order=$http->request("ord","string","la");
$ord_sql=$header->get_sql_order($order);
@@ -73,12 +73,13 @@ if ( ! isset($_REQUEST['action']))
use_admin
from ac_users left join jnt_use_dos using (use_id)
where use_login != $2 and use_active=1
- and (dos_id=$1 or (dos_id is null and use_admin=1))" . $ord_sql, array($gDossier,NOALYSS_ADMINISTRATOR));
+ and (dos_id=$1 or (dos_id is null and use_admin=1))" . $ord_sql,
+ array($gDossier,NOALYSS_ADMINISTRATOR));
$MaxUser = Database::num_row($user_sql);
- echo '
';
+ echo '
';
echo "
";
echo '
'.$header->get_header(0).'
';
echo '
'.$header->get_header(1).'
';
@@ -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 "