';
if ( $User->Admin() == 1 )
{
- $result.=" Administration ";
+ $result.=""._("Administration")." ";
}
$result.='';
$result.=''._('Préférence').' ';
@@ -164,12 +176,12 @@ echo ''.$result.'
';
echo '';
?>
-
+
Update();
}
- $act->generate_document($_POST['doc_mod'], $_POST);
+ $doc_mod=$http->post('doc_mod',"number");
+ $act->generate_document($doc_mod, $_POST);
$sub_action = 'detail';
}
/* for delete */
@@ -121,7 +125,7 @@ if ($sub_action == "update")
{
$act2 = new Follow_Up($cn);
$act2->fromArray($_POST);
- if ($g_user->can_write_action($act2->ag_id) == false )
+ if ($g_user->can_write_action($act2->ag_id) == FALSE )
{
echo '';
echo '
'._('Cette action ne vous est pas autorisée Contactez votre responsable').' ';
@@ -145,23 +149,33 @@ if ($sub_action == "update")
$act->get();
$act->fromArray($_POST);
$error_id=$e->getCode();
+ record_log($e->getTraceAsString());
}
}
//----------------------------------------------------------------------
// Add a related action
//----------------------------------------------------------------------
if (isset($_POST['add_action_here']))
- {
- $act = new Follow_Up($cn);
-
+ {
+ $ag_id=$http->post('ag_id',"number");
+ $act = new Follow_Up($cn,$ag_id);
+ if ($g_user->can_write_action($act->ag_id) == FALSE )
+ {
+ echo '
';
+ echo '
'._('Cette action ne vous est pas autorisée Contactez votre responsable').' ';
+ echo '';
+ return;
+ }
//----------------------------------------
// puis comme ajout normal (copier / coller )
- $act->fromArray($_POST);
$act->ag_id = 0;
$act->d_id = 0;
- $act->action = $_POST['ag_id'];
-
+ $act->action = $http->post('ag_id',"number");
+ $act->ag_timestamp=date('d.m.Y');
+ $act->ag_hour="";
+ $act->ag_title="";
+ $act->ag_remind_date="";
echo '
';
// Add hidden tag
@@ -255,7 +269,7 @@ if ($sub_action == "list")
}
//--------------------------------------------------------------------------------
// Save Follow_Up
-// Stage 2 : Save a NEW action + Files and generate eventually a document
+// Stage 2 : Save a NEW action + Files and generate a document
//--------------------------------------------------------------------------------
if ($sub_action == "save_action_st2")
{
@@ -282,6 +296,7 @@ if ($sub_action == "save_action_st2")
echo '';
$sub_action="add_action";
$error_id=$e->getCode();
+ record_log($e->getTraceAsString());
}
}
//--------------------------------------------------------------------------------
diff --git a/sources/include/action.inc.php b/sources/include/action.inc.php
index ff2ea68..5709845 100644
--- a/sources/include/action.inc.php
+++ b/sources/include/action.inc.php
@@ -28,11 +28,12 @@ $retour=HtmlInput::button_anchor(_('Retour liste'),
//-----------------------------------------------------
// Follow_Up
//-----------------------------------------------------
-require_once NOALYSS_INCLUDE.'/class_icard.php';
-require_once NOALYSS_INCLUDE.'/class_ispan.php';
-require_once NOALYSS_INCLUDE.'/class_ifile.php';
-require_once NOALYSS_INCLUDE.'/class_itext.php';
-require_once NOALYSS_INCLUDE.'/class_follow_up.php';
+require_once NOALYSS_INCLUDE.'/lib/icard.class.php';
+require_once NOALYSS_INCLUDE.'/lib/ispan.class.php';
+require_once NOALYSS_INCLUDE.'/lib/ifile.class.php';
+require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
+require_once NOALYSS_INCLUDE.'/lib/inplace_edit.class.php';
+require_once NOALYSS_INCLUDE.'/class/follow_up.class.php';
/*!\brief Show the list of action, this code should be common
* to several webpage. But for the moment we keep like that
* because it is used only by this file.
diff --git a/sources/include/adm.inc.php b/sources/include/adm.inc.php
index 6e32b3b..8165a74 100644
--- a/sources/include/adm.inc.php
+++ b/sources/include/adm.inc.php
@@ -21,25 +21,22 @@
* the customer category
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-require_once NOALYSS_INCLUDE.'/class_iselect.php';
-require_once NOALYSS_INCLUDE.'/class_ihidden.php';
-require_once NOALYSS_INCLUDE.'/class_customer.php';
-require_once NOALYSS_INCLUDE.'/class_ibutton.php';
-require_once NOALYSS_INCLUDE.'/class_fiche_def.php';
-require_once NOALYSS_INCLUDE.'/class_fiche_def.php';
-require_once NOALYSS_INCLUDE.'/class_admin.php';
+require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
+require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
+require_once NOALYSS_INCLUDE.'/class/customer.class.php';
+require_once NOALYSS_INCLUDE.'/lib/ibutton.class.php';
+require_once NOALYSS_INCLUDE.'/class/fiche_def.class.php';
+require_once NOALYSS_INCLUDE.'/class/fiche_def.class.php';
+require_once NOALYSS_INCLUDE.'/class/admin.class.php';
-global $g_user;
+global $g_user,$http;
-$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
+$low_action=$http->request('sb',"string","list");
/*! \file
* \brief Called from the module "Gestion" to manage the customer
*/
$href=basename($_SERVER['PHP_SELF']);
-// by default open liste
-if ( $low_action == "" )
- $low_action="list";
//-----------------------------------------------------
@@ -55,7 +52,7 @@ if ( isset($_POST['action_fiche'] ) )
return;
}
- $f_id=$_REQUEST['f_id'];
+ $f_id=$hi->request('f_id',"number");
$fiche=new Admin($cn,$f_id);
$fiche->remove();
@@ -65,7 +62,7 @@ if ( isset($_POST['action_fiche'] ) )
}
//-----------------------------------------------------
-// list of customer
+// list of Admin
//-----------------------------------------------------
if ( $low_action == "list" )
{
@@ -78,10 +75,10 @@ if ( $low_action == "list" )
echo '
' . "Exercice " . $g_user->get_exercice() . ' ';
echo dossier::hidden();
$a=(isset($_GET['query']))?$_GET['query']:"";
- printf (_('Recherche').' ',
- $a);
+ echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$a);
+
echo HtmlInput::request_to_hidden(array('ac'));
- $choice_cat=HtmlInput::default_value_request("choice_cat", 1);
+ $choice_cat=$http->request("choice_cat","string", 1);
if ( $choice_cat == 1 )
{
$sel_card=new ISelect('cat');
@@ -93,7 +90,7 @@ if ( $low_action == "list" )
echo _('Catégorie :').$sel_card->input();
} else
{
- $cat=HtmlInput::default_value_request('cat', '');
+ $cat=$http->request('cat', 'string','');
echo HtmlInput::hidden("cat",$cat);
echo HtmlInput::hidden('choice_cat', 0);
}
@@ -106,12 +103,13 @@ if ( $low_action == "list" )
get("query","string","");
$sql="";
- if ( isset($_GET['cat']))
- {
- if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
- }
+ $cat=$http->request("cat","number",-1);
+ if ( $cat != -1)
+ {
+ $sql=sprintf(" and fd_id = %d",$_GET['cat']);
+ }
echo '
';
echo $adm->Summary($search,'adm',$sql);
diff --git a/sources/include/admin_repo.inc.php b/sources/include/admin_repo.inc.php
new file mode 100644
index 0000000..b0b1d9f
--- /dev/null
+++ b/sources/include/admin_repo.inc.php
@@ -0,0 +1,207 @@
+request("action","string", "");
+
+$rep=new Database();
+$User=new User($rep);
+$User->Check();
+
+
+if ($User->admin != 1)
+{
+ $theme=(isset($User->theme))?$User->theme:"";
+ html_page_start($User->theme);
+ echo "
";
+ echo _("Vous n'êtes pas administateur");
+ echo " ";
+ $reconnect=http_build_query(array("reconnect"=>1,"backurl"=>"admin-noalyss.php?action=upgrade"));
+ echo '
';
+ echo _("Connectez-vous comme administrateur");
+ echo ' ';
+ html_page_stop();
+ return;
+}
+// For a backup , we must avoid to send anything before the
+// dump file
+if ( $action== 'backup') {
+ /* take backup */
+ require_once NOALYSS_INCLUDE."/backup.inc.php";
+ exit();
+}
+html_page_start($_SESSION['g_theme']);
+load_all_script();
+echo '
'._('Administration').' ';
+echo '";
+
+?>
+
+"._("Version Noalyss")."";
+ echo "Noalyss : ", $version_noalyss;
+
+ echo "
"._('Variables').":".NOALYSS_INCLUDE.'/config.inc.php ';
+ echo '
';
+ echo "". "NOALYSS_HOME".": ".NOALYSS_HOME." ";
+ echo ""."NOALYSS_INCLUDE".": ".NOALYSS_INCLUDE." ";
+ echo ""."NOALYSS_TEMPLATE".": ".NOALYSS_TEMPLATE." ";
+ echo ""."DEBUG".": ".DEBUG." ";
+ echo ""."LOGINPUT".": ".LOGINPUT." ";
+ echo ""."LOCALE".": ".LOCALE." ";
+ echo ""."MULTI".": ".MULTI." ";
+ echo ""."DOMAINE".": ".domaine." ";
+ echo ""."PG_PATH".": ".PG_PATH." ";
+ echo ""."PG_DUMP".": ".PG_DUMP." ";
+ echo ""."PG_RESTORE".": ".PG_RESTORE." ";
+ echo ""."PSQL".": ".PSQL." ";
+ echo " ";
+ echo "
"._("Paramètre base de données")." ";
+ $a_option = array ("client_encoding","lc_collate","listen_addresses",
+ "server_encoding","work_mem","shared_buffers","server_version",
+ "hba_file","config_file","data_directory","effective_cache_size");
+ /*
+ * For old version of noalyss config file
+ */
+ $noalyss_user=(defined("noalyss_user"))?noalyss_user:phpcompta_user;
+ $port=(defined("noalyss_psql_port"))?noalyss_psql_port:phpcompta_psql_port;
+ $host=(!defined("noalyss_psql_host") )?'127.0.0.1':noalyss_psql_host;
+
+ echo '
';
+ echo "";
+ echo _('Hôte')." = ".$host;
+ echo " ";
+ echo "";
+ echo _('Port')." = ".$port;
+ echo " ";
+ echo "";
+ echo _('Utilisateur')." = ".$noalyss_user;
+ echo " ";
+
+ for ( $i = 0 ; $i < count($a_option); $i++) {
+ $name=$a_option[$i];
+
+ $sql="select setting from pg_settings where name=$1";
+ $value=$rep->get_value($sql,array($name));
+ echo " ".$name." = ".$value." ";
+ }
+
+ echo " ";
+
+ echo "
"._('Paramètre PHP')." ";
+ ob_start();
+ echo phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_ENVIRONMENT | INFO_VARIABLES);
+ $r=ob_get_clean();
+ $html=new DOMDocument();
+ $html->loadHTML($r);
+ $nodelist=$html->getElementsByTagName("style");
+ $nodelist->item(0)->nodeValue='
+.p {text-align: left;}
+.e {background-color: #ccccff; font-weight: bold; color: #000000;}
+.h {background-color: #9999cc; font-weight: bold; color: #000000;word-wrap:break-word;word-break: break-all;}
+.v {background-color: #cccccc; color: #000000;;word-wrap:break-word;word-break: break-all}
+.vr {background-color: #cccccc; text-align: right; color: #000000;word-wrap:break-word;word-break: break-all}
+img {float: right; border: 0px;}
+hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;}
+ ';
+ $a_table=$html->getElementsByTagName("table");
+
+ // For PHP < 7 , we must change the attribute "width"
+ if ( substr(phpversion(),0,1) != "7" )
+ {
+ for ( $i = 0 ; $i < $a_table->length;$i++) {
+ $node=$a_table->item($i);
+ $node->attributes->getNamedItem("width")->nodeValue="100%";
+
+ }
+ }
+ $a_title = $html->getElementsByTagName("title");
+ for ( $i = 0;$i<$a_title->length;$i++) {
+ $a_title->item($i)->nodeValue="";
+ }
+ echo $html->saveHTML();
+
+}
+//------------------------------------------------------------------------------
+// Upgrade
+//------------------------------------------------------------------------------
+if ( $action == "upgrade" ) {
+
+
+ require_once NOALYSS_INCLUDE."/upgrade.inc.php";
+}
+?>
+
+
diff --git a/sources/include/ajax/ajax_accounting.php b/sources/include/ajax/ajax_accounting.php
new file mode 100644
index 0000000..a0f6c81
--- /dev/null
+++ b/sources/include/ajax/ajax_accounting.php
@@ -0,0 +1,70 @@
+
+
+if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief Manange Accounting
+ * @see Acc_Plan_SQL
+ */
+$http=new HttpInput();
+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;
+}
+if ( $g_user->check_module("CFGPCMN") == 0) die();
+
+require_once NOALYSS_INCLUDE."/lib/manage_table_sql.class.php";
+require_once NOALYSS_INCLUDE."/class/acc_plan_mtable.class.php";
+
+$obj=new Acc_Plan_SQL($cn);
+$obj->set_limit_fiche_qcode(5);
+$obj->set_pk_value($p_id);
+$obj->load();
+$manage_table=new Acc_Plan_MTable($obj);
+$manage_table->add_json_param("op","accounting");
+$manage_table->set_object_name($ctl_id);
+$manage_table->set_callback("ajax_misc.php");
+if ($action=="input")
+{
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $manage_table->ajax_input()->saveXML();
+ return;
+}
+elseif ($action == "save")
+{
+ $xml=$manage_table->ajax_save();
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $xml->saveXML();
+}
+elseif ($action == "delete")
+{
+ $xml=$manage_table->ajax_delete();
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $xml->saveXML();
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_action_remove_concerned.php b/sources/include/ajax/ajax_action_remove_concerned.php
new file mode 100644
index 0000000..31112df
--- /dev/null
+++ b/sources/include/ajax/ajax_action_remove_concerned.php
@@ -0,0 +1,60 @@
+get("ag_id", "number");
+ $f_id=$http->get("f_id", "number");
+}
+catch (Exception $exc)
+{
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+require_once 'class/follow_up.class.php';
+$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);
+
+$response = ob_get_clean();
+
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+unused
+$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_action_save_concerned.php b/sources/include/ajax/ajax_action_save_concerned.php
new file mode 100644
index 0000000..e799b09
--- /dev/null
+++ b/sources/include/ajax/ajax_action_save_concerned.php
@@ -0,0 +1,51 @@
+insert_linked_card($f_id);
+/**
+ * Display all the linked card
+ */
+
+ob_start();
+$follow->display_linked();
+echo HtmlInput::button_action_add_concerned_card( $ag_id);
+$response = ob_get_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+unused
+$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_add_concerned_card.php b/sources/include/ajax/ajax_add_concerned_card.php
new file mode 100644
index 0000000..4322b13
--- /dev/null
+++ b/sources/include/ajax/ajax_add_concerned_card.php
@@ -0,0 +1,101 @@
+get("ag_id");
+}
+catch (Exception $exc)
+{
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
+
+$r=HtmlInput::title_box(_("Détail fiche"), 'search_card');
+
+$r.='';
+$query=$http->get("query", "string","");
+$sql_array['query']=$query;
+$sql_array['typecard']='all';
+
+$fiche=new Fiche($cn);
+/* Build the SQL and show result */
+$sql=$fiche->build_sql($sql_array);
+
+
+/* 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
+
+unused
+$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_add_menu.php b/sources/include/ajax/ajax_add_menu.php
new file mode 100644
index 0000000..669201d
--- /dev/null
+++ b/sources/include/ajax/ajax_add_menu.php
@@ -0,0 +1,221 @@
+check_module('CFGPRO')==0)
+ die();
+
+require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+$http=new HttpInput();
+
+try
+{
+ $type=$http->get('type');
+ $p_level=$http->get('p_level', "string",0);
+ $dep=$http->get('dep', "string",0);
+}
+catch (Exception $exc)
+{
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+// if type == menu the
+if ($type=='me')
+{
+ if ( isNumber($p_level)==0 ) throw new Exception('invalid call');
+
+ if ($p_level==0)
+ {
+ // There is no dependency
+ // Menu which can be added
+ $ame_code=$cn->make_array("
+select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')
+ ||'('|| case when me_type='SP' then 'Special'
+ when me_type='PL' then 'Plugin'
+ when me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'
+ when me_type='ME' then 'Menu'
+ else
+ me_type
+ end||')'
+ from
+ menu_ref
+ where
+ me_type<>'PR'
+ order by 1
+ ");
+ }
+ elseif ($p_level==1)
+ {
+ // dependency is in dep
+ // Menu which can be added
+ $ame_code=$cn->make_array("
+select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')
+ ||'('|| case when me_type='SP' then 'Special'
+ when me_type='PL' then 'Plugin'
+ when me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'
+ when me_type='ME' then 'Menu'
+ else
+ me_type
+ end||')'
+ from
+ menu_ref
+ where
+ me_type<>'PR'
+ order by 1
+ ");
+ }
+ elseif ($p_level==2)
+ {
+ // menu can *NOT* have submenu
+ // Menu which can be added
+ $ame_code=$cn->make_array("
+select me_code,me_code||' '||coalesce(me_menu,'')||' '||coalesce(me_description,'')
+ ||'('|| case when me_type='SP' then 'Special'
+ when me_type='PL' then 'Plugin'
+ when me_type='ME' and me_file is null and me_javascript is null and me_url is null then 'Module - Menu principal'
+ when me_type='ME' then 'Menu'
+ else
+ me_type
+ end||')'
+ from
+ menu_ref
+ where
+ me_type<>'PR' and
+ (
+ coalesce(me_file,'') <> '' or
+ coalesce(me_url,'') <> '' or
+ coalesce(me_javascript,'') <> ''
+ )
+ order by 1
+ ");
+ }
+ else
+ {
+ throw new Exception('LEVEL ERROR');
+ }
+
+
+ $p_order=new INum("p_order", "10");
+
+ $me_code=new ISelect('me_code');
+ $me_code->rowsize=15;
+ $me_code->value=$ame_code;
+
+
+ $pm_default=new ICheckBox('pm_default');
+ echo HtmlInput::title_box(_("Nouveau"), $ctl);
+ ?>
+
+
+ =MAX_FOLDER_TO_SHOW)?MAX_FOLDER_TO_SHOW:$nb_dossier;
+ echo _('Dossiers trouvés').':'.$nb_dossier." "._('Dossiers affichés').$max.' '._('Limite dossiers').":".MAX_FOLDER_TO_SHOW;
+ ?>
+
+ getTraceAsString());
+ $content=_('Erreur paramètre');
+ $status="NOK";
+ }
+
+
+
+
+ //----------------------------------------------------------------
+ // Answer in XML
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $xml=escape_xml($content);
+ $xml_content=$dom->createElement('content', $xml);
+ $xml_status=$dom->createElement('status', $status);
+ $root=$dom->createElement("root");
+ $root->appendChild($xml_content);
+ $root->appendChild($xml_status);
+ $dom->appendChild($root);
+ echo $dom->saveXML();
+ exit();
+}
+// For the operation 'modele_drop','modele_modify','folder_modify','folder_drop'
+// the p_dossier parameter is mandatory
+if (in_array($op, array('modele_drop', 'modele_modify', 'folder_modify', 'folder_drop')))
+{
+ try
+ {
+ $dossier=$http->get('p_dossier', "number");
+ $content=_('Erreur paramètre');
+ $status="NOK";
+ }
+ catch (Exception $exc)
+ {
+ error_log($exc->getTraceAsString());
+ $content=_('Erreur paramètre');
+ $status="NOK";
+ //----------------------------------------------------------------
+ // Answer in XML
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $xml=escape_xml($content);
+ $xml_content=$dom->createElement('content', $xml);
+ $xml_status=$dom->createElement('status', $status);
+ $root=$dom->createElement("root");
+ $root->appendChild($xml_content);
+ $root->appendChild($xml_status);
+ $dom->appendChild($root);
+ echo $dom->saveXML();
+ exit();
+ }
+
+ // Modify the description or the name of folder
+ if ($op=='folder_modify')
+ {
+ $dos=new Dossier($dossier);
+ ob_start();
+ $dos->load();
+ echo HtmlInput::title_box(_('Modification'), 'folder_admin_div');
+ $wText=new IText();
+ echo '';
+ $content=ob_get_clean();
+ $status='OK';
+ }
+ else if ($op=='folder_drop')
+ {
+ // ask to confirm the removal a folder
+ $dos=new Dossier($dossier);
+ ob_start();
+ echo HtmlInput::title_box(_('Efface'), 'folder_admin_div');
+ $dos->load();
+ echo '';
+ $content=ob_get_clean();
+ $status='OK';
+ }
+ else if ($op=='modele_drop')
+ {
+ // ask to confirm the removal a folder
+ $cn=new Database();
+ $name=$cn->get_value('select mod_name from modeledef where mod_id=$1', array($dossier));
+ ob_start();
+ echo HtmlInput::title_box(_('Efface'), 'folder_admin_div');
+ echo '';
+ $content=ob_get_clean();
+ $status='OK';
+ }
+ else if ($op=='modele_modify')
+ {
+ // Modify the description or the name of a template
+ $cn=new Database();
+ ob_start();
+ echo HtmlInput::title_box(_('Modification'), 'folder_admin_div');
+ echo '';
+ $content=ob_get_clean();
+ $status='OK';
+ }
+ //----------------------------------------------------------------
+ // Answer in XML
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $xml=escape_xml($content);
+ $xml_content=$dom->createElement('content', $xml);
+ $xml_status=$dom->createElement('status', $status);
+ $root=$dom->createElement("root");
+ $root->appendChild($xml_content);
+ $root->appendChild($xml_status);
+ $dom->appendChild($root);
+ echo $dom->saveXML();
+ exit();
+}
+//------------------------------------------------------------------
+// Upgrade Core
+//------------------------------------------------------------------
+if ($op=='upgradeCore')
+{
+ require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
+ require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
+ $task_id=$http->request("task_id");
+ $progress=new Progress_Bar($task_id);
+ $progress->set_value(2);
+ $repo=new Package_Repository();
+ $core=$repo->make_object("core", " ");
+ try {
+ $progress->set_value(5);
+ $core->download();
+ $progress->set_value(55);
+ if (!DEBUG )
+ {
+ $core->install();
+ }
+ $progress->set_value(100);
+
+ $url=sprintf(' install.php ', NOALYSS_URL."/install.php");
+ printf(_("Afin de terminer l'installation aller sur %s , à la fin de la procédure , demandez à effacer le fichier install.php"),
+ $url);
+ } catch (Exception $ex ) {
+ echo '';
+ echo $ex->getMessage();
+ echo '
';
+ $progress->set_value(100);
+ }
+ return;
+}
+//---------------------------------------------------------------------------------------------------------
+// Upgrade or install plugin
+//---------------------------------------------------------------------------------------------------------
+if ($op=='upgradePlugin')
+{
+ require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
+ require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
+ $task_id=$http->request("task_id");
+ $code=$http->post("code_plugin");
+ $progress=new Progress_Bar($task_id);
+ $progress->set_value(2);
+ $repo=new Package_Repository();
+ $plugin=$repo->make_object("plugin", $code);
+ $progress->set_value(5);
+ $plugin->download();
+ $progress->set_value(55);
+ $plugin->install();
+ $progress->set_value(100);
+ echo _("L'extension doit être activée dans le dossier avec CFGPLUGIN");
+ return;
+}
+//------------------------------------------------------------------------------------------------------------------
+// Install template
+//------------------------------------------------------------------------------------------------------------------
+if ($op=="installTemplate")
+{
+ require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php';
+ require_once NOALYSS_INCLUDE.'/class/package_repository.class.php';
+ $task_id=$http->request("task_id");
+ $name=$http->post("code");
+ $progress=new Progress_Bar($task_id);
+ $progress->set_value(2);
+ $package_repository=new Package_Repository();
+ $progress->set_value(4);
+ $template=$package_repository->make_object("template", $name);
+ $progress->set_value(30);
+ $template->download();
+ $progress->set_value(70);
+ $template->install();
+ $progress->set_value(100);
+ echo _("Modèle installé");
+ return;
+}
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_anc_accounting.php b/sources/include/ajax/ajax_anc_accounting.php
new file mode 100644
index 0000000..35f25d3
--- /dev/null
+++ b/sources/include/ajax/ajax_anc_accounting.php
@@ -0,0 +1,60 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+require_once NOALYSS_INCLUDE."/class/anc_account_table.class.php";
+/**
+ * @file
+ * @brief Insert , update delete anc accounting
+ */
+$http=new HttpInput();
+$cn=Dossier::connect();
+
+$action=$http->request("action");
+$p_id=$http->request("p_id", "number");
+$ctl_id=$http->request("ctl");
+$pa_id=$http->request("pa_id");
+
+$anc=new Poste_analytique_SQL($cn, $p_id);
+$anc->pa_id=$pa_id;
+$accounting=new Anc_Account_Table($anc);
+$accounting->set_object_name($ctl_id);
+$accounting->set_callback("ajax_misc.php");
+$accounting->add_json_param("op", "anc_accounting");
+
+if ($action=="input")
+{
+
+ $accounting->send_header();
+ echo $accounting->ajax_input()->saveXML();
+}
+elseif ($action=="save")
+{
+ $accounting->send_header();
+ echo $accounting->ajax_save()->saveXML();
+}
+elseif ($action=="delete")
+{
+ $accounting->send_header();
+ echo $accounting->ajax_delete()->saveXML();
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_anc_detail_operation.php b/sources/include/ajax/ajax_anc_detail_operation.php
new file mode 100644
index 0000000..7338598
--- /dev/null
+++ b/sources/include/ajax/ajax_anc_detail_operation.php
@@ -0,0 +1,92 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief display the detail of an anc operation
+ * parameters : oa_group
+ */
+$http=new HttpInput();
+$oa_group=$http->request("oa_group","number");
+bcscale(4);
+$row=$cn->get_row("select distinct oa_group,
+ to_char(oa_date,'DD.MM.YYYY') as str_date ,
+ oa_date,
+ oa_description,
+ jr_pj_number,
+ jr_id
+ from
+ operation_analytique as oa
+ join poste_analytique using (po_id)
+ left join (select jr_id,jr_pj_number,j_id from jrn join jrnx on (jr_grpt_id=j_grpt) ) as m on (m.j_id=oa.j_id)
+ where oa_group=$1",array($oa_group));
+echo HtmlInput::title_box(_('Détail'), "anc_detail_op_div");
+echo $row['str_date'],' ',
+ h($row['oa_description']),' ',
+ h($row['jr_pj_number']);
+$a_row=$cn->get_array("select distinct oa_row from operation_analytique where oa_group=$1",array($oa_group));
+$a_plan=$cn->get_array("select distinct pa_id,pa_name from operation_analytique join poste_analytique using (po_id) join plan_analytique using (pa_id) where oa_group=$1 order by pa_name",array($oa_group));
+$nb_row=count($a_row);
+$nb_plan=count($a_plan);
+echo '';
+echo '';
+echo th(_('Fiche'));
+for ( $e=0;$e<$nb_plan;$e++) echo th($a_plan[$e]['pa_name']);
+echo th(_('Montant'),'style="text-align:right"');
+echo th(_('D/C'));
+echo ' ';
+
+echo ' ';
+for ($i=0;$i< $nb_row;$i++) {
+ $class=($i%2==0)?"even":"odd";
+ echo '';
+ // retrieve card
+ echo '';
+ $f_id=$cn->get_value("select distinct f_id from operation_analytique where oa_group = $1 and oa_row=$2",[$oa_group,$a_row[$i]['oa_row']]);
+ $qcode=$cn->get_value("select ad_value from fiche_detail where f_id=$1 and ad_id=$2",[$f_id,ATTR_DEF_QUICKCODE] );
+ echo $qcode;
+ echo ' ';
+ for ( $e = 0;$e<$nb_plan;$e++) {
+ $detail_row=$cn->get_row("select po_name , oa_amount,oa_positive ,oa_debit
+ from operation_analytique
+ join poste_analytique using (po_id)
+ join plan_analytique using (pa_id)
+ where
+ oa_group=$1
+ and oa_row=$2
+ and pa_id=$3",array($oa_group,$a_row[$i]['oa_row'],$a_plan[$e]['pa_id']));
+ echo td($detail_row['po_name']);
+ }
+ $amount=$detail_row['oa_amount'];
+ if ( $detail_row['oa_positive']=="N") {$amount=bcmult($amount,-1);}
+ echo td($amount,'style="text-align:right"');
+ $debit=($detail_row['oa_debit'] == 'f')?"C":"D";
+ echo td($debit);
+ echo ' ';
+
+}
+echo '
';
+echo '';
+echo '',HtmlInput::button_close("anc_detail_op_div");
+echo ' ';
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_anc_key_choice.php b/sources/include/ajax/ajax_anc_key_choice.php
new file mode 100644
index 0000000..ed13bd0
--- /dev/null
+++ b/sources/include/ajax/ajax_anc_key_choice.php
@@ -0,0 +1,65 @@
+get("amount", "number");
+ $table_id=$http->get("t");
+ $ledger=$http->get('led',"number");
+
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+
+require_once 'class/anc_key.class.php';
+
+ob_start();
+echo HtmlInput::title_box(_("Choix d'une clef"), 'div_anc_key_choice');
+
+Anc_Key::display_choice($amount,$table_id,$ledger);
+
+echo HtmlInput::button_close('div_anc_key_choice');
+$response = ob_get_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_anc_key_compute.php b/sources/include/ajax/ajax_anc_key_compute.php
new file mode 100644
index 0000000..c04d643
--- /dev/null
+++ b/sources/include/ajax/ajax_anc_key_compute.php
@@ -0,0 +1,73 @@
+get('key',"number");
+ $amount=$http->get('amount',"number");
+ $target=$http->get('t');
+}
+catch (Exception $exc)
+{
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+$compute_key=new Anc_Key($key);
+$pos=strrpos($target,"t");
+$row=substr($target,$pos+1);
+
+$compute_key->fill_table($target,$amount);
+echo <<
+anc_refresh_remain('$target','$row');
+
+EOF;
+////
+$response = ob_get_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_anc_plan.php b/sources/include/ajax/ajax_anc_plan.php
new file mode 100644
index 0000000..88115cb
--- /dev/null
+++ b/sources/include/ajax/ajax_anc_plan.php
@@ -0,0 +1,67 @@
+check_module("PLANANC ") ) die("forbidden");
+
+$input = $http->request("input");
+$action = $http->request("ieaction", "string", "display");
+$pa_id=$http->post("id","number");
+$answer = Inplace_Edit::build($input);
+$answer->add_json_param("gDossier", Dossier::id());
+$answer->set_callback("ajax_misc.php");
+$answer->add_json_param("action","anc_updatedescription");
+$answer->add_json_param("op","anc_updatedescription");
+$answer->add_json_param("id",$pa_id);
+
+$input=$answer->get_input();
+if ($action=="display") {
+ echo $answer->ajax_input() ;
+}
+if ($action=="ok") {
+ $value=$http->post("value");
+ if ( $input->name=="pa_name" && trim($input->value) == "")
+ {
+ echo _("Le nom ne peut être vide"),$answer->ajax_input();
+ }else {
+ if ($input->name=="pa_name") {
+ $cn->exec_sql(" update plan_analytique set pa_name=$1 where pa_id=$2",array($value,$pa_id));
+ }
+ if ($input->name=="pa_description") {
+ if ( trim($value ) == "" ) $value=NULL;
+ $cn->exec_sql(" update plan_analytique set pa_description=$1 where pa_id=$2",array($value,$pa_id));
+ if ( trim($value ) == NULL ) $value=_("Aucune description");
+ }
+ $answer->set_value($value);
+ echo $answer->value();
+ }
+}
+if ($action=="cancel") {
+ echo $answer->value();
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_anc_search.php b/sources/include/ajax/ajax_anc_search.php
new file mode 100644
index 0000000..071ac43
--- /dev/null
+++ b/sources/include/ajax/ajax_anc_search.php
@@ -0,0 +1,96 @@
+value=$http->get('plabel',"string","");
+
+echo HtmlInput::title_box(_("Recherche activité"), $ctl);
+
+//------------- FORM ----------------------------------
+echo '';
+//------------- FORM ----------------------------------
+if ( isset($_REQUEST['go']))
+{
+ $cn=Dossier::connect();
+ $plan=new Anc_Plan($cn,$_REQUEST['c2']);
+ $plan->pa_id=$_REQUEST['c2'];
+ if ( $plan->exist()==false)
+ exit(_("Ce plan n'existe pas"));
+
+ $sql="select po_name , po_description from poste_analytique ".
+ "where pa_id=$1 and ".
+ " (po_name ~* $2 or po_description ~* $3) order by po_name";
+ $array=$cn->get_array($sql,array($_REQUEST['c2'],$_REQUEST['plabel'],$_REQUEST['plabel']));
+
+ if (empty($array) == true)
+ {
+ echo _("Aucun poste trouvé");
+ return;
+ }
+
+ echo '';
+ foreach ($array as $line)
+ {
+ $js=sprintf("onclick=\"$('%s').value='%s';removeDiv('%s')\"",
+ $_REQUEST['c1'],
+ $line['po_name'],$ctl);
+
+ echo ''.
+ ''.
+ HtmlInput::anchor(h($line['po_name']), "", $js).
+ ' '.
+ ''.
+ h($line['po_description']).
+ ' ';
+ }
+ echo '
';
+}
diff --git a/sources/include/ajax/ajax_auto_anc_card.php b/sources/include/ajax/ajax_auto_anc_card.php
new file mode 100644
index 0000000..917154d
--- /dev/null
+++ b/sources/include/ajax/ajax_auto_anc_card.php
@@ -0,0 +1,34 @@
+exec_sql("select po_name,po_description from poste_analytique where pa_id=$1 and (po_description ~* $2 or po_name ~* $3) order by po_id limit 12",
+ array($_REQUEST['pa_id'],$_POST['anccard'],$_POST['anccard']));
+}
+else
+{
+ $res=$cn->exec_sql("select po_name,po_description from poste_analytique where po_description ~* $1 or po_name ~* $2 order by po_id limit 12 ",
+ array($_POST['anccard'],$_POST['anccard']));
+}
+$nb=Database::num_row($res);
+ echo "";
+for ($i = 0;$i< $nb;$i++)
+{
+ $row=Database::fetch_array($res,$i);
+ echo "";
+ echo $row['po_name'];
+ echo ' '.$row['po_description'].' ';
+}
+ echo " ";
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_bank_saldo.php b/sources/include/ajax/ajax_bank_saldo.php
new file mode 100644
index 0000000..409d17b
--- /dev/null
+++ b/sources/include/ajax/ajax_bank_saldo.php
@@ -0,0 +1,75 @@
+check_jrn($_GET['j'])=='X' ) return '{"saldo":"0"}';
+/* make a filter on the exercice */
+
+$filter_year=" j_tech_per in (select p_id from parm_periode ".
+ "where p_exercice='".$g_user->get_exercice()."')";
+
+
+$id=$cn->get_value('select jrn_def_bank from jrn_def where jrn_def_id=$1',array($_GET['j']));
+if ( $id == '' ) {
+ echo '{"saldo":"ERR"}';
+ return;
+}
+$acc=new Fiche($cn,$id);
+
+$res=$acc->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)" );
+
+
+if ( empty($res) ) return '{"saldo":"0"}';
+$solde=$res['solde'];
+if ( $res['debit'] < $res['credit'] ) $solde=$solde*(-1);
+
+//header("Content-type: text/html; charset: utf8",true);
+
+echo '{"saldo":"'.$solde.'"}';
diff --git a/sources/include/ajax/ajax_bookmark.php b/sources/include/ajax/ajax_bookmark.php
new file mode 100644
index 0000000..854e42c
--- /dev/null
+++ b/sources/include/ajax/ajax_bookmark.php
@@ -0,0 +1,117 @@
+get_value("select count(*) from bookmark"
+ . " where b_action=$1 and login=$2",
+ array($_GET['ac'],$g_user->login)
+ );
+ // Add bookmark only if absent
+ if ( $count == 0 ){
+ $cn->exec_sql("insert into bookmark(b_action,login) values($1,$2)",
+ array($_GET['ac'],$g_user->login));
+ } else {
+ $js="error_message('"._("Ce favori a déjà été ajouté")."');";
+ echo create_script($js);
+ }
+}
+// remove bookmark
+if (isset($_GET['bookmark_delete']) && isset ($_GET['book'])){
+ $a_book=$_GET['book'];
+ for ($e=0;$eexec_sql("delete from bookmark where b_id=$1 and login=$2",
+ array($a_book[$e],$g_user->login));
+ }
+}
+
+$bookmark_sql="select distinct b_id,b_action,b_order,me_code,me_description, javascript"
+ . " from bookmark "
+ . "join v_menu_description_favori on (code=b_action or b_action=me_code)"
+ . "where "
+ . "login=$1 order by me_code";
+$a_bookmark=$cn->get_array($bookmark_sql,array($g_user->login));
+$url="do.php?gDossier=".Dossier::id()."&ac=";
+?>
+
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_boxcard_search.php b/sources/include/ajax/ajax_boxcard_search.php
new file mode 100644
index 0000000..e8668f9
--- /dev/null
+++ b/sources/include/ajax/ajax_boxcard_search.php
@@ -0,0 +1,102 @@
+get_array($sql,array($_GET['card']));
+echo HtmlInput::title_box(_("Résultat recherche"), "boxsearch_card_div");
+$max=(count($array)>MAX_CARD_SEARCH)?MAX_CARD_SEARCH:count($array);
+?>
+MAX_CARD_SEARCH ): ?>
+
+
+
+ :
+
+
+
+
+
+
+ Nom
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sources/include/ajax/ajax_calendar_zoom.php b/sources/include/ajax/ajax_calendar_zoom.php
new file mode 100644
index 0000000..4639e52
--- /dev/null
+++ b/sources/include/ajax/ajax_calendar_zoom.php
@@ -0,0 +1,61 @@
+get('in',"string","");
+$notitle=$http->get('notitle',"string","0");
+if ( $in == "") {
+ $in=$cal->get_preference();
+}
+$cal->set_periode($in);
+echo $cal->zoom($distype,$notitle);
+if ( $notitle== 0 ) {
+ echo '';
+ echo HtmlInput::button_close("calendar_zoom_div");
+ echo '
';
+}
+$response= ob_get_clean();
+
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/sources/include/ajax/ajax_card.php b/sources/include/ajax/ajax_card.php
new file mode 100644
index 0000000..d4a076b
--- /dev/null
+++ b/sources/include/ajax/ajax_card.php
@@ -0,0 +1,639 @@
+check(true);
+$g_user->check_dossier($gDossier,true);
+$html=var_export($_REQUEST,true);
+// For storing extra information , example the HTML elt id to update
+// after creating
+$extra="";
+switch($op2)
+{
+ /* ------------------------------------------------------------ */
+ /* Remove a attribut */
+ /* ------------------------------------------------------------ */
+case 'rmfa':
+ if ($g_user->check_action(FICCAT)==0)exit();
+ ob_start();
+ if( ! isset($_GET['ad_id']) || isNumber($_GET['ad_id']) ==0)
+ throw new Exception ( _("Parametre ad_id est invalide"),11);
+ $ad_id= $_GET['ad_id'];
+ try
+ {
+ $cn->start();
+ $fa=new Fiche_Attr($cn,$ad_id);
+ $fa->delete();
+ $cn->commit();
+ }
+ catch (Exception $e)
+ {
+ $cn->rollback();
+ record_log($e->getTraceAsString());
+ echo $e->getMessage();
+ }
+ $html=ob_get_contents();
+ ob_end_clean();
+ break;
+ /* ------------------------------------------------------------ */
+ /* Display card detail */
+ /* ------------------------------------------------------------ */
+
+case 'dc':
+ $f=new Fiche($cn);
+ /* add title + close */
+ $html=HtmlInput::title_box(_("Détail fiche"), $ctl,"close","","y");
+ if ( $qcode != '')
+ {
+ $f->get_by_qcode($qcode);
+ $can_modify=$g_user->check_action(FIC);
+ if ( isset($ro) )
+ {
+ $can_modify=0;
+ }
+ if ( $can_modify==1)
+ $card=$f->Display(false,$ctl);
+ else
+ $card=$f->Display(true);
+ if ( $card == 'FNT' )
+ {
+ $html.=''._('Fiche non trouvée').' ';
+ }
+ else
+ {
+
+ if ($can_modify==1)
+ {
+ $html.='';
+ }
+ }
+ }
+ else
+ {
+ $html.=''._('Aucune fiche demandée').' ';
+ }
+ break;
+ /* ------------------------------------------------------------ */
+ /* Blank card */
+ /* ------------------------------------------------------------ */
+case 'bc':
+ if ( $g_user->check_action(FICADD)==1 || $g_user->check_action(FIC)==1)
+ {
+ $r=HtmlInput::title_box(_("Nouvelle fiche"), $ctl);
+ /* get cat. name */
+ $cat_name=$cn->get_value('select fd_label from fiche_def where fd_id=$1',
+ array($fd_id));
+ $f=new Fiche($cn);
+ $r.='';
+ $html=$r;
+ }
+ else
+ {
+ $html=alert(_('Action interdite'),true);
+ }
+ break;
+ /* ------------------------------------------------------------ */
+ /* Show Type */
+ /* Before inserting a new card, the type must be selected */
+ /* ------------------------------------------------------------ */
+case 'st':
+ $sql="select fd_id,fd_label,fd_description from fiche_def";
+ /* if we filter thanks the ledger*/
+ if ( $ledger != -1 )
+ {
+ /* we want the card for deb or cred or both of this ledger */
+ switch( $fil )
+ {
+ case -1:
+ $l=new Acc_Ledger($cn,$ledger);
+ $where=' where fd_id in ('.$l->get_all_fiche_def().')';
+ break;
+ case 'cred':
+ $l=new Acc_Ledger($cn,$ledger);
+ $prop=$l->get_propertie();
+ if ( $prop['jrn_def_fiche_cred']=='')$prop=-1;
+ $where=' where fd_id in ('.$prop['jrn_def_fiche_cred'].')';
+ break;
+ case 'deb':
+ $l=new Acc_Ledger($cn,$ledger);
+ $prop=$l->get_propertie();
+ if ( $prop=='')$prop=-1;
+ $where=' where fd_id in ('.$prop['jrn_def_fiche_deb'].')';
+ break;
+ }
+ }
+ else
+ {
+ /* we filter thanks a given model of card */
+ if ( isset($cat))
+ {
+ $where=sprintf(' where frd_id in ('.sql_string ($cat).')');
+ }
+ else
+ /* we filter thanks a given list of category of card
+ */
+ if ( isset($fil) && strlen(trim($fil)) > 0 )
+ {
+ $where=sprintf(" where fd_id in (%s)",
+ sql_string($fil));
+ }
+ }
+ if ( strpos($where," in ()") != 0)
+ {
+ $html=_("Aucune catégorie de fiche ne correspond à ".
+ " votre demande, le journal pourrait n'avoir accès à aucune fiche");
+ break;
+ }
+ $sql.=" ".$where." order by fd_label";
+
+ $array=$cn->get_array($sql);
+
+ $list_fiche="";
+ if ( empty($array))
+ {
+ $html=_("Aucune catégorie de fiche ne correspond à votre demande");
+ if ( DEBUG ) $html.=$sql;
+ }
+ else
+ {
+ $html=HtmlInput::title_box(_("Choix de la catégorie"), $ctl);
+ $r='';
+
+ $r.='';
+ $r.='
';
+ $r.=_("Choisissez la catégorie de fiche à laquelle vous aimeriez ajouter une fiche").'
';
+ if ( ! isset($eltid)) $eltid="";
+ $msg=_('Choisissez une catégorie svp');
+ $r.='
';
+ $r.=dossier::hidden();
+ $r.=(isset($ref))?HtmlInput::hidden('ref',1):'';
+ $r.=_('Cherche').' '.HtmlInput::filter_table("cat_card_table", '0,1', 0);
+ $r.='
';
+ $r.=HtmlInput::hidden('fd_id',0);
+ $r.='
';
+ $r.=HtmlInput::button('Fermer',_('Fermer')," onclick=\"removeDiv('$ctl')\" ");
+ $r.='
';
+ $r.='
';
+ $html.=$r;
+
+ }
+ $xml=escape_xml($html);
+ header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+$ctl
+$xml
+{$list_fiche}
+
+EOF;
+return;
+
+ break;
+ /*----------------------------------------------------------------------
+ * SC save card
+ * save the new card (insert)
+ *
+ ----------------------------------------------------------------------*/
+case 'sc':
+ $html=HtmlInput::title_box(_("Choix de la catégorie"), $ctl);
+ if ( $g_user->check_action(FICADD)==1 )
+ {
+ $f=new Fiche($cn);
+ $status="OK ";
+ try {
+ $f->insert($fd_id,$_POST);
+ $f->Get();
+ $html.=''._('Fiche sauvée').' ';
+ $html.=$f->Display(true);
+ $js="";
+ if ( isset( $_POST['ref'])) $js=create_script(' window.location.reload()');
+ $html.=$js;
+ if ( isset ($eltid)) {
+ // after adding a new card, we update some field
+ $extra="$eltid ".
+ "{$f->get_quick_code ()} ";
+
+ }
+ $extra.=$status;
+ $html.=HtmlInput::button_close($ctl);
+ } catch (Exception $exc) {
+ $html=""._("Erreur sauvegarde")." ";
+ $html.=$exc->getMessage();
+ $status="NOK ";
+ $extra=$status;
+ }
+
+ }
+ else
+ {
+ $html.=alert(_('Action interdite'),true);
+ $html.=HtmlInput::button_close($ctl);
+ }
+ break;
+ /*----------------------------------------------------------------------
+ * Search a card
+ *
+ *----------------------------------------------------------------------*/
+case 'fs':
+ require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
+ $r=HtmlInput::title_box(_("Détail fiche"), 'search_card');
+ $r.='';
+?>
diff --git a/sources/include/ajax/ajax_display_letter.php b/sources/include/ajax/ajax_display_letter.php
new file mode 100644
index 0000000..c503243
--- /dev/null
+++ b/sources/include/ajax/ajax_display_letter.php
@@ -0,0 +1,236 @@
+get_exercice();
+if ($g_user->check_module("LETCARD")==0 && $g_user->check_module("LETACC")==0)
+ exit();
+$periode=new Periode($cn);
+list($first_per, $last_per)=$periode->get_limit($exercice);
+
+$ret=new IButton('return');
+$ret->label=_('Retour');
+$ret->javascript="$('detail').hide();$('list').show();$('search').show();";
+
+// retrieve info for the given j_id (date, amount,side and comment)
+$sql="select j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,J_POSTE,j_qcode,jr_id,
+ jr_comment,j_montant, j_debit,jr_internal from jrnx join jrn on (j_grpt=jr_grpt_id)
+ where j_id=$1";
+$arow=$cn->get_array($sql, array($j_id));
+$row=$arow[0];
+$r='';
+$r.=''._('Lettrage').' ';
+$r.=_('Poste')." ".$row['j_poste'].' '.$row['j_qcode'].' ';
+
+$detail=" ".$row['jr_internal']." ";
+
+$r.=_('Date').' : '.$row['j_date_fmt'].' ref :'.$detail.' ';
+$r.=h($row['jr_comment'])." "._("montant")." : ".($row['j_montant'])." ".(($row['j_debit']=='t')?'D':'C');
+$r.=' ';
+$r.='';
+
+$form='';
+
+$form.='';
+$form.='
';
+
+$html=$r.$form;
+$html.=$date_error;
+// echo $html;exit;
+$html=escape_xml($html);
+
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+detail
+$html
+
+EOF;
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_display_submenu.php b/sources/include/ajax/ajax_display_submenu.php
new file mode 100644
index 0000000..e23a830
--- /dev/null
+++ b/sources/include/ajax/ajax_display_submenu.php
@@ -0,0 +1,57 @@
+check_module('CFGPRO') == 0 ) die();
+
+require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+$http=new HttpInput();
+
+ob_start();
+try
+{
+ $module=$http->get("dep");
+ $p_level=$http->get("p_level", "number",0);
+ $p_id=$http->get('p_profile',"number");
+
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+require_once NOALYSS_INCLUDE.'/class/profile_menu.class.php';
+$p_level++;
+$profile=new Profile_Menu($cn);
+$profile->p_id=$p_id;
+$profile->display_module_menu($module,$p_level);
+
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_fiche_def_detail.php b/sources/include/ajax/ajax_fiche_def_detail.php
new file mode 100644
index 0000000..2b01b9c
--- /dev/null
+++ b/sources/include/ajax/ajax_fiche_def_detail.php
@@ -0,0 +1,48 @@
+can_request(FICCAT,0);
+$http=new HttpInput();
+$id=$http->get("id","number");
+$fd=new Fiche_Def($cn,$id);
+if ( $id > 0 )
+{
+
+ echo $fd->input_detail();
+ echo HtmlInput::button("retour_b", _("Retour à la liste"), "onclick=\"$('detail_category_div').hide();$('list_cat_div').show()\"");
+}
+else
+{
+ $fd->input_new();
+
+}
+?>
diff --git a/sources/include/ajax/ajax_follow_up.php b/sources/include/ajax/ajax_follow_up.php
new file mode 100644
index 0000000..bc99e37
--- /dev/null
+++ b/sources/include/ajax/ajax_follow_up.php
@@ -0,0 +1,74 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+require_once NOALYSS_INCLUDE."/class/document.class.php";
+require_once NOALYSS_INCLUDE."/lib/inplace_edit.class.php";
+/**
+ * @file
+ * @brief Update description on file
+ */
+$op=$http->request('op');
+global $g_user;
+
+if ($op=='update_comment_followUp')
+{
+ $input=$http->request('input');
+ $action=$http->request('ieaction', 'string', 'display');
+ $d_id=$http->request('d_id', "number");
+
+ // Build inplace input
+ $inplace_description=Inplace_Edit::build($input);
+ $inplace_description->set_callback("ajax_misc.php");
+ $inplace_description->add_json_param("d_id", $d_id);
+ $inplace_description->add_json_param("gDossier", Dossier::id());
+ $inplace_description->add_json_param("op", "update_comment_followUp");
+ switch ($action)
+ {
+ case 'display':
+ echo $inplace_description->ajax_input();
+
+ break;
+ case 'ok':
+ if ($g_user->check_action(VIEWDOC)==1)
+ {
+ $value=$http->request('value');
+ $doc=new Document($cn, $d_id);
+ $doc->get();
+ if ($g_user->can_write_action($doc->ag_id))
+ {
+ // retrieve the document
+ $doc->update_description(strip_tags($value));
+ }
+ $inplace_description->set_value($value);
+ }
+
+ echo $inplace_description->value();
+ break;
+ case 'cancel':
+ echo $inplace_description->value();
+ break;
+ default:
+ throw new Exception(__FILE__.':'.__LINE__.'Invalide value');
+ break;
+ }
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_gestion.php b/sources/include/ajax/ajax_gestion.php
new file mode 100644
index 0000000..814e383
--- /dev/null
+++ b/sources/include/ajax/ajax_gestion.php
@@ -0,0 +1,134 @@
+get_last(35);
+ $len_array=count($array);
+ require_once NOALYSS_TEMPLATE.'/action_show.php';
+ return;
+}
+if ($op=='action_add')
+{
+ require_once NOALYSS_INCLUDE.'/class/follow_up.class.php';
+ $gestion=new Follow_Up($cn);
+ $gestion->display_short();
+ return;
+}
+if ($op=='action_save')
+{
+ require_once NOALYSS_INCLUDE.'/class/follow_up.class.php';
+
+ /**
+ * save info from the get
+ */
+ try
+ {
+ $date_event=$http->get("date_event","string","");
+ $dest=$http->get("dest","string", "");
+ $event_group=$http->get("event_group", "string",0);
+ $event_priority=$http->get("event_priority", "string",0);
+ $title=$http->get("title_event","string", NULL);
+ $summary=$http->get("summary","string", "");
+ $type_event=$http->get('type_event', "string",-1);
+ $hour_event=$http->get('hour_event', "string",null);
+ if ($date_event==-1||isDate($date_event)==0)
+ throw new Exception(_('Date invalide'));
+ if (trim($dest)=="")
+ $dest_id=NULL;
+ else
+ {
+ $fiche=new Fiche($cn);
+ $fiche->get_by_qcode($dest);
+ $dest_id=$fiche->id;
+ if ($dest_id==0)
+ throw new Exception(_('Destinataire invalide'));
+ }
+ if ($type_event==-1)
+ throw new Exception(_('Type invalide'));
+ if (trim($title)=="")
+ throw new Exception(_('Aucun titre'));
+ }
+ catch (Exception $ex)
+ {
+ record_log($ex->getTraceAsString());
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $xml_content=$dom->createElement('content', $ex->getMessage());
+ $xml_status=$dom->createElement('status', "NOK");
+ $root=$dom->createElement("root");
+ $root->appendChild($xml_content);
+ $root->appendChild($xml_status);
+ $dom->appendChild($root);
+ echo $dom->saveXML();
+ return;
+ }
+ /*
+ * Save data
+ */
+ $gestion=new Follow_Up($cn);
+ $gestion->ag_priority=$event_priority;
+ $gestion->ag_title=$title;
+ $gestion->ag_dest=$event_group;
+ $gestion->ag_type=$type_event;
+ $gestion->f_id_dest=$dest_id;
+ $gestion->ag_state=3;
+ $gestion->dt_id=$type_event;
+ $gestion->ag_comment=h($summary);
+ $gestion->ag_timestamp=$date_event;
+ $gestion->ag_remind_date=$date_event;
+ $gestion->ag_hour=$hour_event;
+ $content=_('Sauvé');
+ $status='OK';
+ try {
+ $gestion->save_short();
+ } catch (Exception $ex)
+ {
+ record_log($ex->getTraceAsString());
+ $content=$ex->getMessage();
+ $status='NOK';
+ }
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $xml_content=$dom->createElement('content', $content);
+ $xml_status=$dom->createElement('status', $status);
+ $root=$dom->createElement("root");
+ $root->appendChild($xml_content);
+ $root->appendChild($xml_status);
+ $dom->appendChild($root);
+ echo $dom->saveXML();
+ return;
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_get_menu_detail.php b/sources/include/ajax/ajax_get_menu_detail.php
new file mode 100644
index 0000000..16dd63b
--- /dev/null
+++ b/sources/include/ajax/ajax_get_menu_detail.php
@@ -0,0 +1,81 @@
+get_value("select p_id from profile_menu where pm_id=$1",array($pm_id));
+$a_value=$cn->make_array("select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') from menu_ref",0);
+
+$array=$cn->get_array("select p_id,pm_id,me_code,me_code_dep,p_order,p_type_display,pm_default
+ from profile_menu
+ where pm_id=$1",array($pm_id));
+if ( empty($array)) {
+ alert("Code invalide");
+ exit();
+}
+
+
+echo HtmlInput::title_box($array[0]['me_code'],'divdm'.$pm_id);
+
+$me_code=new ISelect('me_code');
+$me_code->value=$a_value;
+$me_code->selected=$array[0]['me_code'];
+
+$p_order=new Inum('p_order',$array[0]['p_order']);
+$pm_default=new ICheckBox('pm_default','1');
+$pm_default->set_check($array[0]['pm_default']);
+
+?>
+';
+ }
+ }
+ ob_start();
+ $result=$fiche->HtmlTable($array,0,$from_div);
+ $table=ob_get_contents();
+ ob_end_clean();
+
+
+ ob_start();
+ require_once NOALYSS_TEMPLATE.'/history_top.php';
+ $detail_card=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),$fiche->getName());
+ echo h2( $fiche->getName().'['.$fiche->strAttribut(ATTR_DEF_QUICKCODE).']',' class="title" ');
+ echo ''.$detail_card.'
';
+
+ if ( $result ==-1){
+ echo h2(_("Aucune opération pour l'exercice courant"),'class="error"');
+ } else {
+ echo $fiche->filter_history("tb".$div);
+ echo $table;
+ echo $fiche->button_csv($array['from_periode'],$array['to_periode']);
+ echo $fiche->button_pdf($array['from_periode'],$array['to_periode']);
+ }
+
+ echo $old;
+
+ $html=ob_get_contents();
+ ob_end_clean();
+ }
+ }
+///////////////////////////////////////////////////////////////////////////
+// for an account
+///////////////////////////////////////////////////////////////////////////
+if ( isset($_REQUEST['pcm_val']))
+ {
+ $poste=new Acc_Account_Ledger($cn,$_REQUEST['pcm_val']);
+ $poste->load();
+ $year=$http->get("exercice","string","");
+ if ( $year == "") $year=$g_user->get_exercice();
+ if ( $year == 0 )
+ {
+ $html=_("erreur aucune période par défaut, allez dans préférence pour en choisir une");
+ }
+ else
+ {
+ $exercice=new Exercice($cn);
+ $old='';
+ $per=new Periode($cn);
+ $limit_periode=$per->get_limit($year);
+ $array['from_periode']=$limit_periode[0]->first_day();
+ $array['to_periode']=$limit_periode[1]->last_day();
+ if (isset($_GET['ex']))
+ {
+ $ex=$http->get("ex","number");
+ $limit_periode=$per->get_limit($ex);
+ if ( $ex < $year)
+ $array['from_periode']=$limit_periode[0]->first_day();
+ else
+ $array['to_periode']=$limit_periode[1]->last_day();
+
+ }
+ /*
+ * Add button to select another year
+ */
+ if ($exercice->count() > 1 )
+ {
+ $default=$http->get("ex","number",$year);
+ $dossier=dossier::id();
+ if ( $div != 'popup')
+ {
+ $obj="{op:'history',div:'$div',pcm_val:'".$_GET['pcm_val']."',gDossier:'$dossier',select:this,exercice:{$year}}";
+ $is=$exercice->select('p_exercice',$default,' onchange="update_history_account('.$obj.');"');
+ $old=_("Autre exercice")." ".$is->input();
+ }
+ else
+ {
+ $old='';
+ }
+
+ }
+ ob_start();
+ $result=$poste->HtmlTable($array,0,$from_div);
+ $table=ob_get_contents();
+ ob_end_clean();
+
+ ob_start();
+
+ require_once NOALYSS_TEMPLATE.'/history_top.php';
+ echo h2( $poste->id." ".h($poste->label),' class="title" ');
+
+
+ if ( $result == -1)
+ {
+ echo h2(_("Aucune opération pour l'exercice courant"),'class="error"');
+ } else {
+ echo $poste->filter_history('tb'.$div);
+ echo $table;
+ echo $poste->button_csv($array['from_periode'],$array['to_periode']);
+ echo $poste->button_pdf($array['from_periode'],$array['to_periode']);
+ }
+ echo $old;
+
+ $html=ob_get_contents();
+ ob_end_clean();
+ }
+ }
+$xml=escape_xml($html);
+if (DEBUG && headers_sent()) {
+ echo $html;return;
+}
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+$div
+$xml
+
+EOF;
diff --git a/sources/include/ajax/ajax_history_anc_account.php b/sources/include/ajax/ajax_history_anc_account.php
new file mode 100644
index 0000000..73036ae
--- /dev/null
+++ b/sources/include/ajax/ajax_history_anc_account.php
@@ -0,0 +1,69 @@
+
+
+if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief Display the history of an analytic account.
+ * Receives the parameters GET:
+ - gDossier integer
+ - act history_anc_account
+ - po_id integer poste_analytic.po_id
+ - div DOM ID of the box
+ - op history
+ - exercice integer
+ */
+require_once NOALYSS_INCLUDE."/class/anc_grandlivre.class.php";
+
+try {
+ $po_id=$http->get("po_id","number");
+ $exercice=$http->get("exercice","number");
+ $div=$http->get("div");
+} catch (Exception $ex) {
+ echo $ex->getTraceAsString();
+ throw $ex;
+}
+$poste_analytic=new Poste_analytique_SQL($cn, $po_id);
+
+$anc_grandlivre=new Anc_GrandLivre($cn);
+
+$anc_grandlivre->from_poste=$poste_analytic->po_name;
+$anc_grandlivre->to_poste=$poste_analytic->po_name;
+
+// Find the first and last periode
+$periode=new Periode($cn);
+$a_periode_limit=$periode->limit_year($exercice);
+
+// Find the first day
+$first_day=$periode->first_day($a_periode_limit['start']);
+
+// find the last day
+$last_day=$periode->last_day($a_periode_limit['end']);
+
+$anc_grandlivre->from=$first_day;
+$anc_grandlivre->to=$last_day;
+
+echo HtmlInput::title_box($poste_analytic->getp("po_name"), $div, "close", "", "n");
+
+echo $anc_grandlivre->display_html(0);
+$anc_grandlivre->pa_id=$poste_analytic->pa_id;
+echo $anc_grandlivre->show_button();
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_ledger.php b/sources/include/ajax/ajax_ledger.php
new file mode 100644
index 0000000..199e311
--- /dev/null
+++ b/sources/include/ajax/ajax_ledger.php
@@ -0,0 +1,590 @@
+request('act');
+ $jr_id=$http->request('jr_id');
+ $div=$http->request('div'); /* the div source and target for javascript */
+ $gDossier=dossier::id();
+
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+/**
+ *if $_SESSION['g_user'] is not set : echo a warning
+ */
+
+$cn=Dossier::connect();
+$g_parameter=new Noalyss_Parameter_Folder($cn);
+
+$g_user->check();
+if ( $g_user->check_dossier(dossier::id(),true)=='X' )
+{
+ ob_start();
+ require_once NOALYSS_TEMPLATE.'/ledger_detail_forbidden.php';
+ echo HtmlInput::button_close($div);
+ $html=ob_get_contents();
+ ob_end_clean();
+ $html=escape_xml($html);
+ header('Content-type: text/xml; charset=UTF-8');
+ echo <<
+
+$div
+$html
+
+EOF;
+ exit();
+}
+
+
+// check if the user can access the ledger where the operation is (view) and
+// if he can modify it
+$op=new Acc_Operation($cn);
+$op->jr_id=$jr_id;
+$ledger=$op->get_ledger();
+if ($ledger=="")
+{
+
+ ob_start();
+ echo HtmlInput::title_box(_("Information"), $div);
+ require_once NOALYSS_TEMPLATE.'/ledger_detail_forbidden.php';
+ echo HtmlInput::button_close($div);
+ $html=ob_get_contents();
+ ob_end_clean();
+
+ $html=escape_xml($html);
+ if ( ! headers_sent()) { header('Content-type: text/xml; charset=UTF-8');} else { echo "HTML".unescape_xml($html);}
+ echo <<
+
+$div
+$html
+
+EOF;
+ exit();
+
+}
+$access=$g_user->get_ledger_access($ledger);
+if ( $access == 'X' )
+{
+ ob_start();
+ echo HtmlInput::title_box(_("Information"), $div);
+ require_once NOALYSS_TEMPLATE.'/ledger_detail_forbidden.php';
+ echo HtmlInput::button_close($div);
+ $html=ob_get_contents();
+ ob_end_clean();
+ $html=escape_xml($html);
+ header('Content-type: text/xml; charset=UTF-8');
+ echo <<
+
+$div
+$html
+
+EOF;
+ exit();
+}
+$html=var_export($_REQUEST,true);
+switch ($action)
+{
+ ///////////////////////////////////////////////////////////////////////////
+ // remove op
+ ///////////////////////////////////////////////////////////////////////////
+case 'rmop':
+ if ( $access=='W' && $g_user->check_action(RMOPER) == 1)
+ {
+ ob_start();
+ /* get the ledger */
+ try
+ {
+ $cn->start();
+ $oLedger=new Acc_Ledger($cn,$ledger);
+ $oLedger->jr_id=$jr_id=$http->request('jr_id',"number");
+ $oLedger->delete();
+ $cn->commit();
+ echo _("Opération Effacée");
+ }
+ catch (Exception $e)
+ {
+ record_log($e->getTraceAsString());
+ $e->getMessage();
+ $cn->rollback();
+ }
+ $html=ob_get_contents();
+ ob_end_clean();
+ }
+ else
+ {
+ $html= _("Effacement refusé");
+ }
+ break;
+ //////////////////////////////////////////////////////////////////////
+ // DE Detail
+ //////////////////////////////////////////////////////////////////////
+case 'de':
+ ob_start();
+
+ try
+ {
+ /* get detail op (D/C) */
+ $op->get();
+ /* return an obj. ACH / FIN or VEN or null if nothing is found*/
+ $obj=$op->get_quant();
+
+ $oLedger=new Acc_Ledger($cn,$ledger);
+ if ( $obj==null || $obj->signature == 'ODS' )
+ {
+ /* only the details */
+ require_once NOALYSS_TEMPLATE.'/ledger_detail_misc.php';
+ }
+ elseif ( $obj->signature=='ACH')
+ {
+ require_once NOALYSS_TEMPLATE.'/ledger_detail_ach.php';
+ }
+ elseif ($obj->signature=='FIN')
+ {
+ require_once NOALYSS_TEMPLATE.'/ledger_detail_fin.php';
+ }
+ elseif ( $obj->signature=='VEN')
+ {
+ require_once NOALYSS_TEMPLATE.'/ledger_detail_ven.php';
+ }
+ }
+ catch (Exception $e)
+ {
+ record_log($e->getTraceAsString());
+ echo Icon_Action::close($div);
+ echo ''._("Désolé il y a une erreur").' ';
+ }
+ $html=ob_get_contents();
+ ob_end_clean();
+
+ break;
+ /////////////////////////////////////////////////////////////////////////////
+ // form for the file
+ /////////////////////////////////////////////////////////////////////////////
+case 'file':
+ $op->get();
+ $obj=$op->get_quant(); /* return an obj. ACH / FIN or VEN or null if nothing is found*/
+
+ $repo = new Database();
+ $theme = $repo->get_value("select the_filestyle from theme where the_name=$1", array($_SESSION['g_theme']));
+ html_min_page_start($theme);
+
+ // if there is a receipt document
+ if ( $obj->det->jr_pj_name=='')
+ {
+ if ( ! isset($_REQUEST['ajax']) ) {
+ echo '';
+ }else {
+ echo "
";
+
+ }
+ if ( $access=='W')
+ {
+ echo '
';
+ }
+ else
+ {
+ if (!isset($_REQUEST['ajax']))
+ {
+ echo '
';
+ }
+ else
+ {
+ echo "
";
+ }
+
+
+ echo _('Aucun fichier');
+ }
+ echo '
';
+ exit();
+ }
+ else
+ {
+ // There is no document attached to this writing
+ //
+ if ( ! isset($_REQUEST['ajax']) ) {
+ echo '
';
+ }else {
+ echo "
";
+
+ }
+ echo '
';
+ $x='';
+ if ($access=='W' && $g_user->check_action (RMRECEIPT) == 1)
+ {
+ // Not possible to remove the file thanks a modal dialog box,
+ // because of the frameset
+ $x=sprintf('
'.SMALLX.' ',
+ $gDossier,$div,$jr_id);
+
+ }
+ $filename= $obj->det->jr_pj_name;
+ if ( strlen($obj->det->jr_pj_name) > 20 )
+ {
+ $filename=mb_substr($obj->det->jr_pj_name,0,23);
+ }
+ echo HtmlInput::show_receipt_document($jr_id,h($filename));
+ echo $x;
+ echo '
';
+ echo '';
+ exit();
+ }
+/////////////////////////////////////////////////////////////////////////////
+// load a file
+/////////////////////////////////////////////////////////////////////////////
+case 'loadfile':
+ if ( $access == 'W' && isset ($_FILES))
+ {
+ $cn->start();
+ // remove the file
+ $grpt=$cn->get_value('select jr_grpt_id from jrn where jr_id=$1',array($jr_id));
+ $cn->save_receipt($grpt);
+ $cn->commit();
+ // Show a link to the new file
+ $op->get();
+ $obj=$op->get_quant(); /* return an obj. ACH / FIN or VEN or null if nothing is found*/
+
+ echo "";
+ $repo=new Database();
+ $theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION['g_theme']));
+ echo "
";
+ echo "";
+ if ( ! isset($_REQUEST['ajax']) ) echo ""; else echo "";
+ echo "
"._("Document")." ";
+ echo '
';
+
+ // check if the user can remove a document
+ if ($g_user->check_action (RMRECEIPT) == 1) {
+ // Not possible to remove the file thanks a modal dialog box,
+ // because of the frameset
+ $x=sprintf('
'.SMALLX.' ',
+ $gDossier,$div,$jr_id);
+ echo $x;
+ }
+ $filename= $obj->det->jr_pj_name;
+ echo HtmlInput::show_receipt_document($jr_id,h($filename));
+
+ echo '
';
+
+ }
+ exit();
+/////////////////////////////////////////////////////////////////////////////
+// remove a file
+/////////////////////////////////////////////////////////////////////////////
+case 'rmf':
+ if ( $access == 'W' && $g_user->check_action (RMRECEIPT) == 1)
+ {
+ echo "";
+ $repo=new Database();
+ $theme=$repo->get_value("select the_filestyle from theme where the_name=$1",array($_SESSION['g_theme']));
+ echo "
";
+ echo "";
+ echo "
"._("Document")." ";
+ echo '
';
+ echo '';
+ $ret=$cn->exec_sql("select jr_pj from jrn where jr_id=$1",array($jr_id));
+ if (Database::num_row($ret) != 0)
+ {
+ $r=Database::fetch_array($ret,0);
+ $old_oid=$r['jr_pj'];
+ if (strlen($old_oid) != 0)
+ {
+ // check if this pj is used somewhere else
+ $c=$cn->count_sql("select * from jrn where jr_pj=".$old_oid);
+ if ( $c == 1 )
+ $cn->lo_unlink($old_oid);
+ }
+ $cn->exec_sql("update jrn set jr_pj=null, jr_pj_name=null, ".
+ "jr_pj_type=null where jr_id=$1",array($jr_id));
+ }
+ }
+ echo '
';
+ exit();
+/////////////////////////////////////////////////////////////////////////////
+// Save operation detail
+/////////////////////////////////////////////////////////////////////////////
+case 'save':
+ ob_start();
+ try
+ {
+ $cn->start();
+ if ( $access=="W")
+ {
+ if (isset($_POST['p_ech']) )
+ {
+ $ech=$_POST['p_ech'];
+ if ( trim($ech) != '' && isDate($ech) != null)
+ {
+ $cn->exec_sql("update jrn set jr_ech=to_date($1,'DD.MM.YYYY') where jr_id=$2",
+ array($ech,$jr_id));
+
+ }
+ else
+ {
+ $cn->exec_sql("update jrn set jr_ech=null where jr_id=$1",
+ array($jr_id));
+
+ }
+ }
+
+ if (isset($_POST['p_date_paid']) )
+ {
+ $ech=$_POST['p_date_paid'];
+ if ( trim($ech) != '' && isDate($ech) != null)
+ {
+ $cn->exec_sql("update jrn set jr_date_paid=to_date($1,'DD.MM.YYYY') where jr_id=$2",
+ array($ech,$jr_id));
+
+ }
+ else
+ {
+ $cn->exec_sql("update jrn set jr_date_paid=null where jr_id=$1",
+ array($jr_id));
+
+ }
+ }
+
+ $cn->exec_sql("update jrn set jr_comment=$1,jr_pj_number=$2,jr_date=to_date($4,'DD.MM.YYYY'),jr_optype=$5 where jr_id=$3",
+ array($_POST['lib'],$_POST['npj'],$jr_id,$_POST['p_date'],$_POST['jr_optype']));
+ $cn->exec_sql("update jrnx set j_date=to_date($1,'DD.MM.YYYY') where j_grpt in (select jr_grpt_id from jrn where jr_id=$2)",
+ array($_POST['p_date'],$jr_id));
+ $cn->exec_sql('update operation_analytique set oa_date=j_date from jrnx
+ where
+ operation_analytique.j_id=jrnx.j_id and
+ operation_analytique.j_id in (select j_id
+ from jrnx join jrn on (j_grpt=jr_grpt_id)
+ where jr_id=$1)
+ ',array($jr_id));
+ $cn->exec_sql("select comptaproc.jrn_add_note($1,$2)",
+ array($jr_id,$_POST['jrn_note']));
+ $rapt=$_POST['rapt'];
+
+ if ( $g_parameter->MY_UPDLAB=='Y' && isset ($_POST['j_id']))
+ {
+ $a_rowid=$_POST["j_id"];
+ for ($e=0;$e
exec_sql('update jrnx set j_text=$1 where j_id=$2', array(strip_tags($_POST[$id]),$a_rowid[$e]));
+ }
+ }
+ if (trim($rapt) != '')
+ {
+ $rec=new Acc_Reconciliation ($cn);
+ $rec->set_jr_id($jr_id);
+
+ if (strpos($rapt,",") != 0 )
+ {
+ $aRapt=explode(',',$rapt);
+ /* reconcialition */
+ foreach ($aRapt as $rRapt)
+ {
+ if ( isNumber($rRapt) == 1 )
+ {
+ // Add a "concerned operation to bound these op.together
+ $rec->insert($rRapt);
+ }
+ }
+ }
+ else
+ if ( isNumber($rapt) == 1 )
+ {
+ $rec->insert($rapt);
+ }
+ }
+ if ( isset($_POST['ipaid']))
+ {
+ $cn->exec_sql("update jrn set jr_rapt='paid' where jr_id=$1",array($jr_id));
+ }
+ else
+ {
+ $cn->exec_sql("update jrn set jr_rapt=null where jr_id=$1",array($jr_id));
+ }
+ ////////////////////////////////////////////////////
+ // CA
+ //////////////////////////////////////////////////
+ $owner = new Noalyss_Parameter_Folder($cn);
+ if ( $owner->MY_ANALYTIC != "nu" && isset ($_POST['op']) )
+ {
+ // for each item, insert into operation_analytique */
+ $opanc=new Anc_Operation($cn);
+ $opanc->save_update_form($_POST);
+ }
+ //////////////////////////////////////////////////////////////////
+ //Save other info
+ //////////////////////////////////////////////////////////////////
+ $op->save_info($_POST['OTHER'],'OTHER');
+ $op->save_info($_POST['BON_COMMANDE'],'BON_COMMANDE');
+
+ ///////////////////////////////////////////////////////////////////
+ // Save related
+ //////////////////////////////////////////////////////////////////
+ $related=$http->post("related","string");
+ if ($related == "0" )
+ throw new Exception('Parameter not send -> related'.__FILE__.__LINE__,10);
+ $op->insert_related_action($related);
+
+ }
+ echo _('Opération sauvée');
+ $cn->commit();
+ }
+ catch (Exception $e)
+ {
+ record_log($e->getTraceAsString());
+ if ( DEBUG ) echo $e->getMessage();
+ alert(_( "Changement impossible: on ne peut pas changer la date dans une période fermée"));
+ }
+ $html=ob_get_contents();
+ ob_end_clean();
+
+ break;
+ ////////////////////////////////////////////////////////////////////////////
+ // remove a reconciliation
+ ////////////////////////////////////////////////////////////////////////////
+case 'rmr':
+ if ( $access=='W')
+ {
+ $rec=new Acc_Reconciliation($cn);
+ $rec->set_jr_id($jr_id);
+ $rec->remove($_GET['jr_id2']);
+ }
+ break;
+ ////////////////////////////////////////////////////////////////////////////
+ // ask for a date for reversing the operation
+ ////////////////////////////////////////////////////////////////////////////
+case 'ask_extdate':
+ $date=new IDate('p_date');
+ $html.="';
+ break;
+ ////////////////////////////////////////////////////////////////////////////
+ // Reverse an operation
+ ////////////////////////////////////////////////////////////////////////////
+case 'reverseop':
+ if ( $access=='W')
+ {
+ ob_start();
+ try
+ {
+ $ext_date=$http->request("ext_date","date");
+ $ext_label=$http->request("ext_label");
+ $cn->start();
+ $oLedger=new Acc_Ledger($cn,$ledger);
+ $oLedger->jr_id=$jr_id;
+ if ( trim($ext_label) == "" ) {
+ $ext_label=_("Extourne").$cn->get_value("select jr_comment from jrn where jr_id=$1",[$jr_id]);
+ }
+ $oLedger->reverse($ext_date,$ext_label);
+ $cn->commit();
+ echo _("Opération extournée");
+ }
+ catch (Exception $e)
+ {
+ record_log($e->getTraceAsString());
+ echo $e->getMessage();
+ $cn->rollback();
+ }
+ }
+ $html=ob_get_contents();
+ ob_end_clean();
+ break;
+}
+$html=escape_xml($html);
+ if ( ! headers_sent()) { header('Content-type: text/xml; charset=UTF-8');} else { echo "HTML".unescape_xml($html);}
+
+ echo <<
+
+$div
+$html
+
+EOF;
diff --git a/sources/include/ajax/ajax_ledger_show.php b/sources/include/ajax/ajax_ledger_show.php
new file mode 100644
index 0000000..d948115
--- /dev/null
+++ b/sources/include/ajax/ajax_ledger_show.php
@@ -0,0 +1,37 @@
+select_ledger($r_jrn,$div);
+
+$response = ob_get_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+$ctl
+$html
+
+EOF;
+exit();
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_min_row.php b/sources/include/ajax/ajax_min_row.php
new file mode 100644
index 0000000..bd92ec2
--- /dev/null
+++ b/sources/include/ajax/ajax_min_row.php
@@ -0,0 +1,48 @@
+check_jrn($_GET['j'])=='X' ) { echo '{"row":"0"}';exit();}
+
+$row=$cn->get_value('select jrn_deb_max_line from jrn_def where jrn_def_id=$1',array($_GET['j']));
+
+echo '{"row":"'.$row.'"}';
+
+?>
diff --git a/sources/include/ajax/ajax_mod_document.php b/sources/include/ajax/ajax_mod_document.php
new file mode 100644
index 0000000..88a48e9
--- /dev/null
+++ b/sources/include/ajax/ajax_mod_document.php
@@ -0,0 +1,52 @@
+load();
+ob_start();
+require(NOALYSS_TEMPLATE.'/modele_document.php');
+
+$html=ob_get_contents();
+ob_end_clean();
+$html=escape_xml($html);
+header('Content-type: text/xml; charset=UTF-8');
+
+echo <<
+
+mod_doc
+$html
+
+EOF;
+exit();
diff --git a/sources/include/ajax/ajax_mod_menu.php b/sources/include/ajax/ajax_mod_menu.php
new file mode 100644
index 0000000..40d0ac7
--- /dev/null
+++ b/sources/include/ajax/ajax_mod_menu.php
@@ -0,0 +1,21 @@
+me_code.' '.h($m->me_menu);
+echo '';
+?>
diff --git a/sources/include/ajax/ajax_mod_predf_op.php b/sources/include/ajax/ajax_mod_predf_op.php
new file mode 100644
index 0000000..c0eaa4c
--- /dev/null
+++ b/sources/include/ajax/ajax_mod_predf_op.php
@@ -0,0 +1,75 @@
+load();
+echo HtmlInput::title_box(_('Modification du nom'),'mod_predf_op','close','','n');
+
+echo '
+ ';
+
+
+$html1 = ob_get_contents();
+ob_end_clean();
+$html = escape_xml($html1);
+if (headers_sent() )
+ {
+ echo $html1;
+ }
+else {
+ header('Content-type: text/xml; charset=UTF-8');
+}
+echo <<
+
+mod_predf_op
+$html
+
+EOF;
diff --git a/sources/include/ajax/ajax_mod_stock_repo.php b/sources/include/ajax/ajax_mod_stock_repo.php
new file mode 100644
index 0000000..738245d
--- /dev/null
+++ b/sources/include/ajax/ajax_mod_stock_repo.php
@@ -0,0 +1,80 @@
+
+
+
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_navigator.php b/sources/include/ajax/ajax_navigator.php
new file mode 100644
index 0000000..757b370
--- /dev/null
+++ b/sources/include/ajax/ajax_navigator.php
@@ -0,0 +1,120 @@
+get_array($sql,array($_SESSION['g_user']));
+
+?>
+
+
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_periode.php b/sources/include/ajax/ajax_periode.php
new file mode 100644
index 0000000..6dd4938
--- /dev/null
+++ b/sources/include/ajax/ajax_periode.php
@@ -0,0 +1,299 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief display or save a periode variable received $op, $cn $g_user
+ * variable :
+ * act
+ * - close : close a periode
+ * - reopen : reopen a periode
+ * - show : display a form for modifying / adding a period
+ * - remove : delete a period IF not used
+ *
+ * ledger_id is the SQL id of ledger
+ *
+ * p_id is either the SQL id of parm_periode of jrn_periode, depending if
+ * ledger_id == 0 or not
+ * The answer must be in JSON
+ */
+require_once NOALYSS_INCLUDE.'/class/periode.class.php';
+require_once NOALYSS_INCLUDE.'/class/periode_ledger.class.php';
+
+$err=0;
+$a_answer=[];
+$a_answer['status']="NOK";
+$http=new HttpInput();
+try
+{
+// action to perform
+ $act=$http->request("act");
+// Periode id
+ $periode_id=$http->request("p_id", "number");
+// Ledger id
+ $ledger_id=$http->request("ledger_id", "number");
+// Name of the javascript variable
+ $js_var=$http->request("js_var");
+}
+catch (Exception $ex)
+{
+ $a_answer['content']=$ex->getMessage();
+ $jsson=json_encode($a_answer,
+ JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
+ header('Content-Type: application/json;charset=utf-8');
+ echo $jsson;
+ return;
+}
+/* we check the security */
+if ($g_user->check_module("PERIODE")==0)
+{
+ return;
+}
+
+switch ($act)
+{
+// Reopen a periode for specific ledger if ledger_id != 0, or all
+// the periodes if ledger_id=0
+ case 'reopen':
+ try
+ {
+ if ($ledger_id==0)
+ {
+ $per=new Periode($cn, $periode_id);
+ $per->set_ledger(0);
+ $per->reopen();
+ $parm_periode=new Parm_periode_SQL($cn, $periode_id);
+ ob_start();
+ Periode::display_row_global($parm_periode, 0, $js_var);
+ $a_answer['content']=ob_get_clean();
+ }
+ else
+ {
+ $id=$http->post("p_id", "number");
+ $jrn_periode=new Jrn_periode_SQL($cn, $p_id);
+ $per_led=new Periode_Ledger($jrn_periode);
+ $per_led->reopen();
+ ob_start();
+ $per_led_table=new Periode_Ledger_Table($periode_id);
+ $per_led_table->display_row($per_led_table->get_a_member(), 0,
+ $js_var);
+ $a_answer['content']=ob_get_clean();
+ }
+ $a_answer["status"]="OK";
+ }
+ catch (Exception $ex)
+ {
+ $a_answer['content']=$ex->getMessage();
+ }
+ break;
+// Close a periode for specific ledger if ledger_id != 0, or all
+// the periodes if ledger_id=0
+ case 'close':
+ try
+ {
+ if ($ledger_id==0)
+ {
+ $per=new Periode($cn, $periode_id);
+ $per->close();
+ $parm_periode=new Parm_periode_SQL($cn, $periode_id);
+ ob_start();
+ Periode::display_row_global($parm_periode, 0, $js_var);
+ $a_answer['content']=ob_get_clean();
+ }
+ else
+ {
+ $jrn_periode=new Jrn_periode_SQL($cn, $periode_id);
+ $per_led=new Periode_Ledger($jrn_periode);
+ $per_led->close();
+ ob_start();
+ $per_led_table=new Periode_Ledger_Table($periode_id);
+ $per_led_table->display_row($per_led_table->get_a_member(), 0,
+ $js_var);
+ $a_answer['content']=ob_get_clean();
+ }
+ $a_answer["status"]="OK";
+ }
+ catch (Exception $ex)
+ {
+ $a_answer['content']=$ex->getMessage();
+ }
+ break;
+// Add a new periode , only if ledger_id == 0
+ case 'show':
+ $per=new Periode($cn, $periode_id);
+ $per->load();
+
+ $p_exercice=new INum('p_exercice');
+ $limit=$per->get_date_limit($periode_id);
+ $p_exercice->value=$per->p_exercice;
+ $title=_('Modification période');
+ $title_par=""._('Modifier les dates de début et fin de période').
+ "
";
+ $title_par.=''._('Cela pourrait avoir un impact sur les opérations déjà existantes').'
';
+
+ $p_start=new IDate('p_start');
+ $p_start->value=$limit['p_start'];
+ $p_end=new IDate('p_end');
+ $p_end->value=$limit['p_end'];
+
+ $html='';
+ $html.=HtmlInput::title_box($title, 'mod_periode');
+ $html.=$title_par;
+ $html.=sprintf('';
+ $a_answer['content']=$html;
+ break;
+// Save a modification of a periode
+// @todo must be adapted
+ case 'save':
+ $per=new Periode($cn, $periode_id);
+ $per->load();
+ try
+ {
+ $p_start=$http->post("p_start", "date");
+ $p_end=$http->post("p_end", "date");
+ $p_exercice=$http->post("p_exercice", "number");
+ if ($p_exercice>2099||$p_exercice<1980)
+ {
+ $html='';
+ $html.=_('Erreur exercice invalide');
+ }
+ else
+ {
+ $sql="update parm_periode set p_start=to_date($1,'DD.MM.YYYY'),p_end=to_date($2,'DD.MM.YYYY'),p_exercice=$3 where p_id=$4";
+ try
+ {
+ $cn->exec_sql($sql,
+ array($p_start, $p_end, $p_exercice, $periode_id));
+ $a_answer["status"]="OK";
+ }
+ catch (Exception $e)
+ {
+ record_log($e->getTraceAsString());
+ $html=$e->getTrace();
+ throw $e;
+ }
+ }
+ $parm_periode=new Parm_periode_SQL($cn, $periode_id);
+ ob_start();
+ Periode::display_row_global($parm_periode, 0, $js_var);
+ $a_answer['content']=ob_get_clean();
+ }
+ catch (Exception $ex)
+ {
+ $html=$ex->getTrace();
+ $a_answer['content']=$html;
+ }
+ break;
+ case "remove":
+ try
+ {
+ $per=new Periode($cn, $periode_id);
+ $per->verify_delete();
+ $per->delete();
+ $a_answer['status']="OK";
+ }
+ catch (Exception $ex)
+ {
+ $a_answer["content"]=$ex->getMessage();
+ }
+ break;
+// case "add_per":
+// $per=new Periode($cn, $periode_id);
+// $per->load();
+//
+// $p_exercice=new ISelect('p_exercice');
+// $p_exercice->value=$cn->make_array("select distinct p_exercice,p_exercice from parm_periode order by 1 desc");
+// $title=_('Ajout période');
+// $title_par=""._('On ne peut ajouter une période que sur un exercice qui existe').
+// "
";
+//
+// $p_start=new IDate('p_start');
+// $p_end=new IDate('p_end');
+//
+// $html='';
+// $html.=HtmlInput::title_box($title, 'mod_periode');
+// $html.=$title_par;
+// $html.='';
+// $a_answer['content']=$html;
+// break;
+ case 'insert_periode':
+ try
+ {
+ $p_start=$http->post("p_start", "date");
+ $p_end=$http->post("p_end", "date");
+ $p_exercice=$http->post("p_exercice", "number");
+ $obj=new Periode($cn);
+ $p_id=$obj->insert($p_start, $p_end, $p_exercice);
+ $parm_periode=new Parm_periode_SQL($cn, $p_id);
+ ob_start();
+ Periode::display_row_global($parm_periode, 0, $js_var);
+ $a_answer['content']=ob_get_clean();
+ $a_answer['status']="OK";
+ $a_answer['p_id']=$p_id;
+ $a_answer['status']="OK";
+ }
+ catch (Exception $e)
+ {
+ $a_answer['status']="NOK";
+ $a_answer['content']=$e->getMessage();
+ }
+ break;
+ default:
+ $a_answer['content']=_("Invalid command")."[$act]";
+ break;
+}
+
+$jsson=json_encode($a_answer,
+ JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
+if (!headers_sent())
+ header('Content-Type: application/json;charset=utf-8');
+echo $jsson;
diff --git a/sources/include/ajax/ajax_plugin_detail.php b/sources/include/ajax/ajax_plugin_detail.php
new file mode 100644
index 0000000..bc9a0bd
--- /dev/null
+++ b/sources/include/ajax/ajax_plugin_detail.php
@@ -0,0 +1,64 @@
+value;
+echo HtmlInput::title_box($msg, $ctl);
+?>
+
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_poste.php b/sources/include/ajax/ajax_poste.php
new file mode 100644
index 0000000..a178c3b
--- /dev/null
+++ b/sources/include/ajax/ajax_poste.php
@@ -0,0 +1,168 @@
+ php jrn
+ - param c : control for storing the pcm_val -> javascript account
+ - param l : control for storing the pcm_lib -> javascript label
+ - param ctl : the node to update (ipopup)
+ - param q : the acc_query -> javascript query
+ * - ctl (to return)
+ *
+ *
+ */
+if ( ! defined('ALLOWED')) die (_('Non authorisé'));
+
+require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
+require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
+require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
+require_once NOALYSS_INCLUDE.'/class/acc_account_ledger.class.php';
+mb_internal_encoding("UTF-8");
+
+extract($_REQUEST, EXTR_SKIP);
+
+if ($g_user->check_dossier(dossier::id()) == 'X') exit();
+
+switch ($op2)
+{
+ /*----------------------------------------------------------------------
+ * Show the form and the result
+ *
+ ----------------------------------------------------------------------*/
+case "sf":
+ $ipopup=$ctl;
+ $attr=sprintf('this.ctl=\'%s\';',$ipopup);
+ $ctl.='_content';
+ $it=new IText('acc_query');
+ $it->size=30;
+ $it->value=(isset($q))?$q:'';
+ $str_poste=$it->input();
+ $str_submit=HtmlInput::submit('sf',_('Recherche'),"","smallbutton");
+ $r='';
+ $r.=HtmlInput::title_box(_('Poste Comptable'),'search_account',"close","","y");
+
+
+ $r.='';
+ $sql="
+ select pcm_val,pcm_lib,array_to_string(array_agg(j_qcode) , ',') as acode
+ from tmp_pcmn left join vw_poste_qcode on (j_poste=pcm_val) ";
+ $sep=" where ";
+ /* build the sql stmt */
+ if ( isset($j) && $j > 0 && isNumber($j))
+ {
+ /* create a filter on the ledger */
+ $ledger=new Acc_Account_Ledger($cn,0);
+ $fd_id=$ledger->build_sql_account($j);
+ if ( $fd_id != '' )
+ {
+ $sql.=" $sep (".$fd_id.')';
+ $sep=" and ";
+ }
+ }
+ /* show result */
+ if ( isset($q) && strlen(trim($q)) > 0)
+ {
+ $q= sql_string($q);
+ $sql.=sprintf(" $sep ( pcm_val::text like '%s%%' or pcm_lib::text ilike '%%%s%%') ",
+ $q,$q);
+ }
+ $sql.=' group by pcm_val,pcm_lib,pcm_val_parent, pcm_type order by pcm_val::text limit 50';
+ if ( isset($q) && strlen(trim($q))> 0 )
+ {
+ $array=$cn->get_array($sql);
+ }
+ if ( ! isset($q) ) $array=array();
+ if ( isset($q) && strlen(trim($q))==0) $array=array();
+
+ /* set the javascript */
+ for ($i=0;$i
+
+$ctl
+$xml
+
+EOF;
diff --git a/sources/include/ajax/ajax_preference.php b/sources/include/ajax/ajax_preference.php
new file mode 100644
index 0000000..07f62bf
--- /dev/null
+++ b/sources/include/ajax/ajax_preference.php
@@ -0,0 +1,274 @@
+';
+echo '';
+echo _("Si vous validez, la page sera rechargée et vous pourriez perdre ce que vous faisiez");
+echo '
';
+//----------------------------------------------------------------------
+//
+global $g_user;
+
+$g_user=new User($cn);
+$inside_dossier = false;
+
+if (isset($_REQUEST['gDossier']) && $_REQUEST['gDossier']<>0)
+{
+ $g_user->load_global_pref();
+ $msg = "";
+ $cn =Dossier::connect();
+ $g_user->cn = $cn;
+ $inside_dossier = true;
+ $local_pref=$g_user->get_preference();
+}
+//////////////////////////////////////////////////////////////////////////
+// Theme
+//////////////////////////////////////////////////////////////////////////
+
+ $repo = new Database();
+// charge tous les styles
+ $res = $repo->exec_sql("select the_name from theme
+ order by the_name");
+ $style = new ISelect('style_user');
+ $style->value = $repo->make_array("select the_name,the_name
+ from theme
+ order by the_name");
+ $style->selected =$_SESSION['g_theme'];
+?>
+
+";
+ ?>
diff --git a/sources/include/ajax/ajax_remove_submenu.php b/sources/include/ajax/ajax_remove_submenu.php
new file mode 100644
index 0000000..209295d
--- /dev/null
+++ b/sources/include/ajax/ajax_remove_submenu.php
@@ -0,0 +1,52 @@
+check_module('CFGPRO')==0)
+ die();
+try
+{
+
+ $p_profile_menu_id=$http->get('p_profile_menu_id', "number");
+}
+catch (Exception $exc)
+{
+ error_log($exc->getTraceAsString());
+ return;
+}
+
+// Delete menu + children
+$cn->exec_sql('delete from profile_menu where pm_id = $1 or pm_id_dep=$1',array($p_profile_menu_id));
+
+// remove children without parent
+$cn->exec_sql("delete from profile_menu "
+ . " where pm_id_dep is not null "
+ . " and pm_id_dep not in (select pm_id from profile_menu)");
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_save_predf_op.php b/sources/include/ajax/ajax_save_predf_op.php
new file mode 100644
index 0000000..a6d9852
--- /dev/null
+++ b/sources/include/ajax/ajax_save_predf_op.php
@@ -0,0 +1,68 @@
+check_module('PREDOP') == 0) exit();
+$name=$http->post("opd_name","string", "");
+if ( trim($name) != '')
+ {
+ try
+ {
+ $od_id=$http->post("od_id", "number");
+ $cn->exec_sql('delete from op_predef where od_id=$1',
+ array($od_id));
+
+ $cn->exec_sql("delete from op_predef_detail where od_id=$1",array($od_id));
+
+ $jrn_type=$http->post("jrn_type");
+ switch ($jrn_type) {
+ case 'ACH':
+ $operation=new Pre_op_ach($cn);
+ break;
+ case 'VEN':
+ $operation=new Pre_op_ven($cn);
+ break;
+ case 'ODS':
+ $operation=new Pre_Op_Advanced($cn);
+ break;
+ default :
+ throw new Exception(_('Type de journal invalide'));
+ }
+ $operation->get_post();
+ $operation->save();
+ $cn->commit();
+
+ }
+ catch (Exception $exc)
+ {
+ error_log($exc->getTraceAsString());
+ throw $exc;
+ }
+
+ }
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_search_action.php b/sources/include/ajax/ajax_search_action.php
new file mode 100644
index 0000000..9c21b5a
--- /dev/null
+++ b/sources/include/ajax/ajax_search_action.php
@@ -0,0 +1,34 @@
+
diff --git a/sources/include/ajax/ajax_search_add_tag.php b/sources/include/ajax/ajax_search_add_tag.php
new file mode 100644
index 0000000..339b45c
--- /dev/null
+++ b/sources/include/ajax/ajax_search_add_tag.php
@@ -0,0 +1,50 @@
+update_search_cell($_GET['pref']);
+
+$response= ob_get_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
+
diff --git a/sources/include/ajax/ajax_search_clear_tag.php b/sources/include/ajax/ajax_search_clear_tag.php
new file mode 100644
index 0000000..3904e07
--- /dev/null
+++ b/sources/include/ajax/ajax_search_clear_tag.php
@@ -0,0 +1,43 @@
+
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/sources/include/ajax/ajax_search_display_tag.php b/sources/include/ajax/ajax_search_display_tag.php
new file mode 100644
index 0000000..59d9627
--- /dev/null
+++ b/sources/include/ajax/ajax_search_display_tag.php
@@ -0,0 +1,45 @@
+select_search($_GET['pref']);
+
+$response= ob_get_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/sources/include/ajax/ajax_search_filter.php b/sources/include/ajax/ajax_search_filter.php
new file mode 100644
index 0000000..30489b5
--- /dev/null
+++ b/sources/include/ajax/ajax_search_filter.php
@@ -0,0 +1,201 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+require NOALYSS_INCLUDE.'/database/user_filter_sql.class.php';
+require NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php';
+$cn=Dossier::connect();
+$dossier_id=Dossier::id();
+global $g_user;
+/**
+ * @file
+ * @brief Managed the search filter
+ */
+$http=new HttpInput();
+//---------------------------------------------------------------------------
+// Record the the search filter
+//---------------------------------------------------------------------------
+$op=$http->request("op");
+if ($op=='save_filter')
+{
+ $answer=[];
+ $answer['filter_name']="";
+ $answer['status']='NOK';
+ $answer['filter_id']=0;
+ $answer['message']="";
+ try
+ {
+ $new=new User_filter_SQL($cn, -1);
+ $new->setp("login", $g_user->login);
+ $new->setp("nb_jrn", $http->post("nb_jrn", 'number'));
+ $new->setp("date_start", $http->post("date_start", 'string', NULL));
+ $new->setp("date_end", $http->post("date_end", 'string', NULL));
+ $new->setp("description", $http->post("desc", 'string', NULL));
+ $new->setp("amount_min", $http->post("amount_min", 'number', NULL));
+ $new->setp("amount_max", $http->post("amount_max", 'number', NULL));
+ $new->setp("qcode", $http->post("qcode", 'string', NULL));
+ $new->setp("accounting", $http->post("accounting", 'string', NULL));
+ $new->setp("date_paid_start",
+ $http->post("date_paid_start", 'string', NULL));
+ $new->setp("date_paid_end", $http->post("date_paid_end", 'string', NULL));
+ $new->setp("ledger_type", $http->post("ledger_type", 'string'));
+ $new->setp("unpaid", $http->post("unpaid", 'string', NULL));
+ $new->setp("filter_name", h($http->post("filter_name", 'string')));
+ $aJrn=[];
+ $max=$http->post("nb_jrn");
+ for ($i=0; $i<$max; $i++)
+ {
+ $aJrn[]=$http->post("r_jrn".$i, "number");
+ }
+ $new->setp("r_jrn", join(',', $aJrn));
+ if (strlen($new->getp("filter_name"))==0)
+ {
+ throw new Exception(_("Nom ne peut être vide"));
+ }
+ $new->save();
+ $rmAction=sprintf("delete_filter('%s','%s','%s')", trim($http->post('div')), $dossier_id,
+ $new->getp('id'));
+ $answer['filter_name']=sprintf(''.SMALLX.' '
+ );
+ $answer['filter_name'].=sprintf("%s ",
+ trim($http->post('div')), $dossier_id, $new->getp('id'),
+ $new->getp("filter_name"));
+ $answer['filter_id']=$new->getp("id");
+ $answer['status']='OK';
+ }
+ catch (Exception $ex)
+ {
+ $answer['status']='NOK';
+ $answer['message']=$ex->getMessage();
+ }
+ header('Content-Type: application/json;charset=utf-8');
+ echo json_encode($answer);
+ return;
+}
+//------------------------------------------------------------------------------
+// Load a filter
+//------------------------------------------------------------------------------
+if ($op=="load_filter")
+{
+ $filter_id=$http->get("filter_id", "number");
+ $div=$http->get("div");
+ $answer=[];
+ $answer['status']='OK';
+ $answer['filter_id']=0;
+ $answer['message']="";
+ $filter=new User_filter_SQL($cn, $filter_id);
+ $record=$filter->to_array();
+
+ $record['desc']=$record['description'];
+ $record['r_jrn']=explode(",", $record['r_jrn']);
+
+ $result=array_merge($answer, $record);
+
+
+ header('Content-Type: application/json;charset=utf-8');
+ echo json_encode($result);
+ return;
+}
+//-----------------------------------------------------------------------------
+// Display all the existing search filters and allow to load or delete them
+// id of the box is "boxfilter"+{p_div}
+//------------------------------------------------------------------------------
+if ($op=="display_search_filter")
+{
+ $p_div=$http->get("div");
+ $ledger_type=$http->get("ledger_type");
+
+ echo HtmlInput::title_box(_("Filtre"), "boxfilter".$p_div);
+
+
+
+ // Make a list of all search filters with the same ledger_type of the current
+ // user
+ $result=$cn->get_array("
+ select id, filter_name,ledger_type
+ from user_filter
+ where
+ login = $1
+ and ledger_type=$2
+ order by 2 asc
+", [$g_user->login, $ledger_type]);
+ $nb_result=count($result);
+ printf('', $p_div);
+ $search_filter=new Acc_Ledger_Search($ledger_type,1,$p_div);
+ // Button add filter
+ echo "";
+ echo $search_filter->build_name_filter();
+ echo " ";
+
+ echo "";
+ echo HtmlInput::anchor(_("Remise à zéro"), "", "onclick=\"reset_filter('$p_div');removeDiv('boxfilter{$p_div}')\"");
+ echo " ";
+
+ // Link reset
+ for ($i=0; $i<$nb_result; $i++)
+ {
+ printf(' ', $p_div, $result[$i]["id"]);
+ $rmAction=sprintf("delete_filter('%s','%s','%s')", $p_div, $dossier_id,
+ $result[$i]['id']);
+ printf(''.SMALLX.' '
+ );
+ printf("",
+ $p_div, $dossier_id, $result[$i]["id"],$p_div);
+ echo $result[$i]["filter_name"];
+ echo ' ';
+
+ printf(" ");
+ }
+ return;
+}
+//-----------------------------------------------------------------------------
+// Delete a filter_id
+// Check if this filter belong to current user
+//------------------------------------------------------------------------------
+if ($op=="delete_search_operation")
+{
+ $answer=[];
+ $answer['filter_name']="";
+ $answer['status']='NOK';
+ $answer['filter_id']=0;
+ $answer['message']="";
+ try
+ {
+ $p_div=$http->post("div");
+ $filter_id=$http->post("filter_id", "number");
+
+ $answer['div']=$p_div;
+
+ $cn->exec_sql("delete from user_filter where id=$1 and login=$2",[$filter_id,$g_user->login]);
+
+ $answer['filter_id']=$filter_id;
+ $answer['status']="OK";
+ }
+ catch (Exception $ex)
+ {
+ $answer['message']=$ex->getMessage();
+ }
+ header('Content-Type: application/json;charset=utf-8');
+ echo json_encode($answer);
+ return;
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_search_operation.php b/sources/include/ajax/ajax_search_operation.php
new file mode 100644
index 0000000..a279e55
--- /dev/null
+++ b/sources/include/ajax/ajax_search_operation.php
@@ -0,0 +1,145 @@
+get("tiers", "string", "");
+// With the amount id, we find the amount in a html elt
+if (isset($_GET['amount_id']))
+{
+ put_global(array(
+ array("key"=>'amount_min', 'value'=>$_GET['amount_id']),
+ array("key"=>'amount_max', 'value'=>$_GET['amount_id'])
+ ));
+}
+$target=$http->get("target", "string", "");
+$ledger=new Acc_Ledger_Search('ALL', 1, $target);
+
+if ($base=='recherche.php'||$base=='do.php')
+{
+ echo '';
+ echo '';
+
+if (isset($_GET['amount_min'])&&isset($_GET['amount_max'])&&($_GET['amount_max']!=0||$_GET['amount_min']!=0 ))
+{
+ $_GET['viewsearch']=1;
+ put_global(
+ array
+ (
+ array('key'=>'ledger_type', 'value'=>'ALL')
+ )
+ );
+}
+//-----------------------------------------------------
+// Display search result
+//-----------------------------------------------------
+if (isset($_GET['viewsearch']))
+{
+
+ // Navigation bar
+ $step=MAX_RECONCILE;
+ $page=(isset($_GET['offset']))?$_GET['page']:1;
+ $offset=(isset($_GET['offset']))?$_GET['offset']:0;
+ if (count($_GET)==0)
+ $array=null;
+ else
+ $array=$_GET;
+ $array['p_action']='ALL';
+ if (!isset($array['date_start'])||!isset($array['date_end']))
+ {
+ // get first date of current exercice
+ list($array['date_start'], $array['date_end'])=$g_user->get_limit_current_exercice();
+ }
+
+ list($sql, $where)=$ledger->build_search_sql($array);
+ // Count nb of line
+ $max_line=$cn->count_sql($sql);
+ $target=$http->get("target");
+ list($count, $content)=$ledger->list_operation_to_reconcile($sql, $target);
+ $bar=navigation_bar($offset, $max_line, $step, $page);
+
+ if (!$inside)
+ {
+ echo $bar;
+ }
+ else
+ {
+ if ($step<$max_line)
+ {
+ echo '
'._('Liste limitée à ').$step._(' enregistrements. Le nombre d\'enregistrements trouvés est de ').$max_line.' ';
+ }
+ }
+ echo '';
+}
+echo '';
+?>
diff --git a/sources/include/ajax/ajax_tag_add_action.php b/sources/include/ajax/ajax_tag_add_action.php
new file mode 100644
index 0000000..cdb4c4a
--- /dev/null
+++ b/sources/include/ajax/ajax_tag_add_action.php
@@ -0,0 +1,50 @@
+ag_id=$_REQUEST['ag_id'];
+if ( $g_user->can_write_action($fl->ag_id) == TRUE )
+ $fl->tag_add($_REQUEST['t_id']);
+
+ob_start();
+
+$fl->tag_cell();
+
+$response= ob_get_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/sources/include/ajax/ajax_tag_detail.php b/sources/include/ajax/ajax_tag_detail.php
new file mode 100644
index 0000000..6e86e5f
--- /dev/null
+++ b/sources/include/ajax/ajax_tag_detail.php
@@ -0,0 +1,54 @@
+data->t_id=$_GET['tag'];
+$tag->data->load();
+echo HtmlInput::title_box(_("Détail du dossier ou étiquette"), "tag_div");
+
+?>
+
+
+
+
+
+$html
+
+EOF;
+ exit();
+ ?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_tag_list.php b/sources/include/ajax/ajax_tag_list.php
new file mode 100644
index 0000000..342a44b
--- /dev/null
+++ b/sources/include/ajax/ajax_tag_list.php
@@ -0,0 +1,50 @@
+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);
+echo HtmlInput::button_close("tag_div");
+
+$response= ob_get_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/sources/include/ajax/ajax_tag_remove_action.php b/sources/include/ajax/ajax_tag_remove_action.php
new file mode 100644
index 0000000..3f49b21
--- /dev/null
+++ b/sources/include/ajax/ajax_tag_remove_action.php
@@ -0,0 +1,48 @@
+ag_id=$_REQUEST['ag_id'];
+
+if ( $g_user->can_write_action($fl->ag_id) == TRUE ) $fl->tag_remove($_REQUEST['t_id']);
+
+ob_start();
+
+$fl->tag_cell();
+
+$response= ob_get_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/sources/include/ajax/ajax_tag_save.php b/sources/include/ajax/ajax_tag_save.php
new file mode 100644
index 0000000..59df25e
--- /dev/null
+++ b/sources/include/ajax/ajax_tag_save.php
@@ -0,0 +1,54 @@
+request("op");
+global $g_user;
+$nDossier=Dossier::id();
+///check security
+if ( $g_user->check_module('CFGTAG')==0)
+{
+ die(_("non permis"));
+}
+
+
+require_once NOALYSS_INCLUDE.'/class/tag.class.php';
+
+//Save a tag
+if ($op=='tag_save')
+{
+ $tag=new Tag($cn);
+ $tag->save($_GET);
+ return;
+}
+//---------------------------------------------------------------------
+// Enable or disable a tag
+//---------------------------------------------------------------------
+if ( $op == "tag_activate")
+{
+ $tag_id=$http->get("t_id");
+ $tag=new Tag($cn, $tag_id);
+ $return=array();
+ $id=sprintf("tag_onoff%d",$tag_id);
+ if ( $tag->data->getp('t_actif') == 'Y')
+ {
+ $tag->data->t_actif='N';
+ $tag->data->save();
+ $return['code']='';
+ $return['style']='color:red';
+ } else {
+ $tag->data->t_actif='Y';
+ $tag->data->save();
+ $return['code']='';
+ $return['style']='color:green';
+ }
+ header("Content-type: text/json; charset: utf8",true);
+ echo json_encode($return);
+}
+?>
diff --git a/sources/include/ajax/ajax_tag_select_search.php b/sources/include/ajax/ajax_tag_select_search.php
new file mode 100644
index 0000000..f5f9462
--- /dev/null
+++ b/sources/include/ajax/ajax_tag_select_search.php
@@ -0,0 +1,44 @@
+select_search();
+
+$response= ob_get_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+exit();
+
+
+?>
diff --git a/sources/include/ajax/ajax_template_cat_card.php b/sources/include/ajax/ajax_template_cat_card.php
new file mode 100644
index 0000000..05ad1c1
--- /dev/null
+++ b/sources/include/ajax/ajax_template_cat_card.php
@@ -0,0 +1,73 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief Manage the template of category of card
+ */
+
+require_once NOALYSS_INCLUDE."/class/template_card_category.class.php";
+/**
+ * ajax_template_cat_card add security , accessible only for CFGCARDCAT
+ */
+if ( $g_user->check_module ("CFGCARDCAT")==0)
+{
+ return;
+}
+
+$http=new HttpInput();
+$action=$http->request("action");
+$p_id=$http->request("p_id");
+$ctl=$http->request("ctl");
+
+$cat_sql=new Fiche_Def_Ref_SQL($cn, $p_id);
+$cat=new Template_Card_Category($cat_sql);
+$cat->set_callback("ajax_misc.php");
+$cat->add_json_param("gDossier", Dossier::id());
+$cat->add_json_param("op", "template_cat_card");
+$cat->set_object_name($ctl);
+
+switch ($action)
+{
+ case "input":
+ // Display a box with the data
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $cat->ajax_input()->saveXML();
+ return;
+ break;
+ case "save":
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $cat->ajax_save()->saveXML();
+ if ( $p_id == -1 )
+ $cat->add_mandatory_attr();
+ return;
+ break;
+ case "delete":
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $cat->ajax_delete()->saveXML();
+ return;
+ break;
+ default:
+ break;
+}
diff --git a/sources/include/ajax/ajax_template_cat_category.php b/sources/include/ajax/ajax_template_cat_category.php
new file mode 100644
index 0000000..32f22d9
--- /dev/null
+++ b/sources/include/ajax/ajax_template_cat_category.php
@@ -0,0 +1,120 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief manage attribut of a Template of Category of card. The answer must be
+ * in json
+ */
+$answer=[];
+$answer['status']="NOK";
+$answer['content']="";
+$answer['message']=_("Commande inconnue");
+
+
+/**
+ * security
+ */
+try
+{
+ if ($g_user->check_module("CFGCARDCAT")==0)
+ throw new Exception(_("Accès non autorisé"));
+ $http=new HttpInput();
+ $action=$http->request("action");
+ $ad_id=$http->request("ad_id", "number");
+ $frd_id=$http->request("frd_id", "number");
+ $objname=$http->request("objname");
+}
+catch (Exception $ex)
+{
+ $answer['message']=_("Accès non autorisé");
+ header("Content-type: text/json; charset: utf8", true);
+ echo json_encode($answer,
+ JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
+ return;
+}
+switch ($action)
+{
+ case "add_attribute":
+ try
+ {
+ if ($cn->get_value("select count(*) from attr_min where frd_id=$1 and ad_id=$2",
+ [$frd_id, $ad_id])>0)
+ throw new Exception(_("Attribut déjà ajouté"));
+ $cn->exec_sql("insert into attr_min (frd_id,ad_id) values ($1,$2)",
+ [$frd_id, $ad_id]);
+ $answer['status']="OK";
+ $answer['message']="";
+ $js=sprintf("category_card.remove_attribut('%s','%s','%s',%d)",
+ Dossier::id(), $frd_id, $objname, $ad_id);
+ $answer['content']=$cn->get_value("select ad_text from attr_def where ad_id=$1",
+ [$ad_id]).
+ HtmlInput::anchor(SMALLX, "javascript:void(0)", $js,
+ ' class="smallbutton" style="padding:0px;display:inline" ');
+ }
+ catch (Exception $exc)
+ {
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ $answer['message']=$exc->getMessage();
+ }
+
+
+ break;
+ case "remove_attribute":
+ try
+ {
+ if ($cn->get_value("select count(*) from jnt_fic_attr
+ join fiche_def using (fd_id)
+ where frd_id=$1 and ad_id=$2",
+ [$frd_id, $ad_id])>0)
+ throw new Exception(_("Attribut déjà utilisé"));
+ if (in_array($ad_id, [ATTR_DEF_NAME,ATTR_DEF_QUICKCODE]) )
+ {
+ throw new Exception(_("Attribut obligatoire"));
+ }
+ $answer['content']=$cn->get_value("select ad_text from attr_def where ad_id=$1",
+ [$ad_id]);
+ $answer['status']="OK";
+ $answer['message']="";
+ $cn->exec_sql("delete from attr_min where frd_id=$1 and ad_id=$2",
+ [$frd_id,$ad_id]);
+ }
+ catch (Exception $exc)
+ {
+ echo $exc->getMessage();
+ error_log($exc->getTraceAsString());
+ $answer['message']=$exc->getMessage();
+ }
+ break;
+
+ default:
+ break;
+}
+
+
+header("Content-type: text/json; charset: utf8", true);
+echo json_encode($answer,
+ JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_NUMERIC_CHECK);
+return;
diff --git a/sources/include/ajax/ajax_todo_list.php b/sources/include/ajax/ajax_todo_list.php
new file mode 100644
index 0000000..4c95df8
--- /dev/null
+++ b/sources/include/ajax/ajax_todo_list.php
@@ -0,0 +1,310 @@
+check(true);
+$g_user->check_dossier(Dossier::id(),true);
+set_language();
+ajax_disconnected('add_todo_list');
+////////////////////////////////////////////////////////////////////////////////
+// Display the note
+////////////////////////////////////////////////////////////////////////////////
+if (isset($_REQUEST['show']))
+{
+ $cn=Dossier::connect();
+ $todo=new Todo_list($cn);
+ $todo->set_parameter('id',$_REQUEST['id']);
+ $todo->load();
+ $content=$todo->display();
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0','UTF-8');
+ $tl_id=$dom->createElement('tl_id',$todo->get_parameter('id'));
+ $tl_content=$dom->createElement('tl_content',$content);
+
+
+ $root=$dom->createElement("root");
+
+ $root->appendChild($tl_id);
+ $root->appendChild($tl_content);
+ $dom->appendChild($root);
+
+ echo $dom->saveXML();
+ exit();
+}
+////////////////////////////////////////////////////////////////////////////////
+// Delete the note
+////////////////////////////////////////////////////////////////////////////////
+if (isset($_REQUEST['del']))
+{
+ $cn=Dossier::connect();
+ $todo=new Todo_list($cn);
+ $todo->set_parameter('id',$_REQUEST['id']);
+ $todo->delete();
+ exit();
+}
+$ac=$http->get('act', "string",'save');
+
+////////////////////////////////////////////////////////////////////////////////
+// Save the modification of a note
+////////////////////////////////////////////////////////////////////////////////
+if ($ac == 'save')
+{
+
+ $cn=Dossier::connect();
+ $todo=new Todo_List($cn);
+ $id=$http->get("id","string", 0);
+ $todo->set_parameter("id",$id);
+ if ($id <> 0 ) { $todo->load(); }
+ else
+ {
+ $todo->set_parameter("owner", $_SESSION['g_user']);
+ }
+
+ $todo->set_parameter("date",$http->get("p_date_todo","string", ""));
+ $todo->set_parameter("title", $http->get("p_title","string", ""));
+ $todo->set_parameter("desc", $http->get("p_desc","string", ""));
+ $todo->set_is_public($http->get("p_public", "string","N"));
+
+ ob_start();
+ if ( $todo->get_parameter('owner') == $_SESSION['g_user'] ) $todo->save();
+ ob_end_clean();
+ $dom=new DOMDocument('1.0','UTF-8');
+
+ if ($todo->get_parameter("id")==0)
+ {
+ $tl_id=$dom->createElement('tl_id', 0);
+ $tl_content=$dom->createElement('row','');
+ $root=$dom->createElement("root");
+ $todo_class=$todo->get_class();
+ $todo_class=($todo_class=="")?' odd ':$todo_class;
+ $class=$dom->createElement("style", $todo_class);
+ }
+ else
+ {
+ $todo->load();
+ $tl_id=$dom->createElement('tl_id', $todo->get_parameter('id'));
+ $tl_content=$dom->createElement('row',$todo->display_row('class="odd"', 'N'));
+ $root=$dom->createElement("root");
+ $todo_class=$todo->get_class();
+ $todo_class=($todo_class=="")?' odd ':$todo_class;
+ $class=$dom->createElement("style", $todo_class);
+ }
+ header('Content-type: text/xml; charset=UTF-8');
+
+
+
+ $root->appendChild($tl_id);
+ $root->appendChild($tl_content);
+ $root->appendChild($class);
+ $dom->appendChild($root);
+
+ echo $dom->saveXML();
+ exit();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Display a list to select the user with who we want to share notes
+////////////////////////////////////////////////////////////////////////////////
+if ($ac=='shared_note')
+{
+ $id=$http->get("todo_id", "string",-1);
+ // If note_id is not correct then give an error
+ if ($id==-1||isNumber($id)==0)
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', _("Erreur : note invalide"));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ if ($id==0)
+ {
+ ob_start();
+ echo HtmlInput::title_box(_('Liste utilisateurs'), "shared_{$id}");
+ echo '';
+ echo _("Vous devez d'abord sauver");
+ echo '
';
+ echo '';
+ echo HtmlInput::submit('close'.$id, 'Ferme'," onclick=\"\$('shared_{$id}').remove();\"");
+ echo '
';
+ $result=ob_get_clean();
+ //
+ // output the XML
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', escape_xml($result));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ $todo=new Todo_List($cn);
+ $todo->set_parameter("id", $id);
+ $todo->load();
+ if ($g_user->login!=$todo->get_parameter("owner"))
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', _("Cette note n'est pas à vous").
+ Icon_Action::close('shared_'.$id));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ if ($g_user->check_action(SHARENOTE)== 0)
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', _("Accès interdit"));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ ob_start();
+ echo HtmlInput::title_box(_('Liste utilisateurs'), "shared_".$id);
+ $todo->display_user();
+ echo '';
+ echo HtmlInput::submit('close'.$id, 'Ferme'," onclick=\"\$('shared_{$id}').remove();\"");
+ echo '
';
+ $result=ob_get_clean();
+ //
+ // output the XML
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', escape_xml($result));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+}
+////////////////////////////////////////////////////////////////////////////////
+// Share the note with someone or remove it
+////////////////////////////////////////////////////////////////////////////////
+if ( $ac=="set_share")
+{
+ $id=$http->get("todo_id", "string",0);
+ $p_login=$http->get("login","string","");
+ // If note_id is not correct then give an error
+ if ($id==0||isNumber($id)==0 || trim ($p_login)=="")
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', _("Erreur : paramètre invalide"));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ $todo=new Todo_List($cn);
+ $todo->set_parameter("id", $id);
+ $todo->load();
+ if ($g_user->login!=$todo->get_parameter("owner"))
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', _("Cette note n'est pas à vous"));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ if ($g_user->login!=$todo->get_parameter("owner"))
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', _("Cette note n'est pas à vous"));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ if ($g_user->check_action(SHARENOTE)== 0)
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $tl_id=$dom->createElement('content', _("Accès interdit"));
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ if ( $todo->is_shared_with($p_login) == 0 )
+ {
+ // Add a share to the user
+ $todo->add_share($p_login);
+
+ } else {
+ // remove a share from the user
+ $todo->remove_share($p_login);
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+// Remove the share of a note which the connected user doesn't own
+//
+////////////////////////////////////////////////////////////////////////////////
+if ( $ac=="remove_share")
+{
+ $id=$http->get("todo_id","string", 0);
+ $p_login=$http->get("login","string","");
+ // If note_id is not correct then give an error
+ if ($id==0||isNumber($id)==0 || trim ($p_login)=="")
+ {
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $status=$dom->createElement('status', "nok");
+ $tl_id=$dom->createElement('content', _("Erreur : paramètre invalide"));
+ $dom->appendChild($status);
+ $dom->appendChild($tl_id);
+ echo $dom->saveXML();
+ return;
+ }
+ $todo=new Todo_List($cn);
+ $todo->set_parameter("id", $id);
+ $todo->load();
+ $todo->remove_share($p_login);
+
+ header('Content-type: text/xml; charset=UTF-8');
+ $dom=new DOMDocument('1.0', 'UTF-8');
+ $status=$dom->createElement('status', "ok");
+ $dom->appendChild($status);
+ echo $dom->saveXML();
+ return;
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_tva_parameter.php b/sources/include/ajax/ajax_tva_parameter.php
new file mode 100644
index 0000000..9dffd57
--- /dev/null
+++ b/sources/include/ajax/ajax_tva_parameter.php
@@ -0,0 +1,78 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+/**
+ * @file
+ * @brief
+ * @param type $name Descriptionara
+ */
+require_once NOALYSS_INCLUDE."/class/tva_rate_mtable.class.php";
+
+if ( $g_user->check_module('CFGTVA') ==0 )
+{
+ return;
+}
+try
+{
+ $table=$http->request('table');
+ $action=$http->request('action');
+ $p_id=$http->request('p_id', "number");
+ $ctl_id=$http->request('ctl');
+}
+catch (Exception $e)
+{
+ record_log($e->getTraceAsString());
+ return;
+}
+
+$tva_rate=new V_Tva_Rate_SQL($cn);
+$p_id=$http->request('p_id', "number");
+$tva_rate->set_pk_value($p_id);
+$tva_rate->load();
+$manage_table=new Tva_Rate_MTable($tva_rate);
+$manage_table->set_callback("ajax_misc.php");
+$manage_table->add_json_param("op", "tva_parameter");
+
+if ($action=="input")
+{
+
+ $manage_table->set_object_name($ctl_id);
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $manage_table->ajax_input()->saveXML();
+ return;
+}
+elseif ($action=="save")
+{
+ $manage_table->set_object_name($ctl_id);
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $manage_table->ajax_save()->saveXML();
+ return;
+}
+elseif ($action=="delete")
+{
+ $manage_table->set_object_name($ctl_id);
+ header('Content-type: text/xml; charset=UTF-8');
+ echo $manage_table->ajax_delete()->saveXML();
+}
+return;
diff --git a/sources/include/ajax/ajax_update_payment.php b/sources/include/ajax/ajax_update_payment.php
new file mode 100644
index 0000000..d65807e
--- /dev/null
+++ b/sources/include/ajax/ajax_update_payment.php
@@ -0,0 +1,32 @@
+input_paid(1);
+?>
diff --git a/sources/include/ajax/ajax_update_predef.php b/sources/include/ajax/ajax_update_predef.php
new file mode 100644
index 0000000..7979d60
--- /dev/null
+++ b/sources/include/ajax/ajax_update_predef.php
@@ -0,0 +1,71 @@
+set('ledger',$l);
+$op->set('ledger_type',$t);
+$op->set('direct',$d);
+$url=http_build_query(array('action'=>'use_opd','p_jrn_predef'=>$l,'ac'=>$_GET['ac'],'gDossier'=>dossier::id()));
+$html="";
+
+$html.=HtmlInput::title_box(_("Modèle d'opérations"), 'modele_op_div', 'hide',"","n");
+$html.=$op->show_button('do.php?'.$url);
+$html.=' '.
+ HtmlInput::button_hide('modele_op_div').
+ '
';
+$html=escape_xml($html);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<
+
+
+$html
+
+EOF;
+
+?>
+
diff --git a/sources/include/ajax/ajax_user_security.php b/sources/include/ajax/ajax_user_security.php
new file mode 100644
index 0000000..6deddf0
--- /dev/null
+++ b/sources/include/ajax/ajax_user_security.php
@@ -0,0 +1,273 @@
+
+
+if (!defined('ALLOWED'))
+ die('Appel direct ne sont pas permis');
+
+
+require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
+require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
+require_once NOALYSS_INCLUDE.'/lib/inum.class.php';
+require_once NOALYSS_INCLUDE.'/lib/inplace_edit.class.php';
+require_once NOALYSS_INCLUDE.'/lib/inplace_switch.class.php';
+
+/**
+ * @file
+ * @brief Manage the security of a ledger , from CFGSEC module
+ *
+ */
+ global $g_user;
+if ( $g_user->check_module("CFGSEC") == 0)
+ throw new Exception(_("Non autorisé"));
+
+$n_dossier_id=Dossier::id();
+//-----------------------------------------------------------------------------
+// Manage the user's access to ledgers
+//-----------------------------------------------------------------------------
+if ($op=="ledger_access")
+{
+ $input=$http->request("input");
+ $action=$http->request("ieaction", "string", "display");
+ $user_id=$http->post("user_id", "number");
+ $jrn_def_id=$http->post("jrn_def_id", "number");
+ if ($action=="display")
+ {
+ $ie_input=Inplace_Edit::build($input);
+ $ie_input->set_callback("ajax_misc.php");
+ $ie_input->add_json_param("jrn_def_id", $jrn_def_id);
+ $ie_input->add_json_param("op", "ledger_access");
+ $ie_input->add_json_param("gDossier", $n_dossier_id);
+ $ie_input->add_json_param("user_id", $user_id);
+ echo $ie_input->ajax_input();
+ return;
+ }
+ if ($action=="ok")
+ {
+ $value=$http->post("value");
+ $ie_input=Inplace_Edit::build($input);
+ $ie_input->set_callback("ajax_misc.php");
+ $ie_input->add_json_param("jrn_def_id", $jrn_def_id);
+ $ie_input->add_json_param("op", "ledger_access");
+ $ie_input->add_json_param("gDossier", $n_dossier_id);
+ $ie_input->add_json_param("user_id", $user_id);
+ $ie_input->set_value($value);
+ $sec_User=new User($cn, $user_id);
+ $count=$cn->get_value('select count(*) from user_sec_jrn where uj_login=$1 '.
+ ' and uj_jrn_id=$2', array($sec_User->login, $jrn_def_id));
+ if ($count==0)
+ {
+ $cn->exec_sql('insert into user_sec_jrn (uj_login,uj_jrn_id,uj_priv)'.
+ ' values ($1,$2,$3)',
+ array($sec_User->login, $jrn_def_id, $value));
+ }
+ else
+ {
+ $cn->exec_sql('update user_sec_jrn set uj_priv=$1 where uj_login=$2 and uj_jrn_id=$3',
+ array($value, $sec_User->login, $jrn_def_id));
+ }
+ echo $ie_input->value();
+ return;
+ }
+ if ($action=="cancel")
+ {
+ $ie_input=Inplace_Edit::build($input);
+ $ie_input->set_callback("ajax_misc.php");
+ $ie_input->add_json_param("jrn_def_id", $jrn_def_id);
+ $ie_input->add_json_param("op", "ledger_access");
+ $ie_input->add_json_param("gDossier", $n_dossier_id);
+ $ie_input->add_json_param("user_id", $user_id);
+ echo $ie_input->value();
+ return;
+ }
+}
+//-----------------------------------------------------------------------------
+// Set the user's profile
+//-----------------------------------------------------------------------------
+if ($op=="profile")
+{
+ $input=$http->request("input");
+ $action=$http->request("ieaction", "string", "display");
+ $user_id=$http->post("user_id", "number");
+ $profile_id=$http->post("profile_id");
+ if ($action=="display")
+ {
+ $ie_input=Inplace_Edit::build($input);
+ $ie_input->set_callback("ajax_misc.php");
+ $ie_input->add_json_param("profile_id", $profile_id);
+ $ie_input->add_json_param("op", "profile");
+ $ie_input->add_json_param("gDossier", $n_dossier_id);
+ $ie_input->add_json_param("user_id", $user_id);
+ echo $ie_input->ajax_input();
+ return;
+ }
+ if ($action=="ok")
+ {
+ $value=$http->post("value");
+ // save profile
+ $sec_User=new User($cn, $user_id);
+ $sec_User->save_profile($value);
+ $ie_input=Inplace_Edit::build($input);
+ $ie_input->set_callback("ajax_misc.php");
+ $ie_input->add_json_param("op", "profile");
+ $ie_input->add_json_param("profile_id", $profile_id);
+ $ie_input->add_json_param("gDossier", $n_dossier_id);
+ $ie_input->add_json_param("user_id", $user_id);
+ $ie_input->set_value($value);
+
+ echo $ie_input->value();
+ return;
+ }
+ if ($action=="cancel")
+ {
+ $ie_input=Inplace_Edit::build($input);
+ $ie_input->set_callback("ajax_misc.php");
+ $ie_input->add_json_param("op", "profile");
+ $ie_input->add_json_param("gDossier", $n_dossier_id);
+ $ie_input->add_json_param("profile_id", $profile_id);
+ $ie_input->add_json_param("user_id", $user_id);
+ echo $ie_input->value();
+ return;
+ }
+}
+//------------------------------------------------------------------------------
+// Update in once all the ledger access for an user
+//------------------------------------------------------------------------------
+if ($op=='ledger_access_all')
+{
+ // Find the login
+ $user_id=$http->post("user_id", "number");
+ $access=$http->post("access");
+ if ($access!="W"&&$access!="X"&&$access!="R")
+ die("Invalid access");
+ $sec_User=new User($cn, $user_id);
+ // Insert all the existing ledgers to user_sec_jrn
+ $sql="insert into user_sec_jrn(
+ uj_jrn_id,
+ uj_login,
+ uj_priv
+ ) select jrn_def_id,$1,'X'
+ from
+ jrn_def
+ where
+ not exists(select 1
+ from
+ user_sec_jrn
+ where
+ uj_jrn_id = jrn_def_id
+ and uj_login = $1
+ )";
+ $cn->exec_sql($sql, array($sec_User->login));
+ $cn->exec_sql('update user_sec_jrn set uj_priv=$1 where uj_login=$2',
+ array($access, $sec_User->login));
+ return;
+}
+//------------------------------------------------------------------------------
+// Set on or off the action
+//------------------------------------------------------------------------------
+if ($op=="action_access")
+{
+ $action_id=$http->get("ac_id", "number");
+ $user_id=$http->get("user_id","number");
+ $sec_User=new User($cn, $user_id);
+
+ $right=$sec_User->check_action($action_id);
+ $is_switch=new Inplace_Switch("action".$action_id,0);
+ if ($right==1)
+ {
+ $cn->exec_sql("delete from user_sec_act where ua_act_id=$1 and ua_login=$2",
+ array($action_id, $sec_User->login));
+ echo $is_switch->get_iconoff();
+ } else {
+ $cn->exec_sql('insert into user_sec_act (ua_login,ua_act_id)'.
+ ' values ($1,$2)',
+ array($sec_User->login,$action_id));
+ echo $is_switch->get_iconon();
+ }
+
+
+
+}
+//----------------------------------------------------------------------------
+// Set all the actions
+//----------------------------------------------------------------------------
+if ($op=="action_access_all")
+{
+ $user_id=$http->get("user_id","number");
+ $access=$http->get("access","number");
+ $sec_User=new User($cn, $user_id);
+ if ( $access==0) {
+ $cn->exec_sql("delete from user_sec_act where ua_login=$1",array($sec_User->login));
+ }
+ if ( $access==1) {
+ $cn->exec_sql("
+ insert into user_sec_act(ua_login,ua_act_id) select $1,ac_id from action where not exists(select 1 from user_sec_act where ua_login=$1 and ua_act_id=ac_id)",
+ array($sec_User->login));
+ }
+
+}
+//----------------------------------------------------------------------------
+// Enable or disable security on ledger
+//----------------------------------------------------------------------------
+if ($op=="user_sec_ledger")
+{
+ $user_id=$http->get("user_id", "number");
+ $value=$http->get("value", "number");
+ $sec_user=new User($cn, $user_id);
+ $status_sec_ledger=$sec_user->get_status_security_ledger();
+ $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);
+ $sec_ledger->add_json_param("user_id", $user_id);
+ $sec_ledger->add_json_param("op", "user_sec_ledger");
+ if ($sec_user->get_status_security_ledger()==1||$sec_user->Admin()==1)
+ {
+ $sec_user->set_status_security_ledger(0);
+ echo $sec_ledger->get_iconoff();
+ }else {
+ $sec_user->set_status_security_ledger(1);
+ echo $sec_ledger->get_iconon();
+
+ }
+}
+//----------------------------------------------------------------------------
+// Enable or disable security on action
+//----------------------------------------------------------------------------
+if ($op=="user_sec_action")
+{
+ $user_id=$http->get("user_id", "number");
+ $value=$http->get("value", "number");
+ $sec_user=new User($cn, $user_id);
+ $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");
+ $sec_action->add_json_param("gDossier", $n_dossier_id);
+ $sec_action->add_json_param("user_id", $user_id);
+ $sec_action->add_json_param("op", "user_sec_action");
+ if ($sec_user->get_status_security_action()==1||$sec_user->Admin()==1)
+ {
+ $sec_user->set_status_security_action(0);
+ echo $sec_action->get_iconoff();
+ }else {
+ $sec_user->set_status_security_action(1);
+ echo $sec_action->get_iconon();
+
+ }
+}
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_view_action.php b/sources/include/ajax/ajax_view_action.php
new file mode 100644
index 0000000..438d605
--- /dev/null
+++ b/sources/include/ajax/ajax_view_action.php
@@ -0,0 +1,72 @@
+ag_id = $ag_id;
+$act->get();
+
+$code='nok';
+if ( ($g_user->can_write_action($ag_id) == true || $g_user->can_read_action($ag_id) == true || $act->ag_dest == -1) && $act->ag_id !=0)
+{
+ $menu=new Default_Menu();
+ echo $act->Display('READ', false, "ajax", "");
+ //$action=HtmlInput::array_to_string(array("gDossier","ag_id"), $_GET)."&ac=FOLLOW&sa=detail";
+ $action= "do.php?".http_build_query(array("gDossier"=>Dossier::id(),"ag_id"=>$ag_id,"ac"=>$menu->get('code_follow'),"sa"=>"detail"));
+ $code='ok';
+?>
+
+
+
+
;
+
+
+
+$code
+$html
+
+EOF;
+exit();
+
+?>
\ No newline at end of file
diff --git a/sources/include/ajax/ajax_view_mod_stock.php b/sources/include/ajax/ajax_view_mod_stock.php
new file mode 100644
index 0000000..b0f6124
--- /dev/null
+++ b/sources/include/ajax/ajax_view_mod_stock.php
@@ -0,0 +1,58 @@
+get_array("select * from stock_goods where c_id=$1",array($_GET['c_id']));
+echo HtmlInput::title_box(_("Détail changement"),$_GET['ctl']);
+$p_array=array();
+$p_array['p_date']=$cn->get_value("select to_char(c_date,'DD.MM.YYYY') from stock_change where c_id=$1",array($_GET['c_id']));
+$p_array['p_motif']=$cn->get_value("select c_comment from stock_change where c_id=$1",array($_GET['c_id']));
+$p_array['p_depot']=$cn->get_value("select r_id from stock_change where c_id=$1",array($_GET['c_id']));
+for ($i=0;$iinput($p_array,true);
+?>
+
diff --git a/sources/include/anc_acc_balance.inc.php b/sources/include/anc_acc_balance.inc.php
index efa03f8..646376f 100644
--- a/sources/include/anc_acc_balance.inc.php
+++ b/sources/include/anc_acc_balance.inc.php
@@ -1,9 +1,12 @@
';
$tab = new Anc_Acc_List($cn);
$tab->get_request();
diff --git a/sources/include/anc_acc_table.inc.php b/sources/include/anc_acc_table.inc.php
index 357c2dd..af9c18d 100644
--- a/sources/include/anc_acc_table.inc.php
+++ b/sources/include/anc_acc_table.inc.php
@@ -1,9 +1,13 @@
get_request();
echo '';
-$result=HtmlInput::default_value_request('result',null);
+$result=$http->request('result',"string",null);
if ($result != null)
{
- $result=$grandLivre->display_html();
+ $grandLivre->load();
if ($grandLivre->has_data != 0 )
{
echo '';
echo _('Tout sélectionner')." ".ICheckBox::toggle_checkbox('export_pdf_bt1','export_anc_receipt_pdf');
echo ' ';
+ $task_id=uniqid();
echo $grandLivre->show_button();
- echo '';
echo $grandLivre->show_button();
+ ?>
+
+get_request();
diff --git a/sources/include/anc_history.inc.php b/sources/include/anc_history.inc.php
index 7efb2a6..bac4a8b 100644
--- a/sources/include/anc_history.inc.php
+++ b/sources/include/anc_history.inc.php
@@ -2,10 +2,14 @@
//This file is part of NOALYSS and is under GPL
//see licence.txt
-
+/**
+ *@file
+ *@brief Print history for Analytic accounting
+ * @see Anc_Listing
+ */
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-require_once NOALYSS_INCLUDE.'/class_anc_listing.php';
+require_once NOALYSS_INCLUDE.'/class/anc_listing.class.php';
$list = new Anc_Listing($cn);
$list->get_request();
diff --git a/sources/include/anc_key.inc.php b/sources/include/anc_key.inc.php
index b9d5a22..a2b343f 100644
--- a/sources/include/anc_key.inc.php
+++ b/sources/include/anc_key.inc.php
@@ -1,20 +1,20 @@
request("op", "string", "list");
switch ($op)
{
case 'list':
@@ -39,15 +40,11 @@ switch ($op)
Anc_Key::key_add();
break;
case 'consult':
- $id=HtmlInput::default_value_request("key", "0");
- if (isNumber($id)==0||$id==0)
+ try
{
- die(_('Clef invalide'));
- }
- $key=new Anc_Key($id);
- if (isset($_POST['save_key']))
- {
- try
+ $id=$http->request("key", "number");
+ $key=new Anc_Key($id);
+ if (isset($_POST['save_key']))
{
$key->save($_POST);
Anc_Key::display_list();
@@ -55,17 +52,27 @@ switch ($op)
break;
}
- catch (Exception $e)
- {
- echo span($e->getMessage(),' class="notice"');
- }
+ $key->input();
+ }
+ catch (Exception $e)
+ {
+ record_log($e->getTraceAsString());
+ echo span($e->getMessage(), ' class="notice"');
+ Anc_Key::display_list();
+ Anc_Key::key_add();
}
- $key->input();
break;
case 'delete_key':
- $id=HtmlInput::default_value_request("key", "0");
- $key=new Anc_Key($id);
- $key->delete();
+ try
+ {
+ $id=$http->request("key", "number");
+ $key=new Anc_Key($id);
+ $key->delete();
+ }
+ catch (Exception $e)
+ {
+ echo span($e->getMessage(), ' class="notice"');
+ }
Anc_Key::display_list();
Anc_Key::key_add();
}
diff --git a/sources/include/anc_od.inc.php b/sources/include/anc_od.inc.php
index 54d3339..fec7618 100644
--- a/sources/include/anc_od.inc.php
+++ b/sources/include/anc_od.inc.php
@@ -26,14 +26,14 @@
*
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-require_once NOALYSS_INCLUDE.'/class_ihidden.php';
-require_once NOALYSS_INCLUDE.'/class_iselect.php';
-require_once NOALYSS_INCLUDE.'/class_anc_account.php';
-require_once NOALYSS_INCLUDE.'/class_anc_operation.php';
-require_once NOALYSS_INCLUDE.'/class_anc_plan.php';
-require_once NOALYSS_INCLUDE.'/class_anc_group_operation.php';
+require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
+require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
+require_once NOALYSS_INCLUDE.'/class/anc_operation.class.php';
+require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
+require_once NOALYSS_INCLUDE.'/class/anc_group_operation.class.php';
global $g_user;
+$http=new HttpInput();
$str_dossier=Dossier::get();
$pa=new Anc_Plan($cn);
@@ -41,7 +41,7 @@ $m=$pa->get_list();
if ( ! $m )
{
- echo '
'._('Aucun plan analytique défini').' ';
+ echo '
'._('Aucun plan analytique défini').' ';
return;
}
@@ -51,9 +51,8 @@ if ( ! $m )
// show the left menu
//----------------------------------------------------------------------
echo '
-