diff --git a/dev/SQL/index.php b/dev/SQL/index.php
index c6b1500f7..14a5a37cc 100644
--- a/dev/SQL/index.php
+++ b/dev/SQL/index.php
@@ -9,7 +9,7 @@ require_once '../../include/constant.php';
const REPOSITORY_DB=1;
const ACCOUNT_DB=2;
-require_once NOALYSS_INCLUDE."/lib/database.class.php";
+require_once NOALYSS_INCLUDE."/class/database.class.php";
require_once NOALYSS_INCLUDE."/lib/iselect.class.php";
require_once NOALYSS_INCLUDE."/lib/http_input.class.php";
diff --git a/dev/SQL/template/script_sql.php b/dev/SQL/template/script_sql.php
index f162dd14c..f441edcc7 100644
--- a/dev/SQL/template/script_sql.php
+++ b/dev/SQL/template/script_sql.php
@@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
diff --git a/doc/developper/Doxyfile b/doc/developper/Doxyfile
index 3571e04c5..5cf03c545 100644
--- a/doc/developper/Doxyfile
+++ b/doc/developper/Doxyfile
@@ -887,7 +887,7 @@ HTML_ALIGN_MEMBERS = YES
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-HTML_DYNAMIC_SECTIONS = NO
+HTML_DYNAMIC_SECTIONS = YES
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
diff --git a/html/ajax.php b/html/ajax.php
index 1a24adc7a..5bf62668d 100644
--- a/html/ajax.php
+++ b/html/ajax.php
@@ -14,7 +14,7 @@
*/
if ( ! defined ('ALLOWED') ) define ('ALLOWED',1);
require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/class/extension.class.php';
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index 493e92dfd..37f5e0b96 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -38,7 +38,7 @@
if ( ! defined('ALLOWED')) define ('ALLOWED',1);
require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
require_once NOALYSS_INCLUDE.'/lib/iradio.class.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
diff --git a/html/ajax_test.php b/html/ajax_test.php
index 01fd2b59e..feb8dd10f 100644
--- a/html/ajax_test.php
+++ b/html/ajax_test.php
@@ -31,7 +31,7 @@
include_once "../include/constant.php";
include_once NOALYSS_INCLUDE."/lib/ac_common.php";
-require_once NOALYSS_INCLUDE."/lib/database.class.php";
+require_once NOALYSS_INCLUDE."/class/database.class.php";
require_once NOALYSS_INCLUDE."/class/dossier.class.php";
require_once NOALYSS_INCLUDE."/lib/html_input.class.php";
require_once NOALYSS_INCLUDE."/lib/http_input.class.php";
diff --git a/html/compute.php b/html/compute.php
index cb114da51..b6114eb5a 100644
--- a/html/compute.php
+++ b/html/compute.php
@@ -31,7 +31,7 @@
* Must return at least tva, htva and tvac
*/
require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_compute.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_tva.class.php';
diff --git a/html/direct.php b/html/direct.php
index ed079f898..d08d460f4 100644
--- a/html/direct.php
+++ b/html/direct.php
@@ -19,7 +19,7 @@
*/
require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
$cn=Dossier::connect();
diff --git a/html/do.php b/html/do.php
index 6ec340c7a..211c56999 100644
--- a/html/do.php
+++ b/html/do.php
@@ -23,7 +23,7 @@ define('ALLOWED',1);
* \brief Main file
*/
require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/lib/user_common.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
diff --git a/html/export.php b/html/export.php
index 0d8cf6dab..d32bc4975 100644
--- a/html/export.php
+++ b/html/export.php
@@ -27,7 +27,7 @@
define ('ALLOWED',1);
require_once '../include/constant.php';
global $g_user,$cn,$g_parameter;
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
$gDossier=dossier::id();
diff --git a/html/extension.raw.php b/html/extension.raw.php
index 2d1eb9355..728aafacc 100644
--- a/html/extension.raw.php
+++ b/html/extension.raw.php
@@ -24,7 +24,7 @@
* the security. Load several javascript files
*/
require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
diff --git a/html/fid.php b/html/fid.php
index 124860ca7..005b11d30 100644
--- a/html/fid.php
+++ b/html/fid.php
@@ -34,7 +34,7 @@
*/
require_once '../include/constant.php';
require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/user_common.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
diff --git a/html/fid_card.php b/html/fid_card.php
index 52fe5f955..f10109977 100644
--- a/html/fid_card.php
+++ b/html/fid_card.php
@@ -26,7 +26,7 @@
*/
require_once '../include/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
/*!\brief
diff --git a/html/install.php b/html/install.php
index afddf43e1..e82a329fa 100644
--- a/html/install.php
+++ b/html/install.php
@@ -282,7 +282,7 @@ if ( ! file_exists(NOALYSS_INCLUDE.'/config.inc.php')) {
// magic_quotes_sybase = Off
// include_path
require_once NOALYSS_INCLUDE.'/lib/config_file.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
// we shouldn't use it
// if ( defined ("MULTI") && MULTI==1) { create_htaccess();}
diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js
index e51e7cce6..50e05f593 100644
--- a/html/js/acc_ledger.js
+++ b/html/js/acc_ledger.js
@@ -26,7 +26,7 @@
*/
var layer = 1;
/**
- * @brief update the list of available predefined operation when we change the ledger.
+ * update the list of available predefined operation when we change the ledger.
*/
function update_predef(p_type, p_direct, p_ac)
{
@@ -64,7 +64,7 @@ function update_predef(p_type, p_direct, p_ac)
}
/**
- * @brief update the list of payment method when we change the ledger.
+ * update the list of payment method when we change the ledger.
*/
function update_pay_method()
{
@@ -88,7 +88,7 @@ function update_pay_method()
}
/**
- *@brief update ctl id =jrn_name with the value of p_jrn
+ * update ctl id =jrn_name with the value of p_jrn
*/
function update_name()
{
@@ -109,7 +109,7 @@ function update_name()
}
/**
- * @brief update the field predef
+ * update the field predef
*/
function error_get_predef(request, json)
{
@@ -117,7 +117,7 @@ function error_get_predef(request, json)
}
/**
- * @brief update the list of available predefined operation when we change the ledger.
+ * update the list of available predefined operation when we change the ledger.
*/
function update_pj()
{
@@ -135,7 +135,7 @@ function update_pj()
);
}
/**
- *@brief ask the name, quick_code of the bank for the ledger
+ * ask the name, quick_code of the bank for the ledger
*/
function update_bank()
{
@@ -154,7 +154,7 @@ function update_bank()
}
/**
- * @brief Update the number of rows when changing of ledger
+ * Update the number of rows when changing of ledger
*/
function update_row(ctl)
{
@@ -213,7 +213,7 @@ function update_row(ctl)
}
}
/**
- * @brief Put into the span, the name of the bank, the bank account
+ * Put into the span, the name of the bank, the bank account
* and the quick_code
*/
function success_update_bank(req)
@@ -239,7 +239,7 @@ function success_update_bank(req)
}
}
/**
- * @brief call ajax, ask what is the last date for the current ledger
+ * call ajax, ask what is the last date for the current ledger
*/
function get_last_date()
{
@@ -257,7 +257,7 @@ function get_last_date()
);
}
/**
- * @brief callback ajax, set the ctl with the last date from the ledger
+ * callback ajax, set the ctl with the last date from the ledger
*/
function success_get_last_date(req)
{
@@ -282,7 +282,7 @@ function success_get_last_date(req)
}
}
/**
- * @brief update the field predef
+ * update the field predef
*/
function success_get_pj(request, json)
{
@@ -296,7 +296,7 @@ function success_get_pj(request, json)
g("e_pj_suggest").value = answer.pj;
}
/**
- * @brief update the field predef
+ * update the field predef
*/
function error_get_pj(request, json)
{
@@ -304,7 +304,7 @@ function error_get_pj(request, json)
}
/**
- * @brief add a line in the form for the ledger fin
+ * add a line in the form for the ledger fin
*/
function ledger_fin_add_row()
{
@@ -347,7 +347,7 @@ function ledger_fin_add_row()
}
/**
- * @brief add a line in the form for the purchase ledger
+ * add a line in the form for the purchase ledger
* @param p_dossier folder id
* @param p_table_name
*/
@@ -391,7 +391,7 @@ function ledger_add_row()
}
}
/**
- * @brief compute the sum of a purchase, update the span tvac, htva and tva
+ * compute the sum of a purchase, update the span tvac, htva and tva
* all the needed data are taken from the document (hidden field : gdossier)
* @param the number of the changed ctrl
*/
@@ -446,7 +446,7 @@ function compute_ledger(p_ctl_nb)
);
}
/**
- *@brief refresh the purchase screen, recompute vat, total...
+ * refresh the purchase screen, recompute vat, total...
*/
function refresh_ledger()
{
@@ -472,7 +472,7 @@ function refresh_ledger()
g('tvac').innerHTML = Math.round(tvac * 100) / 100;
}
/**
- *@brief update the field htva, tva_id and tvac, callback function for compute_sold
+ * update the field htva, tva_id and tvac, callback function for compute_sold
* it the field TVA in the answer contains NA it means that VAT is appliable and then do not
* update the VAT field except htva_martc
*/
@@ -519,7 +519,7 @@ function success_compute_ledger(request, json)
}
/**
- * @brief callback error function for compute_sold
+ * callback error function for compute_sold
*/
function error_compute_ledger(request, json)
{
@@ -595,7 +595,7 @@ function clean_ledger(p_ctl_nb)
}
/**
- * @brief add a line in the form for the quick_writing
+ * add a line in the form for the quick_writing
*/
function quick_writing_add_row()
{
@@ -655,7 +655,7 @@ function go_next_concerned()
return true;
}
/**
- * @brief View the history of an account
+ * View the history of an account
* @param {type} p_value
* @param {type} dossier
* @returns {undefined}
@@ -687,7 +687,7 @@ function view_history_account(p_value, dossier,p_exercice)
}
/**
- * @brief View the history of an account
+ * View the history of an account
* @param {type} p_value
* @param {type} dossier
* @returns {undefined}
@@ -719,7 +719,7 @@ function view_history_anc_account(p_value, dossier,p_exercice)
}
/**
- * @brief Change the view of account history
+ * Change the view of account history
* @param {type} obj
* @returns {Boolean}
*/
@@ -792,7 +792,7 @@ function view_history_card(p_value, dossier,p_exercice)
);
}
/**
- * @brief update history view after changing the exercice
+ * update history view after changing the exercice
* @param {type} obj
* @returns {Boolean}
*/
@@ -955,7 +955,7 @@ function dropLink(p_dossier, p_div, p_jr_id, p_jr_id2)
);
}
/**
- *@brief this function is called before the querystring is send to the
+ * this function is called before the querystring is send to the
* fid2.php, add a filter based on the ledger 'p_jrn'
*@param obj is the input field
*@param queryString is the queryString to modify
@@ -976,7 +976,7 @@ function filter_card(obj, queryString)
return queryString;
}
/**
- *@brief to display the lettering for the operation, call
+ * to display the lettering for the operation, call
* ajax function
*@param obj object attribut : gDossier,j_id,obj_type
*/
@@ -1086,7 +1086,7 @@ function search_letter(obj)
}
}
/**
- *@brief save an operation in ajax, it concerns only the
+ * save an operation in ajax, it concerns only the
* comment, the pj and the rapt
* the form elements are access by their name
*@param obj form
@@ -1209,7 +1209,7 @@ function show_reconcile(p_div, p_let)
}
/**
- * @brief add a line in the form for the purchase ledger
+ * add a line in the form for the purchase ledger
*/
function gestion_add_row()
{
@@ -1272,7 +1272,7 @@ function document_remove(p_dossier,p_div,p_jrid)
});
}
/***
- * @brief receive an object and display a list of filter + form to save one
+ * receive an object and display a list of filter + form to save one
* fill up the span (id : {div}search_filter_span) with the name of the selected filter
* Object = '{'div':'','type':'ALL','all_type':1,'dossier':'10104'}'
* @see Acc_Ledger_Search
@@ -1405,7 +1405,7 @@ function load_filter(p_div,p_dossier,p_filter_id) {
});
}
/**
- * @brief delete a saved search filter from the db, it is limited to the current
+ * delete a saved search filter from the db, it is limited to the current
* user
* @parameter p_div
identification des elements LI manageli{div}_{filter_id}
diff --git a/html/js/accounting_item.js b/html/js/accounting_item.js
index 41f3a34ff..3ec5648f7 100644
--- a/html/js/accounting_item.js
+++ b/html/js/accounting_item.js
@@ -40,7 +40,7 @@ function set_jrn_parent(p_ctl,p_value)
}
}
/**
- *@brief show the popup for search an accounting item
+ * show the popup for search an accounting item
*@param object this, it must contains some attribute as
* - jrn if set and different to 0, will filter the accounting item for a
* ledger
@@ -136,7 +136,7 @@ function search_poste(obj)
}
}
/**
- *@brief when you submit the form for searching a accounting item
+ * when you submit the form for searching a accounting item
*@param obj form
*@note the same as search_poste, except it answer to a FORM and not
* to a click event
@@ -194,7 +194,7 @@ function search_get_poste(obj)
}
/**
- *@brief show the answer of ajax request
+ * show the answer of ajax request
*@param answer in XML
*/
function result_poste_search(req)
@@ -231,7 +231,7 @@ function result_poste_search(req)
}
/**
-*@brief error for ajax
+* error for ajax
*/
function errorPoste()
{
diff --git a/html/js/admin.js b/html/js/admin.js
index 64cc823a6..3f8b747db 100644
--- a/html/js/admin.js
+++ b/html/js/admin.js
@@ -17,7 +17,7 @@
*/
/**
* @file
- * @brief contains the javascript for the administration page
+ * contains the javascript for the administration page
*/
/**
* Display the forbidden folders if the request comes from a form
diff --git a/html/js/anc_script.js b/html/js/anc_script.js
index 101470d1e..692f02c0e 100644
--- a/html/js/anc_script.js
+++ b/html/js/anc_script.js
@@ -21,7 +21,7 @@
/**
* @file
- * @brief javascript for the analytic accountancy
+ * javascript for the analytic accountancy
*/
/*!\brief add a row for the CA
@@ -322,7 +322,7 @@ function caod_checkTotal()
}
/**
- *@brief remove an operation
+ * remove an operation
*@param p_dossier is the folder
*@param p_oa_group is the group of the analytic operation
*/
@@ -378,7 +378,7 @@ function anc_add_row(tableid)
nb.value++;
}
/**
- *@brief this function is called before the querystring is send to the
+ * this function is called before the querystring is send to the
* fid2.php, add a filter based on the ledger 'p_jrn'
*@param obj is the input field
*@param queryString is the queryString to modify
@@ -391,7 +391,7 @@ function filter_anc(obj, queryString)
return queryString;
}
/**
- * @brief compute and display Analytic activity, related to the choosen distribution key
+ * compute and display Analytic activity, related to the choosen distribution key
* @param p_dossier is the dossier id
* @param p_table is table id to replace
* @param p_amount is the amount to distribute
@@ -440,7 +440,7 @@ function anc_key_compute(p_dossier, p_table, p_amount, p_key_id)
}
}
/**
- * @brief choose the distribution key
+ * choose the distribution key
* in ajax, a window let you choose what key you want to use
*
* @param p_dossier is the dossier
diff --git a/html/js/card.js b/html/js/card.js
index 87eb2785a..2e63350b6 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -25,7 +25,7 @@
var card_layer=1;
/**
- *@brief search a card an display the result into a inner box
+ * search a card an display the result into a inner box
*/
function boxsearch_card(p_dossier)
{
@@ -55,7 +55,7 @@ function boxsearch_card(p_dossier)
}
}
/**
- *@brief show the ipopup with the form to search a card
+ * show the ipopup with the form to search a card
* the properties
* - jrn for the ledger
* - fs for the action
@@ -122,7 +122,7 @@ function search_card(obj)
}
}
/**
- *@brief Display form for select card to add to action : other_concerned
+ * Display form for select card to add to action : other_concerned
*action_add_concerned_card
*/
function action_add_concerned_card(obj)
@@ -224,7 +224,7 @@ function action_add_concerned_card(obj)
}
/**
- *@brief when you submit the form for searching a card
+ * when you submit the form for searching a card
*@param obj form
*@note the same as search_card, except it answer to a FORM and not
* to a click event
@@ -285,7 +285,7 @@ function search_get_card(obj)
);
}
/**
- *@brief show the answer of ajax request
+ * show the answer of ajax request
*@param answer in XML
*/
function result_card_search(req)
@@ -399,7 +399,7 @@ function update_value(text,li)
ajaxFid(text);
}
/**
- *@brief is called when something change in ICard
+ * is called when something change in ICard
*@param the input field
*@see ICard
*/
@@ -409,7 +409,7 @@ function fill_data_onchange(ctl)
}
/**
- *@brief is called when something change in ICard
+ * is called when something change in ICard
*@param the input field
*@see ICard
*/
@@ -419,7 +419,7 @@ function fill_data(text,li)
}
/**
- *@brief is called when something change in ICard
+ * is called when something change in ICard
*@param the input field
*@see ICard
*/
@@ -429,7 +429,7 @@ function fill_fin_data_onchange(ctl)
ajax_saldo(ctl.id);
}
/**
- *@brief is called when something change in ICard
+ * is called when something change in ICard
*@param the input field
*@see ICard
*/
@@ -439,7 +439,7 @@ function fill_fin_data(text,li)
ajax_saldo($(text.id));
}
/**
- *@brief show the ipopup window and display the details of a card,
+ * show the ipopup window and display the details of a card,
* to work some attribute must be set
*@param obj.qcode is the qcode, obj.nohistory if you don't want to display
* the history button, obj.ro is the popin is readonly
@@ -498,7 +498,7 @@ function fill_ipopcard(obj)
);
}
/**
- *@brief
+ *
* \param request : object request
* \param json : json answer
\code
@@ -537,7 +537,7 @@ function successFill_ipopcard(req,json)
}
}
/**
- *@brief show the ipopup for selecting a card type, it is a needed step before adding
+ * show the ipopup for selecting a card type, it is a needed step before adding
* a card
*@param input field (obj) it must have the attribute ipopup
* possible attribute :
@@ -628,7 +628,7 @@ function select_card_type(obj)
);
}
/**
- *@brief Show a blank card
+ * Show a blank card
*@param obj Form object (obj)
* possible attribute :
* - filter is the filter but with a fd_id list, -1 means there is no filter
@@ -717,7 +717,7 @@ function form_blank_card(obj)
}
/**
- *@brief save the data contained into the form 'save_card'
+ * save the data contained into the form 'save_card'
*@param input field (obj) it must have the attribute ipopup
* possible attribute :
*@see ajax_card.php
@@ -782,7 +782,7 @@ function save_card(obj)
);
}
/**
- *@brief add a category of card,
+ * add a category of card,
*@param obj with the attribute
* - ipopup the ipopup to show
* - type_cat the category of card we want to add
@@ -828,7 +828,7 @@ function add_category(obj)
}
/**
- * @brief save the form and add a new category of card
+ * save the form and add a new category of card
* @param obj if the form object
*/
function save_card_category(obj)
@@ -864,7 +864,7 @@ function save_card_category(obj)
return false;
}
/**
- *@brief Remove a definition of an attribut
+ * Remove a definition of an attribut
*@param attr_def.ad_id
*@param gDossier
*@param table_id to rm the row
diff --git a/html/js/gestion.js b/html/js/gestion.js
index de1e19b61..621efdf03 100644
--- a/html/js/gestion.js
+++ b/html/js/gestion.js
@@ -27,7 +27,7 @@
/**
- *@brief remove an attached document of an action
+ * remove an attached document of an action
*@param dossier
*@param dt_id id of the document (pk document:d_id)
*/
@@ -54,7 +54,7 @@ function remove_document(p_dossier,p_id)
/**
- *@brief remove the concerned operation of an action
+ * remove the concerned operation of an action
*@param dossier
*@param p_id id pk action_comment_operation
*/
@@ -95,7 +95,7 @@ function successRemoveOp(request,json)
}
}
/**
- *@brief remove the concerned operation of an action
+ * remove the concerned operation of an action
*@param dossier
*@param p_id id pk action_comment_operation
*/
@@ -132,7 +132,7 @@ function remove_action(p_dossier,p_id,ag_id)
}
/**
- *@brief remove comment of an action
+ * remove comment of an action
*@param dossier
*@param p_id pk action_gestion_comment
*/
@@ -169,14 +169,14 @@ function successRemoveComment(request,json)
}
/**
- *@brief error if a document if removed
+ * error if a document if removed
*/
function errorRemoveDoc()
{
alert_box('Impossible d\'effacer ce document');
}
/**
- *@brief success when removing a document
+ * success when removing a document
*/
function successRemoveDoc(request,json)
{
@@ -192,7 +192,7 @@ function successRemoveDoc(request,json)
}
/**
-* @brief check the format of the hour
+* check the format of the hour
* @param p_ctl is the control where the hour is encoded
*/
function check_hour(p_ctl)
@@ -211,7 +211,7 @@ function check_hour(p_ctl)
}
/**
- *@brief remove an attached document of an action
+ * remove an attached document of an action
*@param dossier
*@param dt_id id of the document (pk document:d_id)
*/
@@ -240,14 +240,14 @@ function removeStock(s_id,p_dossier)
});
}
/**
- *@brief error if a document if removed
+ * error if a document if removed
*/
function errorRemoveStock()
{
alert_box('Impossible d\'effacer ');
}
/**
- *@brief success when removing a document
+ * success when removing a document
*/
function successRemoveStock(request,json)
{
@@ -267,7 +267,7 @@ function successRemoveStock(request,json)
}
}
/**
- * @brief display details of the last actions in management
+ * display details of the last actions in management
* called from dashboard
* @param p_dossier : dossier id
*/
@@ -293,7 +293,7 @@ function action_show(p_dossier)
}
}
/**
- * @brief Display a box for adding a new event
+ * Display a box for adding a new event
* @param {type} p_dossier
* @returns {undefined}
*/
@@ -323,7 +323,7 @@ function action_add(p_dossier) {
}
}
/**
- * @brief The new event is entered into the div action_add_div, we try
+ * The new event is entered into the div action_add_div, we try
* to save and receive as answer a XML file with a code of success and possibly
* a message
* If the message is OK then the div is fading out, otherwise the reason of
diff --git a/html/login.php b/html/login.php
index e6ae4ddaa..089040878 100644
--- a/html/login.php
+++ b/html/login.php
@@ -25,7 +25,7 @@ include_once NOALYSS_INCLUDE.'/lib/ac_common.php';
* \brief Login page
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
// Verif if User and Pass match DB
// if no, then redirect to the login page
$rep=new Database();
diff --git a/html/logout.php b/html/logout.php
index be049ff1f..19db731a2 100644
--- a/html/logout.php
+++ b/html/logout.php
@@ -22,7 +22,7 @@
*/
require_once '../include/constant.php';
require_once ("lib/ac_common.php");
-require_once('lib/database.class.php');
+require_once('class/database.class.php');
session_unset();
html_page_start("classic");
diff --git a/html/popup.php b/html/popup.php
index f1a3c8a19..b985af528 100644
--- a/html/popup.php
+++ b/html/popup.php
@@ -23,7 +23,7 @@ require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/class/periode.class.php';
diff --git a/html/recherche.php b/html/recherche.php
index 03f35e294..b2ebdba50 100644
--- a/html/recherche.php
+++ b/html/recherche.php
@@ -37,7 +37,7 @@ $http=new HttpInput();
$gDossier=dossier::id();
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/* Admin. Dossier */
$cn=Dossier::connect();
diff --git a/html/test.php b/html/test.php
index bcb72c398..7fd947713 100644
--- a/html/test.php
+++ b/html/test.php
@@ -31,7 +31,7 @@
include_once("../include/constant.php");
include_once("lib/ac_common.php");
-require_once('lib/database.class.php');
+require_once('class/database.class.php');
require_once ('class/dossier.class.php');
require_once('lib/html_input.class.php');
require_once('lib/icon_action.class.php');
diff --git a/html/user_login.php b/html/user_login.php
index d1f037656..6121be652 100644
--- a/html/user_login.php
+++ b/html/user_login.php
@@ -23,7 +23,7 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
require_once '../include/constant.php';
include_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
diff --git a/include/admin_repo.inc.php b/include/admin_repo.inc.php
index 821a81cce..a18e4ab0e 100644
--- a/include/admin_repo.inc.php
+++ b/include/admin_repo.inc.php
@@ -27,7 +27,7 @@ if ( ! defined ('ALLOWED_ADMIN')) { die (_('Non autorisé'));}
include_once NOALYSS_INCLUDE."/class/user.class.php";
require_once NOALYSS_INCLUDE."/lib/user_common.php";
include_once NOALYSS_INCLUDE."/lib/ac_common.php";
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE."/lib/user_menu.php";
require_once NOALYSS_INCLUDE."/lib/http_input.class.php";
require_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
diff --git a/include/ajax/ajax_accounting.php b/include/ajax/ajax_accounting.php
index a0f6c81ff..82ba65b59 100644
--- a/include/ajax/ajax_accounting.php
+++ b/include/ajax/ajax_accounting.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_anc_accounting.php b/include/ajax/ajax_anc_accounting.php
index fe148215f..b7ecc23af 100644
--- a/include/ajax/ajax_anc_accounting.php
+++ b/include/ajax/ajax_anc_accounting.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_anc_detail_operation.php b/include/ajax/ajax_anc_detail_operation.php
index 81844a9bc..a12112657 100644
--- a/include/ajax/ajax_anc_detail_operation.php
+++ b/include/ajax/ajax_anc_detail_operation.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_anc_search.php b/include/ajax/ajax_anc_search.php
index 071ac43e1..5a4711ce1 100644
--- a/include/ajax/ajax_anc_search.php
+++ b/include/ajax/ajax_anc_search.php
@@ -31,7 +31,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/lib/ibutton.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
diff --git a/include/ajax/ajax_auto_anc_card.php b/include/ajax/ajax_auto_anc_card.php
index 917154d86..a04732662 100644
--- a/include/ajax/ajax_auto_anc_card.php
+++ b/include/ajax/ajax_auto_anc_card.php
@@ -6,7 +6,7 @@
*@brief no used ??
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
$cn=Dossier::connect();
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index d4a076b0f..1e7df81d4 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -56,7 +56,7 @@
*/
if ( ! defined('ALLOWED')) die (_('Accès non autorisé'));
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
require_once NOALYSS_INCLUDE.'/lib/iradio.class.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
diff --git a/include/ajax/ajax_display_all_card.php b/include/ajax/ajax_display_all_card.php
index 4f9b5168e..22332a051 100644
--- a/include/ajax/ajax_display_all_card.php
+++ b/include/ajax/ajax_display_all_card.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_follow_up.php b/include/ajax/ajax_follow_up.php
index bc99e3722..bd44370a9 100644
--- a/include/ajax/ajax_follow_up.php
+++ b/include/ajax/ajax_follow_up.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_get_receipt.php b/include/ajax/ajax_get_receipt.php
index 1e6019324..00e5cf7a9 100644
--- a/include/ajax/ajax_get_receipt.php
+++ b/include/ajax/ajax_get_receipt.php
@@ -30,7 +30,7 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php
index 904b71fe9..b0eef4eb1 100644
--- a/include/ajax/ajax_history.php
+++ b/include/ajax/ajax_history.php
@@ -25,7 +25,7 @@
*/
if ( ! defined('ALLOWED')) die (_('Accès interdit'));
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/periode.class.php';
diff --git a/include/ajax/ajax_history_anc_account.php b/include/ajax/ajax_history_anc_account.php
index 73036ae8a..5e643574b 100644
--- a/include/ajax/ajax_history_anc_account.php
+++ b/include/ajax/ajax_history_anc_account.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_ledger.php b/include/ajax/ajax_ledger.php
index 199e311c1..b475004be 100644
--- a/include/ajax/ajax_ledger.php
+++ b/include/ajax/ajax_ledger.php
@@ -30,7 +30,7 @@
*/
if ( ! defined('ALLOWED')) die(_('Non authorisé'));
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
diff --git a/include/ajax/ajax_mod_document.php b/include/ajax/ajax_mod_document.php
index 88a48e931..384747bb2 100644
--- a/include/ajax/ajax_mod_document.php
+++ b/include/ajax/ajax_mod_document.php
@@ -23,7 +23,7 @@
* \brief show the detail of a document and let you modify it
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/document_modele.class.php';
diff --git a/include/ajax/ajax_periode.php b/include/ajax/ajax_periode.php
index 6dd49386a..df7af35ac 100644
--- a/include/ajax/ajax_periode.php
+++ b/include/ajax/ajax_periode.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_poste.php b/include/ajax/ajax_poste.php
index d7c96dfd3..899dbadb8 100644
--- a/include/ajax/ajax_poste.php
+++ b/include/ajax/ajax_poste.php
@@ -36,7 +36,7 @@ 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.'/class/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");
diff --git a/include/ajax/ajax_search_filter.php b/include/ajax/ajax_search_filter.php
index 30489b501..8d9419cf9 100644
--- a/include/ajax/ajax_search_filter.php
+++ b/include/ajax/ajax_search_filter.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_search_operation.php b/include/ajax/ajax_search_operation.php
index 446c9beb4..68988eab9 100644
--- a/include/ajax/ajax_search_operation.php
+++ b/include/ajax/ajax_search_operation.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* ! \file
+/*! \file
* \brief Search module
*/
if (!defined('ALLOWED'))
@@ -30,7 +30,7 @@ require_once NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php';
global $http;
$gDossier=dossier::id();
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/* Admin. Dossier */
$cn=Dossier::connect();
diff --git a/include/ajax/ajax_template_cat_card.php b/include/ajax/ajax_template_cat_card.php
index 05ad1c1cc..155bd2de2 100644
--- a/include/ajax/ajax_template_cat_card.php
+++ b/include/ajax/ajax_template_cat_card.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_template_cat_category.php b/include/ajax/ajax_template_cat_category.php
index 32f22d9e2..241b98954 100644
--- a/include/ajax/ajax_template_cat_category.php
+++ b/include/ajax/ajax_template_cat_category.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_todo_list.php b/include/ajax/ajax_todo_list.php
index 430014b9a..95d9c2597 100644
--- a/include/ajax/ajax_todo_list.php
+++ b/include/ajax/ajax_todo_list.php
@@ -36,7 +36,7 @@
if ( ! defined ('ALLOWED') ) die (_('Aucun accès direct'));
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/todo_list.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
mb_internal_encoding("UTF-8");
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
diff --git a/include/ajax/ajax_tva_parameter.php b/include/ajax/ajax_tva_parameter.php
index 9dffd57c2..cf2107aa0 100644
--- a/include/ajax/ajax_tva_parameter.php
+++ b/include/ajax/ajax_tva_parameter.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/ajax/ajax_update_predef.php b/include/ajax/ajax_update_predef.php
index 7979d603a..335afb350 100644
--- a/include/ajax/ajax_update_predef.php
+++ b/include/ajax/ajax_update_predef.php
@@ -29,7 +29,7 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/pre_operation.class.php';
diff --git a/include/ajax/ajax_user_security.php b/include/ajax/ajax_user_security.php
index 6deddf0b9..43d8e37dd 100644
--- a/include/ajax/ajax_user_security.php
+++ b/include/ajax/ajax_user_security.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/cfgfiche.inc.php b/include/cfgfiche.inc.php
index 1e87e9f3b..6955015cc 100644
--- a/include/cfgfiche.inc.php
+++ b/include/cfgfiche.inc.php
@@ -25,7 +25,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/user_menu.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php';
diff --git a/include/cfgledger.inc.php b/include/cfgledger.inc.php
index 1d4dbe57c..9da41a3a9 100644
--- a/include/cfgledger.inc.php
+++ b/include/cfgledger.inc.php
@@ -29,7 +29,7 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/lib/user_menu.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
diff --git a/include/class/acc_account.class.php b/include/class/acc_account.class.php
index 4a41f6915..8f4192712 100644
--- a/include/class/acc_account.class.php
+++ b/include/class/acc_account.class.php
@@ -24,7 +24,7 @@
* \brief Manage the account from the table tmp_pcmn
*/
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/database/tmp_pcmn_sql.class.php';
diff --git a/include/class/acc_account_ledger.class.php b/include/class/acc_account_ledger.class.php
index b381a9f0e..8b2c146d4 100644
--- a/include/class/acc_account_ledger.class.php
+++ b/include/class/acc_account_ledger.class.php
@@ -24,7 +24,7 @@
* \brief Manage the account from the table jrn, jrnx or tmp_pcmn
*/
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
class Acc_Account_Ledger
diff --git a/include/class/acc_bilan.class.php b/include/class/acc_bilan.class.php
index 9585cfdee..76ec7b8bf 100644
--- a/include/class/acc_bilan.class.php
+++ b/include/class/acc_bilan.class.php
@@ -24,7 +24,7 @@
*
*/
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/lib/impress.class.php';
require_once NOALYSS_INCLUDE.'/header_print.php';
diff --git a/include/class/acc_ledger_history_financial.class.php b/include/class/acc_ledger_history_financial.class.php
index 23f644310..798b9afcb 100644
--- a/include/class/acc_ledger_history_financial.class.php
+++ b/include/class/acc_ledger_history_financial.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/acc_ledger_history_generic.class.php b/include/class/acc_ledger_history_generic.class.php
index 98c2203cc..716155291 100644
--- a/include/class/acc_ledger_history_generic.class.php
+++ b/include/class/acc_ledger_history_generic.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/acc_ledger_history_purchase.class.php b/include/class/acc_ledger_history_purchase.class.php
index da0aa67c5..618a4eed9 100644
--- a/include/class/acc_ledger_history_purchase.class.php
+++ b/include/class/acc_ledger_history_purchase.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/acc_ledger_history_sale.class.php b/include/class/acc_ledger_history_sale.class.php
index 9190f14e7..92850d8c7 100644
--- a/include/class/acc_ledger_history_sale.class.php
+++ b/include/class/acc_ledger_history_sale.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/acc_ledger_info.class.php b/include/class/acc_ledger_info.class.php
index 52cc71b1b..689879b06 100644
--- a/include/class/acc_ledger_info.class.php
+++ b/include/class/acc_ledger_info.class.php
@@ -19,7 +19,7 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
/*!\file
diff --git a/include/class/acc_ledger_search.class.php b/include/class/acc_ledger_search.class.php
index 8dd53fabf..40e0ca6a3 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/acc_reconciliation.class.php b/include/class/acc_reconciliation.class.php
index e900f5963..31dc07f06 100644
--- a/include/class/acc_reconciliation.class.php
+++ b/include/class/acc_reconciliation.class.php
@@ -25,7 +25,7 @@
*
*/
require_once NOALYSS_INCLUDE.'/lib/iconcerned.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/lettering.class.php';
diff --git a/include/class/acc_tva.class.php b/include/class/acc_tva.class.php
index ebbe095ac..27b402990 100644
--- a/include/class/acc_tva.class.php
+++ b/include/class/acc_tva.class.php
@@ -23,7 +23,7 @@
* \brief this class is used for the table tva_rate
*/
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/*!\brief Acc_Tva is used for to map the table tva_rate
* parameter are
diff --git a/include/class/admin.class.php b/include/class/admin.class.php
index f8fc8e20f..77216692b 100644
--- a/include/class/admin.class.php
+++ b/include/class/admin.class.php
@@ -18,7 +18,7 @@
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_parm_code.class.php';
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
diff --git a/include/class/anc_account_table.class.php b/include/class/anc_account_table.class.php
index 62f652d34..a1beb3942 100644
--- a/include/class/anc_account_table.class.php
+++ b/include/class/anc_account_table.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/anc_balance_double.class.php b/include/class/anc_balance_double.class.php
index 92337a374..0851e5bb6 100644
--- a/include/class/anc_balance_double.class.php
+++ b/include/class/anc_balance_double.class.php
@@ -30,7 +30,7 @@ require_once NOALYSS_INCLUDE.'/lib/ibutton.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_print.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
/**
* @class
* @brief Print the crossed balance between 2 plan
diff --git a/include/class/anc_balance_simple.class.php b/include/class/anc_balance_simple.class.php
index 4766cc365..6a9764eea 100644
--- a/include/class/anc_balance_simple.class.php
+++ b/include/class/anc_balance_simple.class.php
@@ -27,7 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_print.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdfbalance_simple.class.php';
require_once NOALYSS_INCLUDE.'/header_print.php';
/*! \brief manage the simple balance for CA, inherit from balance_ca
*
diff --git a/include/class/anc_group.class.php b/include/class/anc_group.class.php
index fd4a1dda6..34f5cfba1 100644
--- a/include/class/anc_group.class.php
+++ b/include/class/anc_group.class.php
@@ -23,7 +23,7 @@
* \brief class for the group of the analytic account
*
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/constant.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_print.class.php';
diff --git a/include/class/anc_group_operation.class.php b/include/class/anc_group_operation.class.php
index 8c7e22dc1..05f519981 100644
--- a/include/class/anc_group_operation.class.php
+++ b/include/class/anc_group_operation.class.php
@@ -31,7 +31,7 @@ require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/lib/icheckbox.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_operation.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
diff --git a/include/class/anc_plan.class.php b/include/class/anc_plan.class.php
index b55e8a951..93bb90608 100644
--- a/include/class/anc_plan.class.php
+++ b/include/class/anc_plan.class.php
@@ -29,7 +29,7 @@
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/database/poste_analytique_sql.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
diff --git a/include/class/anc_print.class.php b/include/class/anc_print.class.php
index 174fb1a50..dedefcb2a 100644
--- a/include/class/anc_print.class.php
+++ b/include/class/anc_print.class.php
@@ -32,7 +32,7 @@ require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/lib/ibutton.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/constant.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/anc_plan.class.php';
diff --git a/include/class/bank.class.php b/include/class/bank.class.php
index 731b40466..1429f8778 100644
--- a/include/class/bank.class.php
+++ b/include/class/bank.class.php
@@ -18,7 +18,7 @@
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_parm_code.class.php';
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
diff --git a/include/class/customer.class.php b/include/class/customer.class.php
index 4a7d10f15..b6e8efcd0 100644
--- a/include/class/customer.class.php
+++ b/include/class/customer.class.php
@@ -18,7 +18,7 @@
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_parm_code.class.php';
require_once NOALYSS_INCLUDE.'/class/periode.class.php';
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
diff --git a/include/class/database.class.php b/include/class/database.class.php
new file mode 100644
index 000000000..71dce9ccc
--- /dev/null
+++ b/include/class/database.class.php
@@ -0,0 +1,246 @@
+ 10)
+ die("-->Dossier invalide [$p_database_id]");
+ $noalyss_user = (defined("noalyss_user")) ? noalyss_user : phpcompta_user;
+ $password = (defined("noalyss_password")) ? noalyss_password : phpcompta_password;
+ $port = (defined("noalyss_psql_port")) ? noalyss_psql_port : phpcompta_psql_port;
+ $host = (!defined("noalyss_psql_host")) ? '127.0.0.1' : noalyss_psql_host;
+ if (defined("MULTI") && MULTI == "0") {
+ $l_dossier = dbname;
+ } else {
+
+ if ($p_database_id == 0) { /* connect to the repository */
+ $l_dossier = sprintf("%saccount_repository", strtolower(domaine));
+ } else if ($p_type == 'dos') { /* connect to a folder (dossier) */
+ $l_dossier = sprintf("%sdossier%d", strtolower(domaine), $p_database_id);
+ } else if ($p_type == 'mod') { /* connect to a template (modele) */
+ $l_dossier = sprintf("%smod%d", strtolower(domaine), $p_database_id);
+ } else if ($p_type == 'template') {
+ $l_dossier = 'template1';
+ } else {
+ throw new Exception('Connection invalide');
+ }
+ }
+
+ parent::__construct($noalyss_user, $password, $l_dossier, $host, $port);
+
+ if ($this->exist_schema('comptaproc')) {
+ $this->exec_sql('set search_path to public,comptaproc,pg_catalog;');
+ }
+ $this->exec_sql('set DateStyle to ISO, MDY;');
+
+ }
+
+ /***
+ * \brief Save a "piece justificative" , the name must be pj
+ *
+ * \param $seq jr_grpt_id
+ * \return $oid of the lob file if success
+ * null if a error occurs
+ *
+ */
+ function save_receipt($seq)
+ {
+ $oid = $this->upload('pj');
+ if ($oid == false) {
+ return false;
+ }
+ // Remove old document
+ $ret = $this->exec_sql("select jr_pj from jrn where jr_grpt_id=$seq");
+ if (pg_num_rows($ret) != 0) {
+ $r = pg_fetch_array($ret, 0);
+ $old_oid = $r['jr_pj'];
+ if (strlen($old_oid) != 0)
+ pg_lo_unlink($cn, $old_oid);
+ }
+ // Load new document
+ $this->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2,
+ jr_pj_type=$3 where jr_grpt_id=$4",
+ array($oid, $_FILES['pj']['name'], $_FILES['pj']['type'], $seq));
+ return $oid;
+ }
+
+ /**
+ * \brief Get version of a database, the content of the
+ * table version
+ *
+ * \return version number
+ *
+ */
+
+ function get_version()
+ {
+ $Res = $this->get_value("select max(val) from version");
+ return $Res;
+ }
+
+ /**
+ * \brief loop to apply all the path to a folder or
+ * a template
+ * \param $p_name database name
+ *
+ */
+
+ function apply_patch($p_name)
+ {
+ if (!$this->exist_table('version')) {
+ echo _('Base de donnée vide');
+ return;
+ }
+ $MaxVersion = DBVERSION - 1;
+ $succeed = "✓";
+ echo '
';
+ for ($i = 4; $i <= $MaxVersion; $i++) {
+ $to = $i + 1;
+
+ if ($this->get_version() <= $i) {
+ if ($this->get_version() == 97) {
+ if ($this->exist_schema("amortissement")) {
+ $this->exec_sql('ALTER TABLE amortissement.amortissement_histo
+ ADD CONSTRAINT internal_fk FOREIGN KEY (jr_internal) REFERENCES jrn (jr_internal)
+ ON UPDATE CASCADE ON DELETE SET NULL');
+ }
+ }
+ echo "
Patching " . $p_name .
+ " from the version " . $this->get_version() . " to $to ";
+
+ $this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade' . $i . '.sql');
+ echo $succeed;
+
+ if (!DEBUG)
+ ob_start();
+ // specific for version 4
+ if ($i == 4) {
+ $sql = "select jrn_def_id from jrn_def ";
+ $Res = $this->exec_sql($sql);
+ $Max = $this->size();
+ for ($seq = 0; $seq < $Max; $seq++) {
+ $row = pg_fetch_array($Res, $seq);
+ $sql = sprintf("create sequence s_jrn_%d", $row['jrn_def_id']);
+ $this->exec_sql($sql);
+ }
+ }
+ // specific to version 7
+ if ($i == 7) {
+ // now we use sequence instead of computing a max
+ //
+ $Res2 = $this->exec_sql('select coalesce(max(jr_grpt_id),1) as l from jrn');
+ $Max2 = pg_NumRows($Res2);
+ if ($Max2 == 1) {
+ $Row = pg_fetch_array($Res2, 0);
+ var_dump($Row);
+ $M = $Row['l'];
+ $this->exec_sql("select setval('s_grpt',$M,true)");
+ }
+ }
+ // specific to version 17
+ if ($i == 17) {
+ $this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade17.sql');
+ $max = $this->get_value('select last_value from s_jnt_fic_att_value');
+ $this->alter_seq($p_cn, 's_jnt_fic_att_value', $max + 1);
+ } // version
+ // reset sequence in the modele
+ //--
+ if ($i == 30 && $p_name == "mod") {
+ $a_seq = array('s_jrn', 's_jrn_op', 's_centralized',
+ 's_stock_goods', 'c_order', 's_central');
+ foreach ($a_seq as $seq) {
+ $sql = sprintf("select setval('%s',1,false)", $seq);
+ $Res = $this->exec_sql($sql);
+ }
+ $sql = "select jrn_def_id from jrn_def ";
+ $Res = $this->exec_sql($sql);
+ $Max = pg_NumRows($Res);
+ for ($seq = 0; $seq < $Max; $seq++) {
+ $row = pg_fetch_array($Res, $seq);
+ $sql = sprintf("select setval('s_jrn_%d',1,false)", $row['jrn_def_id']);
+ $this->exec_sql($sql);
+ }
+ }
+ if ($i == 36) {
+ /* check the country and apply the path */
+ $res = $this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
+ $country = pg_fetch_result($res, 0, 0);
+ $this->execute_script(NOALYSS_INCLUDE . "/sql/patch/upgrade36." . $country . ".sql");
+ $this->exec_sql('update tmp_pcmn set pcm_type=find_pcm_type(pcm_val)');
+ }
+ if ($i == 59) {
+ $res = $this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
+ $country = pg_fetch_result($res, 0, 0);
+ if ($country == 'BE')
+ $this->exec_sql("insert into parm_code values ('SUPPLIER',440,'Poste par défaut pour les fournisseurs')");
+ if ($country == 'FR')
+ $this->exec_sql("insert into parm_code values ('SUPPLIER',400,'Poste par défaut pour les fournisseurs')");
+ }
+ if ($i == 61) {
+ $country = $this->get_value("select pr_value from parameter where pr_id='MY_COUNTRY'");
+ $this->execute_script(NOALYSS_INCLUDE . "/sql/patch/upgrade61." . $country . ".sql");
+ }
+
+ if (!DEBUG)
+ ob_end_clean();
+ }
+ }
+ echo '
';
+ }
+
+ /**
+ * return the name of the database with the domain name
+ * @param $p_id of the folder WITHOUT the domain name
+ * @param $p_type dos for folder mod for template
+ * @return formatted name
+ */
+ function format_name($p_id, $p_type)
+ {
+ switch ($p_type) {
+ case 'dos':
+ $sys_name = sprintf("%sdossier%d", strtolower(domaine), $p_id);
+ break;
+ case 'mod':
+ $sys_name = sprintf("%smod%d", strtolower(domaine), $p_id);
+ break;
+ default:
+ echo_error(__FILE__ . " format_name invalid type " . $p_type, __LINE__);
+ throw new Exception(__FILE__ . " format_name invalid type " . $p_type . __LINE__);
+ }
+ return $sys_name;
+ }
+}
\ No newline at end of file
diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php
index 5eea06b8b..23705b168 100644
--- a/include/class/dossier.class.php
+++ b/include/class/dossier.class.php
@@ -20,13 +20,13 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* !\file
+/*!\file
* \brief the class for the dossier, everywhere we need to know to
* which folder we are connected, because we can't use $_SESSION, we
* need to pass the dossier_id via a _GET or a POST variable
*/
-/* ! \brief manage the current dossier, everywhere we need to know to
+/*! \brief manage the current dossier, everywhere we need to know to
* which folder we are connected, because we can't use $_SESSION, we
* need to pass the dossier_id via a _GET or a POST variable
* private static $variable=array("id"=>"dos_id",
@@ -34,7 +34,7 @@
"desc"=>"dos_description");
*
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
@@ -52,7 +52,7 @@ class Dossier
$this->dos_id=$p_id;
}
- /* !\brief return the $_REQUEST['gDossier'] after a check */
+ /*!\brief return the $_REQUEST['gDossier'] after a check */
static function id()
{
@@ -127,7 +127,7 @@ class Dossier
return $nb_folder;
}
- /* !
+ /*!
* \brief Return all the users
* as an array
*/
@@ -161,7 +161,7 @@ class Dossier
return $res;
}
- /* !\brief check if gDossier is set */
+ /*!\brief check if gDossier is set */
static function check()
{
@@ -177,7 +177,7 @@ class Dossier
exit('gDossier Invalide : '.$id);
}
- /* !
+ /*!
* \brief return a string to put to gDossier into a GET
*/
@@ -187,7 +187,7 @@ class Dossier
return "gDossier=".$_REQUEST['gDossier'];
}
- /* !\brief return a string to set gDossier into a FORM */
+ /*!\brief return a string to set gDossier into a FORM */
static function hidden()
{
@@ -195,7 +195,7 @@ class Dossier
return '';
}
- /* !\brief retrieve the name of the current dossier */
+ /*!\brief retrieve the name of the current dossier */
static function name($id=0)
{
diff --git a/include/class/exercice.class.php b/include/class/exercice.class.php
index 504876684..296d5d8d4 100644
--- a/include/class/exercice.class.php
+++ b/include/class/exercice.class.php
@@ -22,7 +22,7 @@
/*!\file
* \brief about the accountant exercice
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
class Exercice
{
diff --git a/include/class/extension.class.php b/include/class/extension.class.php
index 86e29a814..64e4d33e5 100644
--- a/include/class/extension.class.php
+++ b/include/class/extension.class.php
@@ -20,11 +20,11 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* !\file
+/*!\file
* \brief the extension class manages the plugins for the security, the access
* the inclusion...
*/
-/* !\brief manage the extension, it involves the table extension
+/*!\brief manage the extension, it involves the table extension
*
* Data member
* - $cn database connection
@@ -57,7 +57,7 @@ class Extension extends Menu_Ref_sql
throw new Exception('Extension non trouvée, le chemin est-il correct?');
}
- /* !@brief search a extension, the what is the column (extends_code */
+ /*!@brief search a extension, the what is the column (extends_code */
function search($p_what)
{
@@ -67,7 +67,7 @@ class Extension extends Menu_Ref_sql
return 1;
}
- /* !\brief return 1 if the user given in parameter can access this extension
+ /*!\brief return 1 if the user given in parameter can access this extension
* otherwise returns 0
* \param $p_login the user login
* \return 1 has access, 0 has no access
@@ -86,7 +86,7 @@ class Extension extends Menu_Ref_sql
return 0;
}
- /* !@brief make an array of the available plugin for the current user
+ /*!@brief make an array of the available plugin for the current user
* @return an array
* @see ISelect
*/
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index b4f2d53b8..91cb7e824 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -185,7 +185,7 @@ class Fiche
{
/*
- * !! Missing attribute
+ *!! Missing attribute
*/
foreach ($e->attribut as $f )
{
diff --git a/include/class/fiche_attr.class.php b/include/class/fiche_attr.class.php
index eea1ed8b3..98cea2e90 100644
--- a/include/class/fiche_attr.class.php
+++ b/include/class/fiche_attr.class.php
@@ -6,7 +6,7 @@
*
*
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
class Fiche_Attr
diff --git a/include/class/follow_up_detail.class.php b/include/class/follow_up_detail.class.php
index e779bc750..fdb39abfd 100644
--- a/include/class/follow_up_detail.class.php
+++ b/include/class/follow_up_detail.class.php
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*!\file
@@ -152,7 +152,7 @@ class Follow_Up_Detail
$sql,
array($this->ag_id)
);
- if ( $this->db->count() == 0 ) return;
+ if ( $this->db->count() == 0 ) return array();
$aRet=array();
for($i=0;$icn = $p_cn;
+
+ $this->own = new Noalyss_Parameter_Folder($this->cn);
+ $this->soc = $this->own->MY_NAME;
+ $this->date = date('d.m.Y');
+ parent::__construct($orientation,$unit,$format);
+ date_default_timezone_set ('Europe/Paris');
+ }
+ function setDossierInfo($dossier = "n/a")
+ {
+ $this->dossier = dossier::name()." ".$dossier;
+ }
+ function Header()
+ {
+ //Arial bold 12
+ $this->SetFont('DejaVu', 'B', 12);
+ //Title
+ parent::Cell(0,10,$this->dossier, 'B', 0, 'C');
+ //Line break
+ parent::Ln(20);
+ }
+ function Footer()
+ {
+ //Position at 2 cm from bottom
+ $this->SetY(-20);
+ //Arial italic 8
+ $this->SetFont('Arial', '', 8);
+ //Page number
+ parent::Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
+ parent::Ln(3);
+ // Created by NOALYSS
+ parent::Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
+ }
+ /**
+ *@brief retrieve the client name and quick_code
+ *@param $p_jr_id jrn.jr_id
+ *@param $p_jrn_type ledger type ACH VEN FIN
+ *@return array (0=>qcode,1=>name) or for FIN 0=>customer qc 1=>customer name 2=>bank qc 3=>bank name
+ *@see class_print_ledger_simple, class_print_ledger_simple_without_vat
+ */
+ function get_tiers($p_jr_id,$p_jrn_type)
+ {
+ if ( $p_jrn_type=='ACH' )
+ {
+ $array=$this->cn->get_array('SELECT
+ jrnx.j_grpt,
+ quant_purchase.qp_supplier,
+ quant_purchase.qp_internal,
+ jrn.jr_internal
+ FROM
+ public.quant_purchase,
+ public.jrnx,
+ public.jrn
+ WHERE
+ quant_purchase.j_id = jrnx.j_id AND
+ jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
+ if (count($array)==0) return array("ERREUR $p_jr_id",'');
+ $customer_id=$array[0]['qp_supplier'];
+ $fiche=new Fiche($this->cn,$customer_id);
+ $customer_qc=$fiche->get_quick_code($customer_id);
+ $customer_name=$fiche->getName();
+ return array($customer_qc,$customer_name);
+ }
+ if ( $p_jrn_type=='VEN' )
+ {
+ $array=$this->cn->get_array('SELECT
+ quant_sold.qs_client
+ FROM
+ public.quant_sold,
+ public.jrnx,
+ public.jrn
+ WHERE
+ quant_sold.j_id = jrnx.j_id AND
+ jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
+ if (count($array)==0) return array("ERREUR $p_jr_id",'');
+ $customer_id=$array[0]['qs_client'];
+ $fiche=new Fiche($this->cn,$customer_id);
+ $customer_qc=$fiche->get_quick_code($customer_id);
+ $customer_name=$fiche->getName();
+ return array($customer_qc,$customer_name);
+ }
+ if ( $p_jrn_type=='FIN' )
+ {
+ $array=$this->cn->get_array('SELECT
+ qf_other,qf_bank
+ FROM
+ public.quant_fin
+ WHERE
+ quant_fin.jr_id =$1',array($p_jr_id));
+ if (count($array)==0) return array("ERREUR $p_jr_id",'','','');
+ $customer_id=$array[0]['qf_other'];
+ $fiche=new Fiche($this->cn,$customer_id);
+ $customer_qc=$fiche->get_quick_code($customer_id);
+ $customer_name=$fiche->getName();
+
+ $bank_id=$array[0]['qf_bank'];
+ $fiche=new Fiche($this->cn,$bank_id);
+ $bank_qc=$fiche->get_quick_code($bank_id);
+ $bank_name=$fiche->getName();
+
+ return array($customer_qc,$customer_name,$bank_qc,$bank_name);
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/include/class/pdf_land.class.php b/include/class/pdf_land.class.php
new file mode 100644
index 000000000..811f39b87
--- /dev/null
+++ b/include/class/pdf_land.class.php
@@ -0,0 +1,71 @@
+bigger=0;
+
+ parent::__construct($p_cn,'L', $unit, $format);
+ date_default_timezone_set ('Europe/Paris');
+ $this->AddFont('DejaVu','','DejaVuSans.ttf',true);
+ $this->AddFont('DejaVu','B','DejaVuSans-Bold.ttf',true);
+ $this->AddFont('DejaVu','BI','DejaVuSans-BoldOblique.ttf',true);
+ $this->AddFont('DejaVuCond','','DejaVuSansCondensed.ttf',true);
+ $this->AddFont('DejaVuCond','B','DejaVuSansCondensed-Bold.ttf',true);
+ $this->AddFont('DejaVuCond','I','DejaVuSansCondensed-Oblique.ttf',true);
+
+ $this->cn = $p_cn;
+ $this->own = new Noalyss_Parameter_Folder($this->cn);
+ $this->soc = $this->own->MY_NAME;
+ $this->date = date('d.m.Y');
+ }
+ function Header()
+ {
+ //Arial bold 12
+ $this->SetFont('DejaVu', 'B', 10);
+ //Title
+ $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
+ //Line break
+ $this->Ln(20);
+ }
+ function Footer()
+ {
+ //Position at 2 cm from bottom
+ $this->SetY(-20);
+ //Arial italic 8
+ $this->SetFont('DejaVuCond', 'I', 8);
+ //Page number
+ $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
+ $this->Ln(3);
+ // Created by NOALYSS
+ $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
+
+ }
+}
\ No newline at end of file
diff --git a/include/class/pdf_operation.class.php b/include/class/pdf_operation.class.php
index 19dc67d39..867b24392 100644
--- a/include/class/pdf_operation.class.php
+++ b/include/class/pdf_operation.class.php
@@ -25,7 +25,7 @@
* Detail Operation ACC + ANC , it will use Acc_Operation and Anc_Operation
*
*/
-require_once NOALYSS_INCLUDE . '/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE . '/class/pdf.class.php';
require_once NOALYSS_INCLUDE . '/class/acc_operation.class.php';
require_once NOALYSS_INCLUDE . '/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE . '/class/acc_operation.class.php';
diff --git a/include/class/pdfbalance_simple.class.php b/include/class/pdfbalance_simple.class.php
new file mode 100644
index 000000000..aa9c39f00
--- /dev/null
+++ b/include/class/pdfbalance_simple.class.php
@@ -0,0 +1,63 @@
+dossier=sprintf(_('Balance simple %s'),dossier::name());
+ $this->from_poste=$p_from_poste;
+ $this->to_poste=$to_poste;
+ $this->from=$p_from;
+ $this->to=$p_to;
+ }
+ function Header()
+ {
+ parent::Header();
+ $this->SetFont('DejaVu','B',8);
+ $titre=sprintf(_("Balance simple poste %s %s date %s %s"),
+ $this->from_poste,
+ $this->to_poste,
+ $this->from,
+ $this->to);
+ $this->Cell(0,7,$titre,1,0,'C');
+
+ $this->Ln();
+ $this->SetFont('DejaVu','',6);
+
+ $this->Cell(110,7,_('Poste Comptable'),'B');
+ $this->Cell(20,7,_('Débit'),'B',0,'L');
+ $this->Cell(20,7,_('Crédit'),'B',0,'L');
+ $this->Cell(20,7,_('Solde'),'B',0,'L');
+ $this->Cell(20,7,_('D/C'),'B',0,'L');
+ $this->Ln();
+
+ }
+}
diff --git a/include/class/periode.class.php b/include/class/periode.class.php
index c4efd0c2b..322dd120a 100644
--- a/include/class/periode.class.php
+++ b/include/class/periode.class.php
@@ -20,26 +20,26 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* !\file
+/*!\file
* \brief definition of the class periode
*/
-/* !
+/*!
* \brief For the periode tables parm_periode and jrn_periode
*/
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE."/database/parm_periode_sql.class.php";
class Periode
{
- var $cn; /* !< database connection */
- var $jrn_def_id; /* !< the jr, 0 means all the ledger */
- var $p_id; /* !< pk of parm_periode */
- var $status; /* !< status is CL for closed, OP for
+ var $cn; /*!< database connection */
+ var $jrn_def_id; /*!< the jr, 0 means all the ledger */
+ var $p_id; /*!< pk of parm_periode */
+ var $status; /*!< status is CL for closed, OP for
open and CE for centralized */
- var $p_start; /* !< start of the periode */
- var $p_end; /* !< end of the periode */
+ var $p_start; /*!< start of the periode */
+ var $p_end; /*!< end of the periode */
function __construct($p_cn, $p_id=0)
{
@@ -58,7 +58,8 @@ class Periode
$this->p_id=$pp_id;
}
- /* !\brief return the p_id of the start and the end of the exercice
+ /**
+ * \brief return the p_id of the start and the end of the exercice
* into an array
* \param $p_exercice
* \return array [start]=>,[end]=>
@@ -73,7 +74,8 @@ class Periode
return array("start"=>$start, "end"=>$end);
}
- /* !\brief check if a periode is closed. If jrn_def_id is set to a no zero value then check only for this ledger
+ /*!
+ * \brief check if a periode is closed. If jrn_def_id is set to a no zero value then check only for this ledger
* @see Periode::set_ledger
* \return 1 is the periode is closed otherwise return 0
*/
@@ -274,7 +276,7 @@ class Periode
}
}
- /* !\brief load data from database
+ /*!\brief load data from database
* \return 0 on success and -1 on error
*/
@@ -295,7 +297,7 @@ class Periode
return 0;
}
- /* !\brief return the max and the min periode of the exercice given
+ /*!\brief return the max and the min periode of the exercice given
* in parameter
* \param $p_exercice is the exercice
* \return an array of Periode object
@@ -319,7 +321,7 @@ class Periode
return array($rMax, $rMin);
}
- /* !
+ /*!
* \brief Give the start & end date of a periode
* \param $p_periode is the periode id, if omitted the value is the current object
* \return array containing the start date & the end date, index are p_start and p_end or NULL if
@@ -344,7 +346,7 @@ class Periode
return Database::fetch_array($Res, 0);
}
- /* !\brief return the first day of periode
+ /*!\brief return the first day of periode
* the this->p_id must be set
* \return a string with the date (DD.MM.YYYY)
*/
@@ -357,7 +359,7 @@ class Periode
return $p_start;
}
- /* !\brief return the last day of periode
+ /*!\brief return the last day of periode
* the this->p_id must be set
* \return a string with the date (DD.MM.YYYY)
*/
@@ -381,7 +383,7 @@ class Periode
return Database::fetch_result($Res, 0, 0);
}
- /* !\brief retrieve the periode thanks the date_end
+ /*!\brief retrieve the periode thanks the date_end
* \param $p_date format DD.MM.YYYY
* \return the periode id
* \exception if not periode is found or if more than one periode is found
diff --git a/include/class/periode_ledger.class.php b/include/class/periode_ledger.class.php
index f172df57a..6d484136a 100644
--- a/include/class/periode_ledger.class.php
+++ b/include/class/periode_ledger.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/periode_ledger_table.class.php b/include/class/periode_ledger_table.class.php
index 6fbc7450a..d3b9c28b0 100644
--- a/include/class/periode_ledger_table.class.php
+++ b/include/class/periode_ledger_table.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/print_ledger.class.php b/include/class/print_ledger.class.php
index ef43f9ea7..572a04d83 100644
--- a/include/class/print_ledger.class.php
+++ b/include/class/print_ledger.class.php
@@ -23,7 +23,7 @@
*
* @author danydb
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/print_ledger_detail.class.php';
require_once NOALYSS_INCLUDE.'/class/print_ledger_simple.class.php';
require_once NOALYSS_INCLUDE.'/class/print_ledger_simple_without_vat.class.php';
diff --git a/include/class/print_ledger_detail.class.php b/include/class/print_ledger_detail.class.php
index d8c458cd4..2c59ecfb8 100644
--- a/include/class/print_ledger_detail.class.php
+++ b/include/class/print_ledger_detail.class.php
@@ -23,7 +23,7 @@
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
*/
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf_land.class.php';
class Print_Ledger_Detail extends PDF
{
diff --git a/include/class/print_ledger_fin.class.php b/include/class/print_ledger_fin.class.php
index 931da51a2..8eee51b78 100644
--- a/include/class/print_ledger_fin.class.php
+++ b/include/class/print_ledger_fin.class.php
@@ -22,7 +22,7 @@
/*!\file
* \brief print a listing of financial
*/
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Financial extends PDF
{
private $rap_amount; /* amount from begining exercice */
diff --git a/include/class/print_ledger_misc.class.php b/include/class/print_ledger_misc.class.php
index 6773b7417..c5f38ee26 100644
--- a/include/class/print_ledger_misc.class.php
+++ b/include/class/print_ledger_misc.class.php
@@ -22,7 +22,7 @@
/*!\file
* \brief print a listing of financial
*/
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Misc extends PDF
{
function __construct($p_cn,$p_jrn)
diff --git a/include/class/print_ledger_simple.class.php b/include/class/print_ledger_simple.class.php
index 114d5f201..ef21133cf 100644
--- a/include/class/print_ledger_simple.class.php
+++ b/include/class/print_ledger_simple.class.php
@@ -23,7 +23,7 @@
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
*/
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Simple extends PDF
{
diff --git a/include/class/print_ledger_simple_without_vat.class.php b/include/class/print_ledger_simple_without_vat.class.php
index ec77e2381..56653592f 100644
--- a/include/class/print_ledger_simple_without_vat.class.php
+++ b/include/class/print_ledger_simple_without_vat.class.php
@@ -23,7 +23,7 @@
* \brief this class extends PDF and let you export the detailled printing
* of any ledgers
*/
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
class Print_Ledger_Simple_Without_Vat extends PDF
{
diff --git a/include/class/sendmail.class.php b/include/class/sendmail.class.php
new file mode 100644
index 000000000..8c265a9f9
--- /dev/null
+++ b/include/class/sendmail.class.php
@@ -0,0 +1,132 @@
+can_send() == false ) throw new Exception(_('Email non envoyé'),EMAIL_LIMIT);
+
+ if (!mail($this->mailto, $this->subject, $this->content,$this->header))
+ {
+ throw new Exception('send failed');
+ }
+ // Increment email amount
+ $repo =new Database();
+ $date=date('Ymd');
+ $http=new HttpInput();
+ $dossier=$http->request("gDossier","string", -1);
+ $this->increment_mail($repo,$dossier,$date);
+ }
+ /**
+ * Check if email can be sent from a folder
+ * @return boolean
+ */
+ function can_send() {
+ /**
+ * if send from a dossier , then check limit of this dossier
+ * otherwise send true
+ */
+ $http=new HttpInput();
+ $dossier=$http->request("gDossier","string", -1);
+ if ($dossier == -1 ) return true;
+
+ /**
+ * Compare max value in repo
+ */
+ $repo =new Database();
+ $date=date('Ymd');
+ // get max email
+ $max_email = $this->get_max_email($repo,$dossier);
+ //
+ // This folder cannot send email
+ if ($max_email == 0 ) return false;
+ //
+ // This folder has unlimited email
+ if ($max_email == -1 ) return true;
+
+ // get email sent today from account_repository
+ $email_sent = $this->get_email_sent($repo,$dossier , $date);
+ //
+ if ( $email_sent >= $max_email) return false;
+
+ return true;
+ }
+ /**
+ * return max email the folder can send
+ * @param $p_repo Database
+ * @param $p_dossier_id int
+ */
+ function get_max_email(Database $p_repo,$p_dossier_id)
+ {
+ $max_email = $p_repo->get_value("select dos_email from ac_dossier where dos_id=$1",
+ array($p_dossier_id));
+ return $max_email;
+ }
+ /**
+ * Return the amount of send emails for the date (YYYYMMDD)
+ * @param Database $p_repo
+ * @param $p_dossier_id int
+ * @param $p_date string YYYYMMDD
+ */
+ function get_email_sent(Database $p_repo,$p_dossier_id,$p_date)
+ {
+
+ $email_sent = $p_repo->get_value ('select de_sent_email from dossier_sent_email where dos_id = $1 and de_date=$2',
+ array($p_dossier_id,$p_date));
+ return $email_sent;
+
+
+ }
+ /**
+ * Add $p_amount_email to email sent
+ * @param $p_repo Database
+ * @param $p_dossier int id of the folder (dossier.dos_id)
+ * @param $p_date string (YYYYMMDD)
+ */
+ function increment_mail(Database $p_repo,$p_dossier,$p_date)
+ {
+ if ( $p_dossier == -1) return ;
+ $email_sent = $this->get_email_sent($p_repo,$p_dossier,$p_date);
+ if ( $email_sent == 0 ){
+ $p_repo->exec_sql("insert into public.dossier_sent_email(de_sent_email,dos_id,de_date) values($1,$2,$3)",
+ array(1,$p_dossier,$p_date));
+ return;
+ } else {
+ // update + sp_emaoun_email
+ $p_repo->exec_sql("update dossier_sent_email set de_sent_email=de_sent_email+1 where dos_id=$1 and de_date=$2",
+ array($p_dossier,$p_date));
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/include/class/supplier.class.php b/include/class/supplier.class.php
index 51fc47182..0400fa34f 100644
--- a/include/class/supplier.class.php
+++ b/include/class/supplier.class.php
@@ -18,7 +18,7 @@
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_parm_code.class.php';
require_once NOALYSS_INCLUDE.'/class/periode.class.php';
require_once NOALYSS_INCLUDE.'/class/fiche.class.php';
diff --git a/include/class/template_card_category.class.php b/include/class/template_card_category.class.php
index fbd9c05c0..b5b7e439b 100644
--- a/include/class/template_card_category.class.php
+++ b/include/class/template_card_category.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/tva_rate_mtable.class.php b/include/class/tva_rate_mtable.class.php
index 804672f1c..6e21d10e4 100644
--- a/include/class/tva_rate_mtable.class.php
+++ b/include/class/tva_rate_mtable.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/class/user.class.php b/include/class/user.class.php
index 5b066779a..ed0f7164a 100644
--- a/include/class/user.class.php
+++ b/include/class/user.class.php
@@ -1065,7 +1065,7 @@ class User
$Res = $cn->exec_sql("select distinct dos_id,dos_name,dos_description from ac_dossier
where dos_name ~* $1 or dos_description ~* $1 order by dos_name", array($p_filter));
}
- require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+ require_once NOALYSS_INCLUDE.'/class/database.class.php';
$max = Database::num_row($Res);
if ($max == 0)
diff --git a/include/database/acc_plan_sql.class.php b/include/database/acc_plan_sql.class.php
index c4c63e1f3..589f68d89 100644
--- a/include/database/acc_plan_sql.class.php
+++ b/include/database/acc_plan_sql.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/database/fiche_def_ref_sql.class.php b/include/database/fiche_def_ref_sql.class.php
index 5ad8b9939..c952648c4 100644
--- a/include/database/fiche_def_ref_sql.class.php
+++ b/include/database/fiche_def_ref_sql.class.php
@@ -24,7 +24,7 @@
* category of card
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
* @class
diff --git a/include/database/jrn_def_sql.class.php b/include/database/jrn_def_sql.class.php
index 3f77f534b..2a8deed3b 100644
--- a/include/database/jrn_def_sql.class.php
+++ b/include/database/jrn_def_sql.class.php
@@ -28,7 +28,7 @@
@endcode
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
/**
diff --git a/include/database/jrn_periode_sql.class.php b/include/database/jrn_periode_sql.class.php
index eb50639fa..9f440455f 100644
--- a/include/database/jrn_periode_sql.class.php
+++ b/include/database/jrn_periode_sql.class.php
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
diff --git a/include/database/menu_ref_sql.class.php b/include/database/menu_ref_sql.class.php
index f0eb8d673..5fa6982f5 100644
--- a/include/database/menu_ref_sql.class.php
+++ b/include/database/menu_ref_sql.class.php
@@ -25,7 +25,7 @@
*
*
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
diff --git a/include/database/parm_periode_sql.class.php b/include/database/parm_periode_sql.class.php
index 2cbd0806b..18991e97a 100644
--- a/include/database/parm_periode_sql.class.php
+++ b/include/database/parm_periode_sql.class.php
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/**
diff --git a/include/database/poste_analytique_sql.class.php b/include/database/poste_analytique_sql.class.php
index af1184f39..a99b8a250 100644
--- a/include/database/poste_analytique_sql.class.php
+++ b/include/database/poste_analytique_sql.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@@ -28,7 +28,7 @@
*
* @class
* @brief abstract of the table public.poste_analytique */
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
diff --git a/include/database/profile_menu_sql.class.php b/include/database/profile_menu_sql.class.php
index a5979c8bb..6189fb91d 100644
--- a/include/database/profile_menu_sql.class.php
+++ b/include/database/profile_menu_sql.class.php
@@ -28,7 +28,7 @@
@endcode
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
diff --git a/include/database/profile_sql.class.php b/include/database/profile_sql.class.php
index adbd7bf1d..33ecc49aa 100644
--- a/include/database/profile_sql.class.php
+++ b/include/database/profile_sql.class.php
@@ -28,7 +28,7 @@
@endcode
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
diff --git a/include/database/tag_sql.class.php b/include/database/tag_sql.class.php
index f66e9bcec..13698f156 100644
--- a/include/database/tag_sql.class.php
+++ b/include/database/tag_sql.class.php
@@ -1,5 +1,5 @@
setTitle("Rapport ".$Libelle,true);
// Step ??
//--
-$p_step=$http->get('p_step',"string",0);
+$step=$http->get('p_step',"string",0);
if ( $step == 0 )
{
// No step asked
diff --git a/include/export/export_gl_csv.php b/include/export/export_gl_csv.php
index 6a10e1e90..a908c9a97 100644
--- a/include/export/export_gl_csv.php
+++ b/include/export/export_gl_csv.php
@@ -41,7 +41,7 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
include_once NOALYSS_INCLUDE.'/class/acc_account_ledger.class.php';
include_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
include_once NOALYSS_INCLUDE.'/lib/impress.class.php';
require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
diff --git a/include/export/export_gl_pdf.php b/include/export/export_gl_pdf.php
index 72ae7b593..eda3328e3 100644
--- a/include/export/export_gl_pdf.php
+++ b/include/export/export_gl_pdf.php
@@ -25,12 +25,12 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
include_once('class/acc_account_ledger.class.php');
include_once('lib/ac_common.php');
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
include_once('lib/impress.class.php');
require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
$http=new HttpInput();
$from_periode = $http->get("from_periode","date");
diff --git a/include/export/export_ledger_csv.php b/include/export/export_ledger_csv.php
index 4ab879947..cfec3f736 100644
--- a/include/export/export_ledger_csv.php
+++ b/include/export/export_ledger_csv.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* !
+/*!
* \file
* \brief Send a ledger in CSV format , receives
* - jrn_id id of the ledger
@@ -36,7 +36,7 @@ require_once NOALYSS_INCLUDE.'/class/print_ledger.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
$gDossier=dossier::id();
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
diff --git a/include/export/export_ledger_pdf.php b/include/export/export_ledger_pdf.php
index cab3413e1..9f30e8d93 100644
--- a/include/export/export_ledger_pdf.php
+++ b/include/export/export_ledger_pdf.php
@@ -28,10 +28,10 @@ if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
$gDossier = dossier::id();
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/impress.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php';
diff --git a/include/export/export_poste_detail_csv.php b/include/export/export_poste_detail_csv.php
index 6250a00ca..0eba67fec 100644
--- a/include/export/export_poste_detail_csv.php
+++ b/include/export/export_poste_detail_csv.php
@@ -22,7 +22,7 @@
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_account_ledger.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
diff --git a/include/export/export_poste_detail_pdf.php b/include/export/export_poste_detail_pdf.php
index 31207b794..f755dab26 100644
--- a/include/export/export_poste_detail_pdf.php
+++ b/include/export/export_poste_detail_pdf.php
@@ -25,13 +25,13 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/acc_account_ledger.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/impress.class.php';
require_once NOALYSS_INCLUDE.'/header_print.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_operation.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
$http=new HttpInput();
diff --git a/include/export/export_rec_csv.php b/include/export/export_rec_csv.php
index da23ecb1c..f20c7c2e6 100644
--- a/include/export/export_rec_csv.php
+++ b/include/export/export_rec_csv.php
@@ -11,7 +11,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/acc_reconciliation.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/lib/noalyss_csv.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
diff --git a/include/export/export_receipt.php b/include/export/export_receipt.php
index 7388cdf68..48e0b4aa3 100644
--- a/include/export/export_receipt.php
+++ b/include/export/export_receipt.php
@@ -25,7 +25,7 @@ if ( ! defined ('ALLOWED')) die (_('Non autorisé'));
include_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
$http=new HttpInput();
diff --git a/include/export/export_reportinit_csv.php b/include/export/export_reportinit_csv.php
index 378cabed3..8ec7951ff 100644
--- a/include/export/export_reportinit_csv.php
+++ b/include/export/export_reportinit_csv.php
@@ -25,7 +25,7 @@
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/constant.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/user_common.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_report.class.php';
diff --git a/include/export/export_security_pdf.php b/include/export/export_security_pdf.php
index ef05943da..9f461c66c 100755
--- a/include/export/export_security_pdf.php
+++ b/include/export/export_security_pdf.php
@@ -25,8 +25,8 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
$gDossier=dossier::id();
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
-require_once NOALYSS_INCLUDE.'/lib/pdf.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/pdf.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
$http=new HttpInput();
diff --git a/include/ext/dummy/dummy.php b/include/ext/dummy/dummy.php
index fc24258b1..549131388 100755
--- a/include/ext/dummy/dummy.php
+++ b/include/ext/dummy/dummy.php
@@ -1,7 +1,7 @@
make_array("select fr_id,fr_label
from formdef
order by fr_label");
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index 86d40f44f..6f85a2f7b 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -25,7 +25,7 @@
* @brief common utilities for a lot of procedure, classe
*/
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/periode.class.php';
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
diff --git a/include/lib/database.class.php b/include/lib/database.class.php
deleted file mode 100644
index 993d7f81f..000000000
--- a/include/lib/database.class.php
+++ /dev/null
@@ -1,1183 +0,0 @@
-10)
- die("-->Dossier invalide [$p_database_id]");
- $noalyss_user=(defined("noalyss_user"))?noalyss_user:phpcompta_user;
- $password=(defined("noalyss_password"))?noalyss_password:phpcompta_password;
- $port=(defined("noalyss_psql_port"))?noalyss_psql_port:phpcompta_psql_port;
- $host=(!defined("noalyss_psql_host") )?'127.0.0.1':noalyss_psql_host;
- if (defined("MULTI")&&MULTI=="0")
- {
- $l_dossier=dbname;
- }
- else
- {
-
- if ($p_database_id==0)
- { /* connect to the repository */
- $l_dossier=sprintf("%saccount_repository", strtolower(domaine));
- }
- else if ($p_type=='dos')
- { /* connect to a folder (dossier) */
- $l_dossier=sprintf("%sdossier%d", strtolower(domaine), $p_database_id);
- }
- else if ($p_type=='mod')
- { /* connect to a template (modele) */
- $l_dossier=sprintf("%smod%d", strtolower(domaine), $p_database_id);
- }
- else if ($p_type=='template')
- {
- $l_dossier='template1';
- }
- else
- {
- throw new Exception('Connection invalide');
- }
- }
-
- ob_start();
- $a=pg_connect("dbname=$l_dossier host='$host' user='$noalyss_user'
- password='$password' port=$port");
-
- if ($a==false)
- {
- if (DEBUG)
- {
- ob_end_clean();
- echo '
';
-
- die("Connection impossible : vérifiez vos paramètres de base
- de données");
- }
- else
- {
- echo '
Erreur de connexion !
';
- $this->is_open=false;
- return;
- }
- }
- $this->db=$a;
- $this->is_open=TRUE;
- if ($this->exist_schema('comptaproc')){
- pg_exec($this->db, 'set search_path to public,comptaproc,pg_catalog;');
- }
- pg_exec($this->db, 'set DateStyle to ISO, MDY;');
- ob_end_clean();
- }
- /**
- * Connect to a database return an connx to db or false if it fails
- *
- * @param string $p_user Username
- * @param type $p_password User's password
- * @param $p_dbname name of the database to connect
- * @param type $p_host Host of DB
- * @param type $p_port Port of DB
- */
- static function connect($p_user,$p_password,$p_dbname,$p_host,$p_port) {
- $a=pg_connect("dbname=$p_dbname host='$p_host' user='$p_user'
- password='$p_password' port=$p_port");
- return $a;
- }
- public function verify()
- {
- // Verify that the elt we want to add is correct
- }
-
- function set_encoding($p_charset)
- {
- pg_set_client_encoding($this->db, $p_charset);
- }
- function get_encoding()
- {
- return pg_client_encoding($this->db);
- }
-
-
- /**
- * \brief send a sql string to the database
- * \param $p_string sql string
- * \param $p_array array for the SQL string (see pg_query_params)
- * \return the result of the query, a resource or false if an
- * error occured
- */
-
- function exec_sql($p_string, $p_array=null)
- {
- try
- {
- if ( ! $this->is_open ) throw new Exception(' Database is closed');
- $this->sql=$p_string;
- $this->array=$p_array;
-
- if ($p_array==null)
- {
- if (!DEBUG)
- $this->ret=pg_query($this->db, $p_string);
- else
- $this->ret=@pg_query($this->db, $p_string);
- }
- else
- {
- $a=is_array($p_array);
- if (!is_array($p_array))
- {
- throw new Exception("Erreur : exec_sql attend un array");
- }
- if (!DEBUG)
- $this->ret=pg_query_params($this->db, $p_string, $p_array);
- else
- $this->ret=@pg_query_params($this->db, $p_string, $p_array);
- }
- if (!$this->ret)
- {
- $str_error=pg_last_error($this->db).pg_result_error($this->ret);
- throw new Exception(" SQL ERROR $p_string ".$str_error, 1);
- }
- }
- catch (Exception $a)
- {
- if (DEBUG)
- {
- print_r($p_string);
- print_r($p_array);
- echo $a->getMessage();
- echo $a->getTraceAsString();
- echo pg_last_error($this->db);
- }
- record_log($a->getTraceAsString());
- $this->rollback();
-
- throw ($a);
- }
-
- return $this->ret;
- }
-
- /**
- * \brief Count the number of row returned by a sql statement
- *
- * \param $p_sql sql string
- * \param $p_array if not null we use the safer pg_query_params
- */
-
- function count_sql($p_sql, $p_array=null)
- {
- $r_sql=$this->exec_sql($p_sql, $p_array);
- return pg_NumRows($r_sql);
- }
-
- /**
- * \brief get the current sequence value
- */
-
- function get_current_seq($p_seq)
- {
- $Res=$this->get_value("select currval('$p_seq') as seq");
- return $Res;
- }
-
- /**
- * \brief get the next sequence value
- */
-
- function get_next_seq($p_seq)
- {
- $Res=$this->exec_sql("select nextval('$p_seq') as seq");
- $seq=pg_fetch_array($Res, 0);
- return $seq['seq'];
- }
-
- /**
- * @brief : start a transaction
- *
- */
- function start()
- {
- $Res=$this->exec_sql("start transaction");
- }
-
- /**
- * Commit the transaction
- *
- */
- function commit()
- {
- if ( ! $this->is_open) return;
- $Res=$this->exec_sql("commit");
- }
-
- /**
- * rollback the current transaction
- */
- function rollback()
- {
- if ( ! $this->is_open) return;
- $Res=$this->exec_sql("rollback");
- }
-
- /**
- * @brief alter the sequence value
- * @param $p_name name of the sequence
- * @param $min the start value of the sequence
- */
- function alter_seq($p_name, $min)
- {
- if ($min<1)
- $min=1;
- $Res=$this->exec_sql("alter sequence $p_name restart $min");
- }
-
- /**
- * \brief Execute a sql script
- * \param $script script name
- */
-
- function execute_script($script)
- {
-
- if (!DEBUG)
- {
- ob_start();
- } else {
- $debug=fopen("/tmp/debug.log","w+");
- }
- $hf=fopen($script, 'r');
- if ($hf==false)
- {
- throw new Exception ( 'Ne peut ouvrir '.$script);
- }
- $sql="";
- $flag_function=false;
- while (!feof($hf))
- {
- $buffer=fgets($hf);
- $buffer=str_replace('$BODY$', '$_$', $buffer);
- print $buffer." ";
- // comment are not execute
- if (substr($buffer, 0, 2)=="--")
- {
- //echo "comment $buffer";
- continue;
- }
- // Blank Lines Are Skipped
- If (Strlen($buffer)==0)
- {
- //echo "Blank $buffer";
- Continue;
- }
- if (strpos(strtolower($buffer), "create function")===0)
- {
- echo "found a function";
- $flag_function=true;
- $sql=$buffer;
- continue;
- }
- if (strpos(strtolower($buffer), "create or replace function")===0)
- {
- echo "found a function";
- $flag_function=true;
- $sql=$buffer;
- continue;
- }
- // No semi colon -> multiline command
- if ($flag_function==false&&strpos($buffer, ';')==false)
- {
- $sql.=$buffer;
- continue;
- }
- if ($flag_function)
- {
- if ( strpos(strtolower($buffer), "$$;")===false &&
- strpos(strtolower($buffer), '$_$;')===false &&
- strpos(strtolower($buffer), '$function$;')===false &&
- strpos(strtolower($buffer), 'language plpgsql;')===false &&
- strpos(strtolower($buffer), 'language plpgsql ;')===false
- )
- {
- $sql.=$buffer;
- continue;
- }
- }
- else
- {
- // cut the semi colon
- $buffer=str_replace(';', '', $buffer);
- }
- $sql.=$buffer;
- if ( DEBUG ) fwrite($debug, $sql);
- if ($this->exec_sql($sql)==false)
- {
-
- $this->rollback();
- if (!DEBUG)
- ob_end_clean();
- print "ERROR : $sql";
- throw new Exception("ERROR : $sql");
- }
- $sql="";
- $flag_function=false;
- print "";
- } // while (feof)
- fclose($hf);
- if (!DEBUG)
- ob_end_clean();
- }
-
- /**
- * \brief Get version of a database, the content of the
- * table version
- *
- * \return version number
- *
- */
-
- function get_version()
- {
- $Res=$this->get_value("select max(val) from version");
- return $Res;
- }
-
- /**
- * @brief fetch the $p_indice array from the last query
- * @param $p_indice index
- *
- */
- function fetch($p_indice)
- {
- if ($this->ret==false)
- throw new Exception('this->ret is empty');
- return pg_fetch_array($this->ret, $p_indice);
- }
-
- /**
- *
- * @brief return the number of rows found by the last query, or the number
- * of rows from $p_ret
- * @param $p_ret is the result of a query, the default value is null, in that case
- * it is related to the last query
- * @note synomym for count()
- */
-
- function size($p_ret=null)
- {
- if ($p_ret==null)
- return pg_NumRows($this->ret);
- else
- return pg_NumRows($p_ret);
- }
-
- /**
- * @brief synomym for size()
- */
-
- function count($p_ret=null)
- {
- return $this->size($p_ret);
- }
-
- /**
- * \brief loop to apply all the path to a folder or
- * a template
- * \param $p_name database name
- *
- */
-
- function apply_patch($p_name)
- {
- if ( ! $this->exist_table('version')) {
- echo _('Base de donnée vide');
- return;
- }
- $MaxVersion=DBVERSION-1;
- $succeed="✓";
- echo '
';
- for ($i=4; $i<=$MaxVersion; $i++)
- {
- $to=$i+1;
-
- if ($this->get_version()<=$i)
- {
- if ($this->get_version()==97)
- {
- if ($this->exist_schema("amortissement"))
- {
- $this->exec_sql('ALTER TABLE amortissement.amortissement_histo
- ADD CONSTRAINT internal_fk FOREIGN KEY (jr_internal) REFERENCES jrn (jr_internal)
- ON UPDATE CASCADE ON DELETE SET NULL');
- }
- }
- echo "
Patching ".$p_name.
- " from the version ".$this->get_version()." to $to ";
-
- $this->execute_script (NOALYSS_INCLUDE.'/sql/patch/upgrade'.$i.'.sql');
- echo $succeed;
-
- if (!DEBUG)
- ob_start();
- // specific for version 4
- if ($i==4)
- {
- $sql="select jrn_def_id from jrn_def ";
- $Res=$this->exec_sql($sql);
- $Max=$this->size();
- for ($seq=0; $seq<$Max; $seq++)
- {
- $row=pg_fetch_array($Res, $seq);
- $sql=sprintf("create sequence s_jrn_%d", $row['jrn_def_id']);
- $this->exec_sql($sql);
- }
- }
- // specific to version 7
- if ($i==7)
- {
- // now we use sequence instead of computing a max
- //
- $Res2=$this->exec_sql('select coalesce(max(jr_grpt_id),1) as l from jrn');
- $Max2=pg_NumRows($Res2);
- if ($Max2==1)
- {
- $Row=pg_fetch_array($Res2, 0);
- var_dump($Row);
- $M=$Row['l'];
- $this->exec_sql("select setval('s_grpt',$M,true)");
- }
- }
- // specific to version 17
- if ($i==17)
- {
- $this->execute_script(NOALYSS_INCLUDE.'/sql/patch/upgrade17.sql');
- $max=$this->get_value('select last_value from s_jnt_fic_att_value');
- $this->alter_seq($p_cn, 's_jnt_fic_att_value', $max+1);
- } // version
- // reset sequence in the modele
- //--
- if ($i==30&&$p_name=="mod")
- {
- $a_seq=array('s_jrn', 's_jrn_op', 's_centralized',
- 's_stock_goods', 'c_order', 's_central');
- foreach ($a_seq as $seq)
- {
- $sql=sprintf("select setval('%s',1,false)", $seq);
- $Res=$this->exec_sql($sql);
- }
- $sql="select jrn_def_id from jrn_def ";
- $Res=$this->exec_sql($sql);
- $Max=pg_NumRows($Res);
- for ($seq=0; $seq<$Max; $seq++)
- {
- $row=pg_fetch_array($Res, $seq);
- $sql=sprintf("select setval('s_jrn_%d',1,false)", $row['jrn_def_id']);
- $this->exec_sql($sql);
- }
- }
- if ($i==36)
- {
- /* check the country and apply the path */
- $res=$this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
- $country=pg_fetch_result($res, 0, 0);
- $this->execute_script(NOALYSS_INCLUDE."/sql/patch/upgrade36.".$country.".sql");
- $this->exec_sql('update tmp_pcmn set pcm_type=find_pcm_type(pcm_val)');
- }
- if ($i==59)
- {
- $res=$this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
- $country=pg_fetch_result($res, 0, 0);
- if ($country=='BE')
- $this->exec_sql("insert into parm_code values ('SUPPLIER',440,'Poste par défaut pour les fournisseurs')");
- if ($country=='FR')
- $this->exec_sql("insert into parm_code values ('SUPPLIER',400,'Poste par défaut pour les fournisseurs')");
- }
- if ($i==61)
- {
- $country=$this->get_value("select pr_value from parameter where pr_id='MY_COUNTRY'");
- $this->execute_script(NOALYSS_INCLUDE."/sql/patch/upgrade61.".$country.".sql");
- }
-
- if (!DEBUG)
- ob_end_clean();
- }
- }
- echo '
';
- }
-
- /**
- *
- * \brief return the value of the sql, the sql will return only one value
- * with the value
- * \param $p_sql the sql stmt example :select s_value from
- document_state where s_id=2
- * \param $p_array if array is not null we use the ExecSqlParm (safer)
- * \see exec_sql
- * \note print a warning if several value are found, if only the first value is needed
- * consider using a LIMIT clause
- * \return only the first value or an empty string if nothing is found
- */
-
- function get_value($p_sql, $p_array=null)
- {
- try {
- $this->ret=$this->exec_sql($p_sql, $p_array);
- $r=pg_NumRows($this->ret);
- if ($r==0)
- return "";
- if ($r>1)
- {
- $array=pg_fetch_all($this->ret);
- throw new Exception("Attention $p_sql retourne ".pg_NumRows($this->ret)." valeurs ".
- var_export($p_array, true)." values=".var_export($array, true));
- }
- $r=pg_fetch_row($this->ret, 0);
- return $r[0];
-
- } catch (Exception $ex) {
- throw($ex);
- }
- }
- /**
- * @brief return the number of rows affected by the previous query
- */
- function get_affected()
- {
- return Database::num_row($this->ret);
- }
-
- /**
- * \brief purpose return the result of a sql statment
- * in a array
- * \param $p_sql sql query
- * \param $p_array if not null we use ExecSqlParam
- * \return false if nothing is found
- */
-
- function get_array($p_sql, $p_array=null)
- {
- $r=$this->exec_sql($p_sql, $p_array);
-
- if (pg_NumRows($r)==0)
- return array();
- $array=pg_fetch_all($r);
- return $array;
- }
- /**
- * Returns only one row from a query
- * @param string $p_sql
- * @param array $p_array
- * @return array , idx = column of the table or null if nothing is found
- * @throws Exception if too many rows are found code 100
- */
- function get_row($p_sql,$p_array=NULL) {
- $array=$this->get_array($p_sql,$p_array);
- if (empty($array) ) return null;
- if (count($array)==1) return $array[0];
- throw new Exception("Database:get_row retourne trop de lignes",100);
- }
- /**
- * @brief Create a sequence
- * @param string $p_name Sequence Name
- * @param int $min starting value
- */
- function create_sequence($p_name, $min=1)
- {
- if ($min<1)
- $min=1;
- $sql="create sequence ".$p_name." minvalue $min";
- $this->exec_sql($sql);
- }
-
- /**
- * \brief test if a sequence exist */
- /* \return true if the seq. exist otherwise false
- */
-
- function exist_sequence($p_name)
- {
- $r=$this->count_sql("select relname from pg_class where relname=lower($1)", array($p_name));
- if ($r==0)
- return false;
- return true;
- }
-
- /**
- * \brief test if a table exist
- * \param $p_name table name
- * \param $schema name of the schema default public
- * \return true if a table exist otherwise false
- */
-
- function exist_table($p_name, $p_schema='public')
- {
- $r=$this->count_sql("select table_name from information_schema.tables where table_schema=$1 and table_name=lower($2)", array($p_schema, $p_name));
- if ($r==0)
- return false;
- return true;
- }
-
- /**
- * Check if a column exists in a table
- * @param $col : column name
- * @param $table :table name
- * @param $schema :schema name, default public
- * @return true or false
- */
- function exist_column($col, $table, $schema)
- {
- $r=$this->get_value('select count(*) from information_schema.columns where table_name=lower($1) and column_name=lower($2) and table_schema=lower($3)', array($col, $table, $schema));
- if ($r>0)
- return true;
- return false;
- }
-
- /**
- * return the name of the database with the domain name
- * @param $p_id of the folder WITHOUT the domain name
- * @param $p_type dos for folder mod for template
- * @return formatted name
- */
- function format_name($p_id, $p_type)
- {
- switch ($p_type)
- {
- case 'dos':
- $sys_name=sprintf("%sdossier%d", strtolower(domaine), $p_id);
- break;
- case 'mod':
- $sys_name=sprintf("%smod%d", strtolower(domaine), $p_id);
- break;
- default:
- echo_error(__FILE__." format_name invalid type ".$p_type, __LINE__);
- throw new Exception(__FILE__." format_name invalid type ".$p_type. __LINE__);
- }
- return $sys_name;
- }
-
- /**
- * Count the database name in a system view
- * @param $p_name string database name
- * @return number of database found (normally 0 or 1)
- */
- function exist_database($p_name)
- {
- $database_exist=$this->get_value('select count(*)
- from pg_catalog.pg_database where datname = lower($1)', array($p_name));
- return $database_exist;
- }
-
- /**
- * @brief check if the large object exists
- * @param $p_oid of the large object
- * @return return true if the large obj exist or false if not
- */
- function exist_blob($p_oid)
- {
- $r=$this->get_value('select count(*) from pg_largeobject_metadata where oid=$1'
- , array($p_oid));
- if ($r>0)
- return true;
- else
- return false;
- }
-
- /*
- * !\brief test if a view exist
- * \return true if the view. exist otherwise false
- */
-
- function exist_view($p_name)
- {
- $r=$this->count_sql("select viewname from pg_views where viewname=lower($1)", array($p_name));
- if ($r==0)
- return false;
- return true;
- }
-
- /*
- * !\brief test if a schema exists
- * \return true if the schemas exists otherwise false
- */
-
- function exist_schema($p_name)
- {
- $r=$this->count_sql("select nspname from pg_namespace where nspname=lower($1)", array($p_name));
- if ($r==0)
- return false;
- return true;
- }
-
- /**
- * \brief create a string containing the value separated by comma
- * for use in a SQL in statement
- * \return the string or empty if nothing is found
- * \see fid_card.php
- */
-
- function make_list($sql, $p_array=null)
- {
- if ($p_array==null)
- {
- $aArray=$this->get_array($sql);
- }
- else
- {
- $aArray=$this->get_array($sql, $p_array);
- }
- if (empty($aArray))
- return "";
- $aIdx=array_keys($aArray[0]);
- $idx=$aIdx[0];
- $ret="";
- $f="";
- for ($i=0; $i Array
- (
- [value] => 1
- [label] => Marchandise A
- )
-
- [1] => Array
- (
- [value] => 2
- [label] => Marchandise B
- )
-
- [2] => Array
- (
- [value] => 3
- [label] => Marchandise C
- )
- )
- \endverbatim
- * \see ISelect
- */
-
- function make_array($p_sql, $p_null=0,$p_array=null)
- {
- $a=$this->exec_sql($p_sql,$p_array);
- $max=pg_NumRows($a);
- if ($max==0&&$p_null==0)
- return null;
- for ($i=0; $i<$max; $i++)
- {
- $row=pg_fetch_row($a);
- $r[$i]['value']=$row[0];
- $r[$i]['label']=h($row[1]);
- }
- // add a blank item ?
- if ($p_null==1)
- {
- for ($i=$max; $i!=0; $i--)
- {
- $r[$i]['value']=$r[$i-1]['value'];
- $r[$i]['label']=h($r[$i-1]['label']);
- }
- $r[0]['value']=-1;
- $r[0]['label']=" ";
- } // if ( $p_null == 1 )
-
- return $r;
- }
- /***
- * \brief Save a "piece justificative" , the name must be pj
- *
- * \param $seq jr_grpt_id
- * \return $oid of the lob file if success
- * null if a error occurs
- *
- */
- function save_receipt($seq)
- {
- $oid=$this->upload('pj');
- if ($oid==false)
- {
- return false;
- }
- // Remove old document
- $ret=$this->exec_sql("select jr_pj from jrn where jr_grpt_id=$seq");
- if (pg_num_rows($ret)!=0)
- {
- $r=pg_fetch_array($ret, 0);
- $old_oid=$r['jr_pj'];
- if (strlen($old_oid)!=0)
- pg_lo_unlink($cn, $old_oid);
- }
- // Load new document
- $this->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2,
- jr_pj_type=$3 where jr_grpt_id=$4",
- array($oid,$_FILES['pj']['name'] ,$_FILES['pj']['type'],$seq));
- return $oid;
- }
- /***
- * \brief Save a document into the database , it just puts the file in the database
- * and returns the corresponding OID , the mimetype , size ... of the document
- * must be set in the calling function.
- *
- * \param name of the variable in $_FILES
- * \return $oid of the lob file if success
- * false if a error occurs or if there is no file to upload
- *
- */
-
- function upload($p_name)
- {
- /* there is no file to upload */
- if ($_FILES[$p_name]["error"]==UPLOAD_ERR_NO_FILE)
- {
- return false;
- }
-
- $new_name=tempnam($_ENV['TMP'], $p_name);
- if ($_FILES[$p_name]["error"]>0)
- {
- print_r($_FILES);
- echo_error(__FILE__.":".__LINE__."Error: ".$_FILES[$p_name]["error"]);
- return false;
- }
- if (strlen($_FILES[$p_name]['tmp_name'])!=0)
- {
- if (move_uploaded_file($_FILES[$p_name]['tmp_name'], $new_name))
- {
- // echo "Image saved";
- $oid=pg_lo_import($this->db, $new_name);
- if ($oid==false)
- {
- echo_error(__FILE__, __LINE__, "cannot upload document");
- $this->rollback();
- return false;
- }
- return $oid;
- }
- else
- {
- echo "
Error
";
- $this->rollback();
- return false;
- }
- }
- return false;
- }
-
- /**\brief wrapper for the function pg_NumRows
- * \param $ret is the result of a exec_sql
- * \return number of line affected
- */
-
- static function num_row($ret)
- {
- return pg_NumRows($ret);
- }
-
- /**\brief wrapper for the function pg_fetch_array
- * \param $ret is the result of a pg_exec
- * \param $p_indice is the index
- * \return $array of column
- */
-
- static function fetch_array($ret, $p_indice=0)
- {
- return pg_fetch_array($ret, $p_indice);
- }
-
- /**\brief wrapper for the function pg_fetch_all
- * \param $ret is the result of pg_exec (exec_sql)
- * \return double array (row x col )
- */
-
- static function fetch_all($ret)
- {
- return pg_fetch_all($ret);
- }
-
- /**\brief wrapper for the function pg_fetch_all
- * \param $ret is the result of pg_exec (exec_sql)
- * \param $p_row is the indice of the row
- * \param $p_col is the indice of the col
- * \return a string or an integer
- */
-
- static function fetch_result($ret, $p_row=0, $p_col=0)
- {
- return pg_fetch_result($ret, $p_row, $p_col);
- }
-
- /**
- * \brief wrapper for the function pg_fetch_row
- * \param $ret is the result of pg_exec (exec_sql)
- * \param $p_row is the indice of the row
- * \return an array indexed from 0
- */
- static function fetch_row($ret, $p_row)
- {
- return pg_fetch_row($ret, $p_row);
- }
-
- /**\brief wrapper for the function pg_lo_unlink
- * \param $p_oid is the of oid
- * \return return the result of the operation
- */
-
- function lo_unlink($p_oid)
- {
- if ( ! $this->exist_blob($p_oid)) return;
- return pg_lo_unlink($this->db, $p_oid);
- }
-
- /**\brief wrapper for the function pg_prepare
- * \param $p_string string name for pg_prepare function
- * \param $p_sql is the sql to prepare
- * \return return the result of the operation
- */
-
- function prepare($p_string, $p_sql)
- {
- return pg_prepare($this->db, $p_string, $p_sql);
- }
-
- /**
- * \brief wrapper for the function pg_execute
- * \param $p_string string name of the stmt given in pg_prepare function
- * \param $p_array contains the variables
- * \note set this->ret to the return of pg_execute
- * \return return the result of the operation,
- */
-
- function execute($p_string, $p_array)
- {
- $this->ret=pg_execute($this->db, $p_string, $p_array);
- return $this->ret;
- }
-
- /**
- * \brief wrapper for the function pg_lo_export
- * \param $p_oid is the oid of the log
- * \param $tmp is the file
- * \return result of the operation
- */
-
- function lo_export($p_oid, $tmp)
- {
- return pg_lo_export($this->db, $p_oid, $tmp);
- }
-
- /**\brief wrapper for the function pg_lo_export
- * \param $p_oid is the filename
- * \param $tmp is the file
- * \return result of the operation
- */
-
- function lo_import($p_oid)
- {
- return pg_lo_import($this->db, $p_oid);
- }
-
- /**\brief wrapper for the function pg_escape_string
- * \param $p_string is the string to escape
- * \return escaped string
- */
-
- static function escape_string($p_string)
- {
- return pg_escape_string($p_string);
- }
-
- /**\brief wrapper for the function pg_close
- */
-
- function close()
- {
- if ( $this->is_open ) pg_close($this->db);
- $this->is_open=FALSE;
- }
-
- /**\brief
- * \param
- * \return
- * \note
- * \see
- */
-
- function __toString()
- {
- return "database ";
- }
-
- static function test_me()
- {
-
- }
-
- function status()
- {
- return pg_transaction_status($this->db);
- }
-
- /**
- * with the handle of a successull query, echo each row into CSV and
- * send it directly
- * @param type $ret handle to a query
- * @param type $aheader double array, each item of the array contains
- * a key type (num) and a key title
- */
- function query_to_csv($ret, $aheader)
- {
- $csv=new Noalyss_Csv("db-query");
- $a_header=[];
- for ($i=0; $iwrite_header($a_header);
-
- // fetch all the rows
- for ($i=0; $iadd($row[$e],"number");
- break;
- default:
- $csv->add($row[$e]);
- }
- }
- $csv->write();
- }
- }
- /**
- * @brief Find all lob and remove those which are not used by any tables
- *
- */
- function clean_orphan_lob()
- {
- // find all columns of type lob
- $sql ="
- select table_schema,table_name,column_name
- from
- information_schema.columns
- where table_schema not in ('information_schema','pg_catalog')
- and data_type='oid'";
- $all_lob= "
- select oid,'N' as used from pg_largeobject_metadata
- ";
- $a_table= $this->get_array($sql);
- $a_lob = $this->get_array($all_lob);
- if ( $a_table == false || $a_lob == false ) return;
- // for each lob
- $nb_lob=count($a_lob);
- $nb_table=count($a_table);
- for ($i=0;$i < $nb_lob;$i++)
- {
- $lob=$a_lob[$i]['oid'];
- if ( $a_lob[$i]['used']=='Y') continue;
- for ($j=0;$j < $nb_table;$j++)
- {
- if ( $a_lob[$i]['used']=='Y') continue;
- $check = $this->get_value(" select count(*) from ".
- $a_table[$j]['table_schema'].".".$a_table[$j]['table_name'].
- " where ".
- $a_table[$j]['column_name']."=$1",array($lob));
- if ( $check != 0 )
- $a_lob[$i]['used']='Y';
-
- }
- }
- for ($i=0;$i < $nb_lob;$i++)
- {
- if ( $a_lob[$i]['used']=='Y') continue;
- $this->lo_unlink($a_lob[$i]['oid']);
- }
- }
- /**
- * Check if a prepared statement already exists or not
- * @param string $query_name name of the prepared query
- * @return boolean false is not yet prepared
- */
- function is_prepare($query_name)
- {
- $nb_prepared=$this->get_value("select count(*) from pg_prepared_statements where name=$1",[$query_name]);
- if ( $nb_prepared==0)return FALSE;
- return TRUE;
- }
-
-}
-
-/* test::test_me(); */
diff --git a/include/lib/database_core.class.php b/include/lib/database_core.class.php
new file mode 100644
index 000000000..ff42ea6bd
--- /dev/null
+++ b/include/lib/database_core.class.php
@@ -0,0 +1,951 @@
+db = pg_connect("dbname=$p_dbname host='$p_host' user='$p_user'
+ password='$p_password' port=$p_port");
+ if ($this->db == false) {
+ if (DEBUG) {
+
+ echo '
';
+ $this->is_open = false;
+ throw new Exception(_('Erreur Connexion'));
+ }
+ }
+
+ $this->is_open = TRUE;
+
+ }
+
+ public function verify()
+ {
+ // Verify that the elt we want to add is correct
+ }
+
+ function set_encoding($p_charset)
+ {
+ pg_set_client_encoding($this->db, $p_charset);
+ }
+
+ function get_encoding()
+ {
+ return pg_client_encoding($this->db);
+ }
+
+
+ /**
+ * @return mixed
+ */
+ public function get_db()
+ {
+ return $this->db;
+ }
+
+ /**
+ * @param mixed $db
+ */
+ public function set_db($db)
+ {
+ $this->db = $db;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function get_ret()
+ {
+ return $this->ret;
+ }
+
+ /**
+ * @param mixed $ret
+ */
+ public function set_ret($ret)
+ {
+ $this->ret = $ret;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function get_is_open()
+ {
+ return $this->is_open;
+ }
+
+ /**
+ * @param mixed $is_open
+ */
+ public function set_is_open($is_open)
+ {
+ $this->is_open = $is_open;
+ }
+
+ /**
+ * \brief send a sql string to the database
+ * \param $p_string sql string
+ * \param $p_array array for the SQL string (see pg_query_params)
+ * \return the result of the query, a resource or false if an
+ * error occured
+ */
+
+ function exec_sql($p_string, $p_array = null)
+ {
+ try {
+ if (!$this->is_open) throw new Exception(' Database is closed');
+ $this->sql = $p_string;
+ $this->array = $p_array;
+
+ if ($p_array == null) {
+ if (!DEBUG)
+ $this->ret = pg_query($this->db, $p_string);
+ else
+ $this->ret = @pg_query($this->db, $p_string);
+ } else {
+ $a = is_array($p_array);
+ if (!is_array($p_array)) {
+ throw new Exception("Erreur : exec_sql attend un array");
+ }
+ if (!DEBUG)
+ $this->ret = pg_query_params($this->db, $p_string, $p_array);
+ else
+ $this->ret = @pg_query_params($this->db, $p_string, $p_array);
+ }
+ if (!$this->ret) {
+ $str_error = pg_last_error($this->db) . pg_result_error($this->ret);
+ throw new Exception(" SQL ERROR $p_string " . $str_error, 1);
+ }
+ } catch (Exception $a) {
+ if (DEBUG) {
+ print_r($p_string);
+ print_r($p_array);
+ echo $a->getMessage();
+ echo $a->getTraceAsString();
+ echo pg_last_error($this->db);
+ }
+ record_log($a->getTraceAsString());
+ $this->rollback();
+
+ throw ($a);
+ }
+
+ return $this->ret;
+ }
+
+ /**
+ * \brief Count the number of row returned by a sql statement
+ *
+ * \param $p_sql sql string
+ * \param $p_array if not null we use the safer pg_query_params
+ */
+
+ function count_sql($p_sql, $p_array = null)
+ {
+ $r_sql = $this->exec_sql($p_sql, $p_array);
+ return pg_NumRows($r_sql);
+ }
+
+ /**
+ * \brief get the current sequence value
+ */
+
+ function get_current_seq($p_seq)
+ {
+ $Res = $this->get_value("select currval('$p_seq') as seq");
+ return $Res;
+ }
+
+ /**
+ * \brief get the next sequence value
+ */
+
+ function get_next_seq($p_seq)
+ {
+ $Res = $this->exec_sql("select nextval('$p_seq') as seq");
+ $seq = pg_fetch_array($Res, 0);
+ return $seq['seq'];
+ }
+
+ /**
+ * @brief : start a transaction
+ *
+ */
+ function start()
+ {
+ $Res = $this->exec_sql("start transaction");
+ }
+
+ /**
+ * Commit the transaction
+ *
+ */
+ function commit()
+ {
+ if (!$this->is_open) return;
+ $Res = $this->exec_sql("commit");
+ }
+
+ /**
+ * rollback the current transaction
+ */
+ function rollback()
+ {
+ if (!$this->is_open) return;
+ $Res = $this->exec_sql("rollback");
+ }
+
+ /**
+ * @brief alter the sequence value
+ * @param $p_name name of the sequence
+ * @param $min the start value of the sequence
+ */
+ function alter_seq($p_name, $min)
+ {
+ if ($min < 1)
+ $min = 1;
+ $Res = $this->exec_sql("alter sequence $p_name restart $min");
+ }
+
+ /**
+ * \brief Execute a sql script
+ * \param $script script name
+ */
+
+ function execute_script($script)
+ {
+
+ if (!DEBUG) {
+ ob_start();
+ } else {
+ $debug = fopen("/tmp/debug.log", "w+");
+ }
+ $hf = fopen($script, 'r');
+ if ($hf == false) {
+ throw new Exception ('Ne peut ouvrir ' . $script);
+ }
+ $sql = "";
+ $flag_function = false;
+ while (!feof($hf)) {
+ $buffer = fgets($hf);
+ $buffer = str_replace('$BODY$', '$_$', $buffer);
+ print $buffer . " ";
+ // comment are not execute
+ if (substr($buffer, 0, 2) == "--") {
+ //echo "comment $buffer";
+ continue;
+ }
+ // Blank Lines Are Skipped
+ If (Strlen($buffer) == 0) {
+ //echo "Blank $buffer";
+ Continue;
+ }
+ if (strpos(strtolower($buffer), "create function") === 0) {
+ echo "found a function";
+ $flag_function = true;
+ $sql = $buffer;
+ continue;
+ }
+ if (strpos(strtolower($buffer), "create or replace function") === 0) {
+ echo "found a function";
+ $flag_function = true;
+ $sql = $buffer;
+ continue;
+ }
+ // No semi colon -> multiline command
+ if ($flag_function == false && strpos($buffer, ';') == false) {
+ $sql .= $buffer;
+ continue;
+ }
+ if ($flag_function) {
+ if (strpos(strtolower($buffer), "$$;") === false &&
+ strpos(strtolower($buffer), '$_$;') === false &&
+ strpos(strtolower($buffer), '$function$;') === false &&
+ strpos(strtolower($buffer), 'language plpgsql;') === false &&
+ strpos(strtolower($buffer), 'language plpgsql ;') === false
+ ) {
+ $sql .= $buffer;
+ continue;
+ }
+ } else {
+ // cut the semi colon
+ $buffer = str_replace(';', '', $buffer);
+ }
+ $sql .= $buffer;
+ if (DEBUG) fwrite($debug, $sql);
+ if ($this->exec_sql($sql) == false) {
+
+ $this->rollback();
+ if (!DEBUG)
+ ob_end_clean();
+ print "ERROR : $sql";
+ throw new Exception("ERROR : $sql");
+ }
+ $sql = "";
+ $flag_function = false;
+ print "";
+ } // while (feof)
+ fclose($hf);
+ if (!DEBUG)
+ ob_end_clean();
+ }
+
+
+ /**
+ * @brief fetch the $p_indice array from the last query
+ * @param $p_indice index
+ *
+ */
+ function fetch($p_indice)
+ {
+ if ($this->ret == false)
+ throw new Exception('this->ret is empty');
+ return pg_fetch_array($this->ret, $p_indice);
+ }
+
+ /**
+ *
+ * @brief return the number of rows found by the last query, or the number
+ * of rows from $p_ret
+ * @param $p_ret is the result of a query, the default value is null, in that case
+ * it is related to the last query
+ * @note synomym for count()
+ */
+
+ function size($p_ret = null)
+ {
+ if ($p_ret == null)
+ return pg_NumRows($this->ret);
+ else
+ return pg_NumRows($p_ret);
+ }
+
+ /**
+ * @brief synomym for size()
+ */
+
+ function count($p_ret = null)
+ {
+ return $this->size($p_ret);
+ }
+
+
+ /**
+ *
+ * \brief return the value of the sql, the sql will return only one value
+ * with the value
+ * \param $p_sql the sql stmt example :select s_value from
+ * document_state where s_id=2
+ * \param $p_array if array is not null we use the ExecSqlParm (safer)
+ * \see exec_sql
+ * \note print a warning if several value are found, if only the first value is needed
+ * consider using a LIMIT clause
+ * \return only the first value or an empty string if nothing is found
+ */
+
+ function get_value($p_sql, $p_array = null)
+ {
+ try {
+ $this->ret = $this->exec_sql($p_sql, $p_array);
+ $r = pg_NumRows($this->ret);
+ if ($r == 0)
+ return "";
+ if ($r > 1) {
+ $array = pg_fetch_all($this->ret);
+ throw new Exception("Attention $p_sql retourne " . pg_NumRows($this->ret) . " valeurs " .
+ var_export($p_array, true) . " values=" . var_export($array, true));
+ }
+ $r = pg_fetch_row($this->ret, 0);
+ return $r[0];
+
+ } catch (Exception $ex) {
+ throw($ex);
+ }
+ }
+
+ /**
+ * @brief return the number of rows affected by the previous query
+ */
+ function get_affected()
+ {
+ return Database::num_row($this->ret);
+ }
+
+ /**
+ * \brief purpose return the result of a sql statment
+ * in a array
+ * \param $p_sql sql query
+ * \param $p_array if not null we use ExecSqlParam
+ * \return false if nothing is found
+ */
+
+ function get_array($p_sql, $p_array = null)
+ {
+ $r = $this->exec_sql($p_sql, $p_array);
+
+ if (pg_NumRows($r) == 0)
+ return array();
+ $array = pg_fetch_all($r);
+ return $array;
+ }
+
+ /**
+ * Returns only one row from a query
+ * @param string $p_sql
+ * @param array $p_array
+ * @return array , idx = column of the table or null if nothing is found
+ * @throws Exception if too many rows are found code 100
+ */
+ function get_row($p_sql, $p_array = NULL)
+ {
+ $array = $this->get_array($p_sql, $p_array);
+ if (empty($array)) return null;
+ if (count($array) == 1) return $array[0];
+ throw new Exception(_("Database:get_row retourne trop de lignes"), 100);
+ }
+
+ /**
+ * @brief Create a sequence
+ * @param string $p_name Sequence Name
+ * @param int $min starting value
+ */
+ function create_sequence($p_name, $min = 1)
+ {
+ if ($min < 1)
+ $min = 1;
+ $sql = "create sequence " . $p_name . " minvalue $min";
+ $this->exec_sql($sql);
+ }
+
+ /**
+ * \brief test if a sequence exist */
+ /* \return true if the seq. exist otherwise false
+ */
+
+ function exist_sequence($p_name)
+ {
+ $r = $this->count_sql("select relname from pg_class where relname=lower($1)", array($p_name));
+ if ($r == 0)
+ return false;
+ return true;
+ }
+
+ /**
+ * \brief test if a table exist
+ * \param $p_name table name
+ * \param $schema name of the schema default public
+ * \return true if a table exist otherwise false
+ */
+
+ function exist_table($p_name, $p_schema = 'public')
+ {
+ $r = $this->count_sql("select table_name from information_schema.tables where table_schema=$1 and table_name=lower($2)", array($p_schema, $p_name));
+ if ($r == 0)
+ return false;
+ return true;
+ }
+
+ /**
+ * Check if a column exists in a table
+ * @param $col : column name
+ * @param $table :table name
+ * @param $schema :schema name, default public
+ * @return true or false
+ */
+ function exist_column($col, $table, $schema)
+ {
+ $r = $this->get_value('select count(*) from information_schema.columns where table_name=lower($1) and column_name=lower($2) and table_schema=lower($3)', array($col, $table, $schema));
+ if ($r > 0)
+ return true;
+ return false;
+ }
+
+
+ /**
+ * Count the database name in a system view
+ * @param $p_name string database name
+ * @return number of database found (normally 0 or 1)
+ */
+ function exist_database($p_name)
+ {
+ $database_exist = $this->get_value('select count(*)
+ from pg_catalog.pg_database where datname = lower($1)', array($p_name));
+ return $database_exist;
+ }
+
+ /**
+ * @brief check if the large object exists
+ * @param $p_oid of the large object
+ * @return return true if the large obj exist or false if not
+ */
+ function exist_blob($p_oid)
+ {
+ $r = $this->get_value('select count(*) from pg_largeobject_metadata where oid=$1'
+ , array($p_oid));
+ if ($r > 0)
+ return true;
+ else
+ return false;
+ }
+
+ /*
+ *!\brief test if a view exist
+ * \return true if the view. exist otherwise false
+ */
+
+ function exist_view($p_name)
+ {
+ $r = $this->count_sql("select viewname from pg_views where viewname=lower($1)", array($p_name));
+ if ($r == 0)
+ return false;
+ return true;
+ }
+
+ /*
+ *!\brief test if a schema exists
+ * \return true if the schemas exists otherwise false
+ */
+
+ function exist_schema($p_name)
+ {
+ $r = $this->count_sql("select nspname from pg_namespace where nspname=lower($1)", array($p_name));
+ if ($r == 0)
+ return false;
+ return true;
+ }
+
+ /**
+ * \brief create a string containing the value separated by comma
+ * for use in a SQL in statement
+ * \return the string or empty if nothing is found
+ * \see fid_card.php
+ */
+
+ function make_list($sql, $p_array = null)
+ {
+ if ($p_array == null) {
+ $aArray = $this->get_array($sql);
+ } else {
+ $aArray = $this->get_array($sql, $p_array);
+ }
+ if (empty($aArray))
+ return "";
+ $aIdx = array_keys($aArray[0]);
+ $idx = $aIdx[0];
+ $ret = "";
+ $f = "";
+ for ($i = 0; $i < count($aArray); $i++) {
+ $row = $aArray[$i];
+ $ret .= $f . $aArray[$i][$idx];
+ $f = ',';
+ }
+ $ret = trim($ret, ',');
+ return $ret;
+ }
+
+ /**
+ * \brief make a array with the sql.
+ *
+ * \param $p_sql sql statement, only the first two column will be returned in
+ * an array. The first col. is the label and the second the value
+ * \param $p_null if the array start with a null value
+ * \param $p_array is the array with the bind value
+ * \note this function is used with ISelect when it is needed to have a list of
+ * options.
+ * \return: a double array like
+ * \verbatim
+ * Array
+ * (
+ * [0] => Array
+ * (
+ * [value] => 1
+ * [label] => Marchandise A
+ * )
+ *
+ * [1] => Array
+ * (
+ * [value] => 2
+ * [label] => Marchandise B
+ * )
+ *
+ * [2] => Array
+ * (
+ * [value] => 3
+ * [label] => Marchandise C
+ * )
+ * )
+ * \endverbatim
+ * \see ISelect
+ */
+
+ function make_array($p_sql, $p_null = 0, $p_array = null)
+ {
+ $a = $this->exec_sql($p_sql, $p_array);
+ $max = pg_NumRows($a);
+ if ($max == 0 && $p_null == 0)
+ return null;
+ for ($i = 0; $i < $max; $i++) {
+ $row = pg_fetch_row($a);
+ $r[$i]['value'] = $row[0];
+ $r[$i]['label'] = h($row[1]);
+ }
+ // add a blank item ?
+ if ($p_null == 1) {
+ for ($i = $max; $i != 0; $i--) {
+ $r[$i]['value'] = $r[$i - 1]['value'];
+ $r[$i]['label'] = h($r[$i - 1]['label']);
+ }
+ $r[0]['value'] = -1;
+ $r[0]['label'] = " ";
+ } // if ( $p_null == 1 )
+
+ return $r;
+ }
+
+ /***
+ * \brief Save a document into the database , it just puts the file in the database
+ * and returns the corresponding OID , the mimetype , size ... of the document
+ * must be set in the calling function.
+ *
+ * \param name of the variable in $_FILES
+ * \return $oid of the lob file if success
+ * false if a error occurs or if there is no file to upload
+ *
+ */
+
+ function upload($p_name)
+ {
+ /* there is no file to upload */
+ if ($_FILES[$p_name]["error"] == UPLOAD_ERR_NO_FILE) {
+ return false;
+ }
+
+ $new_name = tempnam($_ENV['TMP'], $p_name);
+ if ($_FILES[$p_name]["error"] > 0) {
+ print_r($_FILES);
+ echo_error(__FILE__ . ":" . __LINE__ . "Error: " . $_FILES[$p_name]["error"]);
+ return false;
+ }
+ if (strlen($_FILES[$p_name]['tmp_name']) != 0) {
+ if (move_uploaded_file($_FILES[$p_name]['tmp_name'], $new_name)) {
+ // echo "Image saved";
+ $oid = pg_lo_import($this->db, $new_name);
+ if ($oid == false) {
+ echo_error(__FILE__, __LINE__, "cannot upload document");
+ $this->rollback();
+ return false;
+ }
+ return $oid;
+ } else {
+ echo "
Error
";
+ $this->rollback();
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**\brief wrapper for the function pg_NumRows
+ * \param $ret is the result of a exec_sql
+ * \return number of line affected
+ */
+
+ static function num_row($ret)
+ {
+ return pg_NumRows($ret);
+ }
+
+ /**\brief wrapper for the function pg_fetch_array
+ * \param $ret is the result of a pg_exec
+ * \param $p_indice is the index
+ * \return $array of column
+ */
+
+ static function fetch_array($ret, $p_indice = 0)
+ {
+ return pg_fetch_array($ret, $p_indice);
+ }
+
+ /**\brief wrapper for the function pg_fetch_all
+ * \param $ret is the result of pg_exec (exec_sql)
+ * \return double array (row x col )
+ */
+
+ static function fetch_all($ret)
+ {
+ return pg_fetch_all($ret);
+ }
+
+ /**\brief wrapper for the function pg_fetch_all
+ * \param $ret is the result of pg_exec (exec_sql)
+ * \param $p_row is the indice of the row
+ * \param $p_col is the indice of the col
+ * \return a string or an integer
+ */
+
+ static function fetch_result($ret, $p_row = 0, $p_col = 0)
+ {
+ return pg_fetch_result($ret, $p_row, $p_col);
+ }
+
+ /**
+ * \brief wrapper for the function pg_fetch_row
+ * \param $ret is the result of pg_exec (exec_sql)
+ * \param $p_row is the indice of the row
+ * \return an array indexed from 0
+ */
+ static function fetch_row($ret, $p_row)
+ {
+ return pg_fetch_row($ret, $p_row);
+ }
+
+ /**\brief wrapper for the function pg_lo_unlink
+ * \param $p_oid is the of oid
+ * \return return the result of the operation
+ */
+
+ function lo_unlink($p_oid)
+ {
+ if (!$this->exist_blob($p_oid)) return;
+ return pg_lo_unlink($this->db, $p_oid);
+ }
+
+ /**\brief wrapper for the function pg_prepare
+ * \param $p_string string name for pg_prepare function
+ * \param $p_sql is the sql to prepare
+ * \return return the result of the operation
+ */
+
+ function prepare($p_string, $p_sql)
+ {
+ return pg_prepare($this->db, $p_string, $p_sql);
+ }
+
+ /**
+ * \brief wrapper for the function pg_execute
+ * \param $p_string string name of the stmt given in pg_prepare function
+ * \param $p_array contains the variables
+ * \note set this->ret to the return of pg_execute
+ * \return return the result of the operation,
+ */
+
+ function execute($p_string, $p_array)
+ {
+ $this->ret = pg_execute($this->db, $p_string, $p_array);
+ return $this->ret;
+ }
+
+ /**
+ * \brief wrapper for the function pg_lo_export
+ * \param $p_oid is the oid of the log
+ * \param $tmp is the file
+ * \return result of the operation
+ */
+
+ function lo_export($p_oid, $tmp)
+ {
+ return pg_lo_export($this->db, $p_oid, $tmp);
+ }
+
+ /**\brief wrapper for the function pg_lo_export
+ * \param $p_oid is the filename
+ * \param $tmp is the file
+ * \return result of the operation
+ */
+
+ function lo_import($p_oid)
+ {
+ return pg_lo_import($this->db, $p_oid);
+ }
+
+ /**\brief wrapper for the function pg_escape_string
+ * \param $p_string is the string to escape
+ * \return escaped string
+ */
+
+ static function escape_string($p_string)
+ {
+ return pg_escape_string($p_string);
+ }
+
+ /**\brief wrapper for the function pg_close
+ */
+
+ function close()
+ {
+ if ($this->is_open) pg_close($this->db);
+ $this->is_open = FALSE;
+ }
+
+ /**\brief
+ * \param
+ * \return
+ * \note
+ * \see
+ */
+
+ function __toString()
+ {
+ return "database ";
+ }
+
+ static function test_me()
+ {
+
+ }
+
+ function status()
+ {
+ return pg_transaction_status($this->db);
+ }
+
+
+ /**
+ * @brief Find all lob and remove those which are not used by any tables
+ *
+ */
+ function clean_orphan_lob()
+ {
+ // find all columns of type lob
+ $sql = "
+ select table_schema,table_name,column_name
+ from
+ information_schema.columns
+ where table_schema not in ('information_schema','pg_catalog')
+ and data_type='oid'";
+ $all_lob = "
+ select oid,'N' as used from pg_largeobject_metadata
+ ";
+ $a_table = $this->get_array($sql);
+ $a_lob = $this->get_array($all_lob);
+ if ($a_table == false || $a_lob == false) return;
+ // for each lob
+ $nb_lob = count($a_lob);
+ $nb_table = count($a_table);
+ for ($i = 0; $i < $nb_lob; $i++) {
+ $lob = $a_lob[$i]['oid'];
+ if ($a_lob[$i]['used'] == 'Y') continue;
+ for ($j = 0; $j < $nb_table; $j++) {
+ if ($a_lob[$i]['used'] == 'Y') continue;
+ $check = $this->get_value(" select count(*) from " .
+ $a_table[$j]['table_schema'] . "." . $a_table[$j]['table_name'] .
+ " where " .
+ $a_table[$j]['column_name'] . "=$1", array($lob));
+ if ($check != 0)
+ $a_lob[$i]['used'] = 'Y';
+
+ }
+ }
+ for ($i = 0; $i < $nb_lob; $i++) {
+ if ($a_lob[$i]['used'] == 'Y') continue;
+ $this->lo_unlink($a_lob[$i]['oid']);
+ }
+ }
+
+ /**
+ * Check if a prepared statement already exists or not
+ * @param string $query_name name of the prepared query
+ * @return boolean false is not yet prepared
+ */
+ function is_prepare($query_name)
+ {
+ $nb_prepared = $this->get_value("select count(*) from pg_prepared_statements where name=$1", [$query_name]);
+ if ($nb_prepared == 0) return FALSE;
+ return TRUE;
+ }
+
+ /**
+ * with the handle of a successull query, echo each row into CSV and
+ * send it directly
+ * @param type $ret handle to a query
+ * @param type $aheader double array, each item of the array contains
+ * a key type (num) and a key title
+ */
+ function query_to_csv($ret, $aheader)
+ {
+ $csv = new Noalyss_Csv("db-query");
+ $a_header = [];
+ for ($i = 0; $i < count($aheader); $i++) {
+ $a_header[] = $aheader[$i]['title'];
+ }
+ $csv->write_header($a_header);
+
+ // fetch all the rows
+ for ($i = 0; $i < Database::num_row($ret); $i++) {
+ $row = Database::fetch_array($ret, $i);
+ // for each rows, for each value
+ for ($e = 0; $e < count($row) / 2; $e++) {
+ switch ($aheader[$e]['type']) {
+ case 'num':
+ $csv->add($row[$e], "number");
+ break;
+ default:
+ $csv->add($row[$e]);
+ }
+ }
+ $csv->write();
+ }
+ }
+}
+
+/* test::test_me(); */
diff --git a/include/lib/filetosend.class.php b/include/lib/filetosend.class.php
index fa9b4e3be..fc7479940 100644
--- a/include/lib/filetosend.class.php
+++ b/include/lib/filetosend.class.php
@@ -16,19 +16,19 @@
* along with NOALYSS; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// Copyright Author Dany De Bontridder danydb@aevalys.eu
+// Copyright Author Dany De Bontridder danydb@noalyss.eu
/**
*@file
* @brief file to add to a message
*
- * @see Sendmail
+ * @see Sendmail_Core
* @author dany
*/
/**
* @brief file to add to a message
*
- * @see Sendmail
+ * @see Sendmail_Core
* @author dany
*/
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index 10426dc42..8785d2607 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -22,11 +22,11 @@ require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* ! \file
+/*! \file
* \brief This class is used to create all the HTML INPUT TYPE
*/
-/* !
+/*!
* \brief class widget This class is used to create all the HTML INPUT TYPE
* and some specials which works with javascript like
* js_search.
@@ -55,20 +55,20 @@ require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
class HtmlInput
{
- var $type; /* !< $type type of the widget */
- var $name; /* !< $name field NAME of the INPUT */
- var $value; /* !< $value what the INPUT contains */
- var $readOnly; /* !< $readonly true : we cannot change value */
- var $size; /* !< $size size of the input */
- var $selected; /* !< $selected for SELECT RADIO and CHECKBOX the selected value */
- var $table; /* !< $table =1 add the table tag */
- var $label; /* !< $label the question before the input */
- var $disabled; /* !< $disabled poss. value == true or nothing, to disable INPUT */
- var $extra; /* !< $extra different usage, it depends of the $type */
- var $extra2; /* !< $extra2 different usage,
+ var $type; /*!< $type type of the widget */
+ var $name; /*!< $name field NAME of the INPUT */
+ var $value; /*!< $value what the INPUT contains */
+ var $readOnly; /*!< $readonly true : we cannot change value */
+ var $size; /*!< $size size of the input */
+ var $selected; /*!< $selected for SELECT RADIO and CHECKBOX the selected value */
+ var $table; /*!< $table =1 add the table tag */
+ var $label; /*!< $label the question before the input */
+ var $disabled; /*!< $disabled poss. value == true or nothing, to disable INPUT */
+ var $extra; /*!< $extra different usage, it depends of the $type */
+ var $extra2; /*!< $extra2 different usage,
it depends of the $type */
- var $javascript; /* !< $javascript is the javascript to add to the widget */
- var $ctrl; /* !<$ctrl is the control to update (see js_search_card_control) */
+ var $javascript; /*!< $javascript is the javascript to add to the widget */
+ var $ctrl; /*!<$ctrl is the control to update (see js_search_card_control) */
var $tabindex;
function __construct($p_name="", $p_value="", $p_id="")
@@ -94,7 +94,7 @@ class HtmlInput
$this->readOnly=$p_read;
}
- /* !\brief set the extra javascript property for the INPUT field
+ /*!\brief set the extra javascript property for the INPUT field
* \param $p_name name of the parameter
* \param $p_value default value of this parameter
*/
@@ -229,7 +229,7 @@ class HtmlInput
return self::hidden('plugin_code', $_REQUEST['plugin_code']);
}
- /* !\brief create a button with a ref
+ /*!\brief create a button with a ref
* \param $p_label the text
* \param $p_value the location of the window,
* \param $p_name the id of the span
diff --git a/include/lib/http_input.class.php b/include/lib/http_input.class.php
index 77b3e1287..68d9648d1 100644
--- a/include/lib/http_input.class.php
+++ b/include/lib/http_input.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php
index 070a2014b..7c59fef75 100644
--- a/include/lib/icon_action.class.php
+++ b/include/lib/icon_action.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/lib/idate.class.php b/include/lib/idate.class.php
index b3a466b81..f61901f71 100644
--- a/include/lib/idate.class.php
+++ b/include/lib/idate.class.php
@@ -47,7 +47,7 @@ class IDate extends HtmlInput
$this->autofocus=false;
}
- /* !\brief show the html input of the widget */
+ /*!\brief show the html input of the widget */
public function input($p_name=null, $p_value=null)
{
@@ -90,7 +90,7 @@ class IDate extends HtmlInput
return $r;
}
- /* !\brief print in html the readonly value of the widget */
+ /*!\brief print in html the readonly value of the widget */
public function display()
{
diff --git a/include/lib/inplace_switch.class.php b/include/lib/inplace_switch.class.php
index 8120a8f9e..77d395331 100644
--- a/include/lib/inplace_switch.class.php
+++ b/include/lib/inplace_switch.class.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/lib/inum.class.php b/include/lib/inum.class.php
index 489ccef13..f17e857d5 100644
--- a/include/lib/inum.class.php
+++ b/include/lib/inum.class.php
@@ -20,11 +20,11 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* !\file
+/*!\file
* \brief for the numeric input text field
*/
require_once NOALYSS_INCLUDE.'/lib/itext.class.php';
-/* !\brief
+/*!\brief
* This class handles only the numeric input, the input will
* call a javascript
* to change comma to period and will round it (2 decimal), the precision is given by
@@ -51,7 +51,7 @@ class INum extends IText
$this->javascript='onchange="format_number(this,2);"';
}
- /* !\brief print in html the readonly value of the widget */
+ /*!\brief print in html the readonly value of the widget */
public function display()
{
@@ -73,7 +73,7 @@ class INum extends IText
return $r;
}
- /* !\brief show the html input of the widget */
+ /*!\brief show the html input of the widget */
public function input($p_name=null, $p_value=null)
{
diff --git a/include/lib/pdf.class.php b/include/lib/pdf.class.php
deleted file mode 100644
index 42efcaa8d..000000000
--- a/include/lib/pdf.class.php
+++ /dev/null
@@ -1,438 +0,0 @@
-width=$w ;
- $this->height=$h ;
- $this->text=$txt;
- $this->border=$border;
- $this->new_line=$ln;
- $this->align=$align;
- $this->fill=$fill;
- $this->link=$link;
- $this->type=$type;
- return $this;
- }
-}
-class PDF extends TFPDF
-{
-
- var $cn = null;
- var $own = null;
- var $soc = "";
- var $dossier = "n/a";
- var $date = "";
- private $cells=array();
-
- public function __construct ($p_cn = null, $orientation = 'P', $unit = 'mm', $format = 'A4')
- {
- $this->bigger=0;
- if($p_cn == null) die("No database connection. Abort.");
-
- parent::__construct($orientation, $unit, $format);
- $this->AddFont('DejaVu','','DejaVuSans.ttf',true);
- $this->AddFont('DejaVu','B','DejaVuSans-Bold.ttf',true);
- $this->AddFont('DejaVu','BI','DejaVuSans-BoldOblique.ttf',true);
- $this->AddFont('DejaVuCond','','DejaVuSansCondensed.ttf',true);
- $this->AddFont('DejaVuCond','B','DejaVuSansCondensed-Bold.ttf',true);
- $this->AddFont('DejaVuCond','I','DejaVuSansCondensed-Oblique.ttf',true);
- date_default_timezone_set ('Europe/Paris');
-
- $this->cn = $p_cn;
- $this->own = new Noalyss_Parameter_Folder($this->cn);
- $this->soc = $this->own->MY_NAME;
- $this->date = date('d.m.Y');
- $this->cells=array();
- }
-
- function setDossierInfo($dossier = "n/a")
- {
- $this->dossier = dossier::name()." ".$dossier;
- }
-
- function Header()
- {
- //Arial bold 12
- $this->SetFont('DejaVu', 'B', 12);
- //Title
- parent::Cell(0,10,$this->dossier, 'B', 0, 'C');
- //Line break
- parent::Ln(20);
- }
- function Footer()
- {
- //Position at 2 cm from bottom
- $this->SetY(-20);
- //Arial italic 8
- $this->SetFont('Arial', '', 8);
- //Page number
- parent::Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
- parent::Ln(3);
- // Created by NOALYSS
- parent::Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
- }
- /**
- * Count the number of rows a p_text will take for a multicell
- * @param $p_text String
- * @param $p_colSize size of the column in User Unit
- */
- private function count_nb_row($p_text,$p_colSize)
- {
- // If colSize is bigger than the size of the string then it takes 1 line
- if ( $this->GetStringWidth($p_text) <= $p_colSize) return 1;
- $nRow=0;
- $aWords=explode(' ',$p_text);
- $nb_words=count($aWords);
- $string="";
-
- for ($i=0;$i < $nb_words;$i++){
- // Concatenate String with current word + a space
- $string.=$aWords[$i];
-
- // if there is a word after add a space
- if ( $i+1 < $nb_words) $string.=" ";
-
- // Compute new size and compare to the colSize
- if ( $this->GetStringWidth($string) >= $p_colSize) {
- // If the size of the string if bigger than we add a row, the current
- // word is the first word of the next line
- $nRow++;
- $string=$aWords[$i];
- }
- }
- $nRow++;
- return $nRow;
-
-
-
- }
- /**
- * Check if a page must be added due a MultiCell
- * @return boolean
- */
- private function check_page_add()
- {
- // break on page
- $size=count($this->cells);
- for ($i=0;$i < $size ; $i++)
- {
- if ($this->cells[$i]->type == 'M' )
- {
- /**
- * On doit calculer si le texte dépasse la texte et compter le
- * nombre de lignes que le texte prendrait. Ensuite il faut
- * faire un saut de page (renvoit true) si dépasse
- */
-
- $sizetext=$this->GetStringWidth($this->cells[$i]->text);
-
- // if text bigger than column width then check
-
- $y=$this->GetY();
- $nb_row=$this->count_nb_row($this->cells[$i]->text, $this->cells[$i]->width);
- $height=$this->cells[$i]->height*$nb_row;
-
- // If the text is bigger than a sheet of paper then return false
- if ($height >= $this->h) return false;
-
- if ( $y + $height > ($this->h - $this->bMargin -7 ))
- return true;
-
- }
- }
- return false;
- }
- private function print_row()
- {
- static $e=0;
- $e++;
- if ( $this->check_page_add() == true ) $this->AddPage ();
- $this->bigger=0;
- $size=count($this->cells);
- $cell=$this->cells;
- if ($size == 0 )return;
- for ($i=0;$i < $size ; $i++)
- {
- $a=$cell[$i];
- $a->text= str_replace("\\", "", $a->text);
- switch ($a->type)
- {
- case "M":
- $x_m=$this->GetX();
- $y_m=$this->GetY();
- parent::MultiCell(
- $a->width,
- $a->height,
- $a->text,
- $a->border,
- $a->align,
- $a->fill
- );
- $x_m=$x_m+$a->width;
- $tmp=$this->GetY()-$y_m;
- if ( $tmp > $this->bigger) $this->bigger=$tmp;
- $this->SetXY($x_m,$y_m);
- break;
-
- case "C":
-
- parent::Cell( $a->width,
- $a->height,
- $a->text,
- $a->border,
- $a->new_line,
- $a->align,
- $a->fill,
- $a->link);
- break;
-
- default:
- break;
- }
- }
- $this->cells=array();
- }
- private function add_cell(Cellule $Ce)
- {
- $size=count($this->cells);
- $this->cells[$size]=$Ce;
-
- }
- function write_cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
- {
- $this->add_cell(new Cellule($w,$h,$txt,$border,$ln,$align,$fill,$link,'C'));
-
- }
- function LongLine($w,$h,$txt,$border=0,$align='',$fill=false)
- {
- $this->add_cell(new Cellule($w,$h,$txt,$border,0,$align,$fill,'','M'));
-
- }
- /**
- * Print all the cell stored and call Ln (new line)
- * @param int $p_step
- */
- function line_new($p_step=null){
- $this->print_row();
- if ( $this->bigger==0)
- parent::Ln($p_step);
- else
- parent::Ln($this->bigger);
- $this->bigger=0;
- }
- /**
- * If the step is even then return 1 and set the backgroup color to blue , otherwise
- * returns 0, and set the background color to white
- * It is use to compute alternated colored row , it the parameter fill in write_cell and
- * cell
- * @see PDF:write_cell
- * @see TPDF:cell
- *
- */
- function is_fill($p_step)
- {
- if ($p_step % 2 == 0) {
- $pdf->SetFillColor(220, 221, 255);
- $fill = 1;
- } else {
- $pdf->SetFillColor(0, 0, 0);
- $fill = 0;
- }
- return $p_step;
- }
- /**
- *@brief retrieve the client name and quick_code
- *@param $p_jr_id jrn.jr_id
- *@param $p_jrn_type ledger type ACH VEN FIN
- *@return array (0=>qcode,1=>name) or for FIN 0=>customer qc 1=>customer name 2=>bank qc 3=>bank name
- *@see class_print_ledger_simple, class_print_ledger_simple_without_vat
- */
- function get_tiers($p_jr_id,$p_jrn_type)
- {
- if ( $p_jrn_type=='ACH' )
- {
- $array=$this->cn->get_array('SELECT
- jrnx.j_grpt,
- quant_purchase.qp_supplier,
- quant_purchase.qp_internal,
- jrn.jr_internal
- FROM
- public.quant_purchase,
- public.jrnx,
- public.jrn
- WHERE
- quant_purchase.j_id = jrnx.j_id AND
- jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
- if (count($array)==0) return array("ERREUR $p_jr_id",'');
- $customer_id=$array[0]['qp_supplier'];
- $fiche=new Fiche($this->cn,$customer_id);
- $customer_qc=$fiche->get_quick_code($customer_id);
- $customer_name=$fiche->getName();
- return array($customer_qc,$customer_name);
- }
- if ( $p_jrn_type=='VEN' )
- {
- $array=$this->cn->get_array('SELECT
- quant_sold.qs_client
- FROM
- public.quant_sold,
- public.jrnx,
- public.jrn
- WHERE
- quant_sold.j_id = jrnx.j_id AND
- jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
- if (count($array)==0) return array("ERREUR $p_jr_id",'');
- $customer_id=$array[0]['qs_client'];
- $fiche=new Fiche($this->cn,$customer_id);
- $customer_qc=$fiche->get_quick_code($customer_id);
- $customer_name=$fiche->getName();
- return array($customer_qc,$customer_name);
- }
- if ( $p_jrn_type=='FIN' )
- {
- $array=$this->cn->get_array('SELECT
- qf_other,qf_bank
- FROM
- public.quant_fin
- WHERE
- quant_fin.jr_id =$1',array($p_jr_id));
- if (count($array)==0) return array("ERREUR $p_jr_id",'','','');
- $customer_id=$array[0]['qf_other'];
- $fiche=new Fiche($this->cn,$customer_id);
- $customer_qc=$fiche->get_quick_code($customer_id);
- $customer_name=$fiche->getName();
-
- $bank_id=$array[0]['qf_bank'];
- $fiche=new Fiche($this->cn,$bank_id);
- $bank_qc=$fiche->get_quick_code($bank_id);
- $bank_name=$fiche->getName();
-
- return array($customer_qc,$customer_name,$bank_qc,$bank_name);
- }
- }
-
-
-}
-
-class PDFLand extends PDF
-{
-
- public function __construct ($p_cn = null, $orientation = 'P', $unit = 'mm', $format = 'A4')
- {
-
- if($p_cn == null) die("No database connection. Abort.");
- $this->bigger=0;
-
- parent::__construct($p_cn,'L', $unit, $format);
- date_default_timezone_set ('Europe/Paris');
- $this->AddFont('DejaVu','','DejaVuSans.ttf',true);
- $this->AddFont('DejaVu','B','DejaVuSans-Bold.ttf',true);
- $this->AddFont('DejaVu','BI','DejaVuSans-BoldOblique.ttf',true);
- $this->AddFont('DejaVuCond','','DejaVuSansCondensed.ttf',true);
- $this->AddFont('DejaVuCond','B','DejaVuSansCondensed-Bold.ttf',true);
- $this->AddFont('DejaVuCond','I','DejaVuSansCondensed-Oblique.ttf',true);
-
- $this->cn = $p_cn;
- $this->own = new Noalyss_Parameter_Folder($this->cn);
- $this->soc = $this->own->MY_NAME;
- $this->date = date('d.m.Y');
- }
- function Header()
- {
- //Arial bold 12
- $this->SetFont('DejaVu', 'B', 10);
- //Title
- $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
- //Line break
- $this->Ln(20);
- }
- function Footer()
- {
- //Position at 2 cm from bottom
- $this->SetY(-20);
- //Arial italic 8
- $this->SetFont('DejaVuCond', 'I', 8);
- //Page number
- $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
- $this->Ln(3);
- // Created by NOALYSS
- $this->Cell(0,8,'Created by NOALYSS, online on http://www.noalyss.eu',0,0,'C',false,'http://www.noalyss.eu');
-
- }
-}
-
-class PDFBalance_simple extends PDF
-{
- /**
- *@brief set_info(dossier,from poste,to poste, from periode, to periode)
- *@param $p_from_poste start = poste
- *@param $p_to_poste end = poste
- *@param $p_from periode start
- *@param $p_to periode end
- */
- function set_info($p_from_poste,$to_poste,$p_from,$p_to)
- {
- $this->dossier='Balance simple '.dossier::name();
- $this->from_poste=$p_from_poste;
- $this->to_poste=$to_poste;
- $this->from=$p_from;
- $this->to=$p_to;
- }
- function Header()
- {
- parent::Header();
- $this->SetFont('DejaVu','B',8);
- $titre=sprintf("Balance simple poste %s %s date %s %s",
- $this->from_poste,
- $this->to_poste,
- $this->from,
- $this->to);
- $this->Cell(0,7,$titre,1,0,'C');
-
- $this->Ln();
- $this->SetFont('DejaVu','',6);
-
- $this->Cell(110,7,'Poste Comptable','B');
- $this->Cell(20,7,'Débit','B',0,'L');
- $this->Cell(20,7,'Crédit','B',0,'L');
- $this->Cell(20,7,'Solde','B',0,'L');
- $this->Cell(20,7,'D/C','B',0,'L');
- $this->Ln();
-
- }
-}
diff --git a/include/lib/pdf_core.class.php b/include/lib/pdf_core.class.php
new file mode 100644
index 000000000..91c76723b
--- /dev/null
+++ b/include/lib/pdf_core.class.php
@@ -0,0 +1,251 @@
+width=$w ;
+ $this->height=$h ;
+ $this->text=$txt;
+ $this->border=$border;
+ $this->new_line=$ln;
+ $this->align=$align;
+ $this->fill=$fill;
+ $this->link=$link;
+ $this->type=$type;
+ return $this;
+ }
+}
+class PDF_Core extends TFPDF
+{
+
+
+
+ private $cells=array();
+
+ public function __construct ( $orientation = 'P', $unit = 'mm', $format = 'A4')
+ {
+ $this->bigger=0;
+
+ parent::__construct($orientation, $unit, $format);
+ $this->AddFont('DejaVu','','DejaVuSans.ttf',true);
+ $this->AddFont('DejaVu','B','DejaVuSans-Bold.ttf',true);
+ $this->AddFont('DejaVu','BI','DejaVuSans-BoldOblique.ttf',true);
+ $this->AddFont('DejaVuCond','','DejaVuSansCondensed.ttf',true);
+ $this->AddFont('DejaVuCond','B','DejaVuSansCondensed-Bold.ttf',true);
+ $this->AddFont('DejaVuCond','I','DejaVuSansCondensed-Oblique.ttf',true);
+
+
+
+ $this->cells=array();
+ }
+
+
+ /**
+ * Count the number of rows a p_text will take for a multicell
+ * @param $p_text String
+ * @param $p_colSize size of the column in User Unit
+ */
+ private function count_nb_row($p_text,$p_colSize)
+ {
+ // If colSize is bigger than the size of the string then it takes 1 line
+ if ( $this->GetStringWidth($p_text) <= $p_colSize) return 1;
+ $nRow=0;
+ $aWords=explode(' ',$p_text);
+ $nb_words=count($aWords);
+ $string="";
+
+ for ($i=0;$i < $nb_words;$i++){
+ // Concatenate String with current word + a space
+ $string.=$aWords[$i];
+
+ // if there is a word after add a space
+ if ( $i+1 < $nb_words) $string.=" ";
+
+ // Compute new size and compare to the colSize
+ if ( $this->GetStringWidth($string) >= $p_colSize) {
+ // If the size of the string if bigger than we add a row, the current
+ // word is the first word of the next line
+ $nRow++;
+ $string=$aWords[$i];
+ }
+ }
+ $nRow++;
+ return $nRow;
+
+
+
+ }
+ /**
+ * Check if a page must be added due a MultiCell
+ * @return boolean
+ */
+ private function check_page_add()
+ {
+ // break on page
+ $size=count($this->cells);
+ for ($i=0;$i < $size ; $i++)
+ {
+ if ($this->cells[$i]->type == 'M' )
+ {
+ /**
+ * On doit calculer si le texte dépasse la texte et compter le
+ * nombre de lignes que le texte prendrait. Ensuite il faut
+ * faire un saut de page (renvoit true) si dépasse
+ */
+
+ $sizetext=$this->GetStringWidth($this->cells[$i]->text);
+
+ // if text bigger than column width then check
+
+ $y=$this->GetY();
+ $nb_row=$this->count_nb_row($this->cells[$i]->text, $this->cells[$i]->width);
+ $height=$this->cells[$i]->height*$nb_row;
+
+ // If the text is bigger than a sheet of paper then return false
+ if ($height >= $this->h) return false;
+
+ if ( $y + $height > ($this->h - $this->bMargin -7 ))
+ return true;
+
+ }
+ }
+ return false;
+ }
+ private function print_row()
+ {
+ static $e=0;
+ $e++;
+ if ( $this->check_page_add() == true ) $this->AddPage ();
+ $this->bigger=0;
+ $size=count($this->cells);
+ $cell=$this->cells;
+ if ($size == 0 )return;
+ for ($i=0;$i < $size ; $i++)
+ {
+ $a=$cell[$i];
+ $a->text= str_replace("\\", "", $a->text);
+ switch ($a->type)
+ {
+ case "M":
+ $x_m=$this->GetX();
+ $y_m=$this->GetY();
+ parent::MultiCell(
+ $a->width,
+ $a->height,
+ $a->text,
+ $a->border,
+ $a->align,
+ $a->fill
+ );
+ $x_m=$x_m+$a->width;
+ $tmp=$this->GetY()-$y_m;
+ if ( $tmp > $this->bigger) $this->bigger=$tmp;
+ $this->SetXY($x_m,$y_m);
+ break;
+
+ case "C":
+
+ parent::Cell( $a->width,
+ $a->height,
+ $a->text,
+ $a->border,
+ $a->new_line,
+ $a->align,
+ $a->fill,
+ $a->link);
+ break;
+
+ default:
+ break;
+ }
+ }
+ $this->cells=array();
+ }
+ private function add_cell(Cellule $Ce)
+ {
+ $size=count($this->cells);
+ $this->cells[$size]=$Ce;
+
+ }
+ function write_cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
+ {
+ $this->add_cell(new Cellule($w,$h,$txt,$border,$ln,$align,$fill,$link,'C'));
+
+ }
+ function LongLine($w,$h,$txt,$border=0,$align='',$fill=false)
+ {
+ $this->add_cell(new Cellule($w,$h,$txt,$border,0,$align,$fill,'','M'));
+
+ }
+ /**
+ * Print all the cell stored and call Ln (new line)
+ * @param int $p_step
+ */
+
+ function line_new($p_step=null){
+ $this->print_row();
+ if ( $this->bigger==0)
+ parent::Ln($p_step);
+ else
+ parent::Ln($this->bigger);
+ $this->bigger=0;
+ }
+ /**
+ * If the step is even then return 1 and set the backgroup color to blue , otherwise
+ * returns 0, and set the background color to white
+ * It is use to compute alternated colored row , it the parameter fill in write_cell and
+ * cell
+ * @see PDF:write_cell
+ * @see TPDF:cell
+ *
+ */
+ function is_fill($p_step)
+ {
+ if ($p_step % 2 == 0) {
+ $pdf->SetFillColor(220, 221, 255);
+ $fill = 1;
+ } else {
+ $pdf->SetFillColor(0, 0, 0);
+ $fill = 0;
+ }
+ return $p_step;
+ }
+
+
+
+}
+
diff --git a/include/lib/sendmail.class.php b/include/lib/sendmail_core.class.php
similarity index 58%
rename from include/lib/sendmail.class.php
rename to include/lib/sendmail_core.class.php
index c0fbed4af..43a71e283 100644
--- a/include/lib/sendmail.class.php
+++ b/include/lib/sendmail_core.class.php
@@ -29,9 +29,8 @@
* @author dany
*/
require_once NOALYSS_INCLUDE.'/lib/filetosend.class.php';
-require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
-class Sendmail
+class Sendmail_Core
{
private $mailto;
@@ -42,6 +41,10 @@ class Sendmail
private $content;
private $header;
+ function __construct()
+ {
+ }
+
/**
* set the from
* @param $p_from has the form name
@@ -109,8 +112,8 @@ class Sendmail
function compose()
{
$this->verify();
- $this->header="";
- $this->content="";
+ $this->header="";
+ $this->content="";
// a random hash will be necessary to send mixed content
$separator = md5(time());
@@ -152,104 +155,23 @@ class Sendmail
$this->content .= "--" . $separator . "--";
}
+
/**
- * Send the message
+ * Send email
* @throws Exception
*/
function send()
{
- if ( $this->can_send() == false ) throw new Exception(_('Email non envoyé'),EMAIL_LIMIT);
+ try {
+ $this->verify();
- if (!mail($this->mailto, $this->subject, $this->content,$this->header))
+ } catch (Exception $e) {
+ throw $e;
+ }
+
+ if (!mail($this->mailto, $this->subject, $this->content,$this->header))
{
throw new Exception('send failed');
}
- // Increment email amount
- $repo =new Database();
- $date=date('Ymd');
- $http=new HttpInput();
- $dossier=$http->request("gDossier","string", -1);
- $this->increment_mail($repo,$dossier,$date);
}
- /**
- * Check if email can be sent from a folder
- * @return boolean
- */
- function can_send() {
- /**
- * if send from a dossier , then check limit of this dossier
- * otherwise send true
- */
- $http=new HttpInput();
- $dossier=$http->request("gDossier","string", -1);
- if ($dossier == -1 ) return true;
-
- /**
- * Compare max value in repo
- */
- $repo =new Database();
- $date=date('Ymd');
- // get max email
- $max_email = $this->get_max_email($repo,$dossier);
- //
- // This folder cannot send email
- if ($max_email == 0 ) return false;
- //
- // This folder has unlimited email
- if ($max_email == -1 ) return true;
-
- // get email sent today from account_repository
- $email_sent = $this->get_email_sent($repo,$dossier , $date);
- //
- if ( $email_sent >= $max_email) return false;
-
- return true;
- }
- /**
- * return max email the folder can send
- * @param $p_repo Database
- * @param $p_dossier_id int
- */
- function get_max_email(Database $p_repo,$p_dossier_id)
- {
- $max_email = $p_repo->get_value("select dos_email from ac_dossier where dos_id=$1",
- array($p_dossier_id));
- return $max_email;
- }
- /**
- * Return the amount of send emails for the date (YYYYMMDD)
- * @param Database $p_repo
- * @param $p_dossier_id int
- * @param $p_date string YYYYMMDD
- */
- function get_email_sent(Database $p_repo,$p_dossier_id,$p_date)
- {
-
- $email_sent = $p_repo->get_value ('select de_sent_email from dossier_sent_email where dos_id = $1 and de_date=$2',
- array($p_dossier_id,$p_date));
- return $email_sent;
-
-
- }
- /**
- * Add $p_amount_email to email sent
- * @param $p_repo Database
- * @param $p_dossier int id of the folder (dossier.dos_id)
- * @param $p_date string (YYYYMMDD)
- */
- function increment_mail(Database $p_repo,$p_dossier,$p_date)
- {
- if ( $p_dossier == -1) return ;
- $email_sent = $this->get_email_sent($p_repo,$p_dossier,$p_date);
- if ( $email_sent == 0 ){
- $p_repo->exec_sql("insert into public.dossier_sent_email(de_sent_email,dos_id,de_date) values($1,$2,$3)",
- array(1,$p_dossier,$p_date));
- return;
- } else {
- // update + sp_emaoun_email
- $p_repo->exec_sql("update dossier_sent_email set de_sent_email=de_sent_email+1 where dos_id=$1 and de_date=$2",
- array($p_dossier,$p_date));
- }
- }
-
}
diff --git a/include/lib/single_record.class.php b/include/lib/single_record.class.php
index 0405ed313..a807ba918 100644
--- a/include/lib/single_record.class.php
+++ b/include/lib/single_record.class.php
@@ -23,7 +23,7 @@
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
define ('CODE_EXCP_DUPLICATE',901);
/**
* @brief Objec to check a double insert into the database, this duplicate occurs after
diff --git a/include/lib/user_common.php b/include/lib/user_common.php
index c3166e7be..5c77c616c 100644
--- a/include/lib/user_common.php
+++ b/include/lib/user_common.php
@@ -23,7 +23,7 @@
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/icheckbox.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
require_once NOALYSS_INCLUDE.'/class/document.class.php';
diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php
index 73b2a442e..d9dc4e593 100644
--- a/include/param_pcmn.inc.php
+++ b/include/param_pcmn.inc.php
@@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/lib/function_javascript.php';
$http=new HttpInput();
$gDossier=dossier::id();
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
/* Admin. Dossier */
$cn=Dossier::connect();
diff --git a/include/param_sec.inc.php b/include/param_sec.inc.php
index 43d7af706..244769209 100644
--- a/include/param_sec.inc.php
+++ b/include/param_sec.inc.php
@@ -27,7 +27,7 @@ require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/sort_table.class.php';
require_once NOALYSS_INCLUDE.'/lib/inplace_edit.class.php';
require_once NOALYSS_INCLUDE.'/lib/inplace_switch.class.php';
diff --git a/include/periode.inc.php b/include/periode.inc.php
index 3feaad465..36791c454 100644
--- a/include/periode.inc.php
+++ b/include/periode.inc.php
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
-/* ! \file
+/*! \file
* \brief add, modify, close or delete a period
*/
if (!defined('ALLOWED'))
diff --git a/include/preod.inc.php b/include/preod.inc.php
index 81a5a9c99..f0bff977f 100644
--- a/include/preod.inc.php
+++ b/include/preod.inc.php
@@ -26,7 +26,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/lib/iselect.class.php';
require_once NOALYSS_INCLUDE.'/lib/icheckbox.class.php';
require_once NOALYSS_INCLUDE.'/lib/ihidden.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
require_once NOALYSS_INCLUDE.'/class/pre_operation.class.php';
global $http;
diff --git a/include/recover.php b/include/recover.php
index a1eaaa4eb..ec082d1fc 100644
--- a/include/recover.php
+++ b/include/recover.php
@@ -63,8 +63,8 @@ if ($action=="") :
set_from(ADMIN_WEB);
$mail->mailto($user_email);
$mail->set_subject("NOALYSS : Réinitialisation de mot de passe");
+ $noalyss_url=NOALYSS_URL;
$message=<<request("req","string", "");
if (strlen(trim($request_id))==SIZE_REQUEST) :
- require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+ require_once NOALYSS_INCLUDE.'/class/database.class.php';
$cn=new Database(0);
$value=$cn->get_value("select password from recover_pass where request=$1 and created_on > now() - interval '12 hours' and recover_on is null", array($request_id));
diff --git a/include/report.inc.php b/include/report.inc.php
index 143444d56..fc5212654 100644
--- a/include/report.inc.php
+++ b/include/report.inc.php
@@ -29,7 +29,7 @@ require_once NOALYSS_INCLUDE.'/lib/ifile.class.php';
require_once NOALYSS_INCLUDE.'/lib/ibutton.class.php';
require_once NOALYSS_INCLUDE.'/class/acc_report.class.php';
require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/lib/ipopup.class.php';
global $http;
diff --git a/include/template/acc_ledger_history_financial_oneline.php b/include/template/acc_ledger_history_financial_oneline.php
index 10d2c81bd..42f820ab7 100644
--- a/include/template/acc_ledger_history_financial_oneline.php
+++ b/include/template/acc_ledger_history_financial_oneline.php
@@ -7,7 +7,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/template/acc_ledger_history_purchase_detail.php b/include/template/acc_ledger_history_purchase_detail.php
index d563af211..02d4fae07 100644
--- a/include/template/acc_ledger_history_purchase_detail.php
+++ b/include/template/acc_ledger_history_purchase_detail.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/template/acc_ledger_history_purchase_extended.php b/include/template/acc_ledger_history_purchase_extended.php
index a009428de..f229d5c3f 100644
--- a/include/template/acc_ledger_history_purchase_extended.php
+++ b/include/template/acc_ledger_history_purchase_extended.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/template/acc_ledger_history_purchase_oneline.php b/include/template/acc_ledger_history_purchase_oneline.php
index 8b941abbf..da9c5b460 100644
--- a/include/template/acc_ledger_history_purchase_oneline.php
+++ b/include/template/acc_ledger_history_purchase_oneline.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/template/acc_ledger_history_sale_detail.php b/include/template/acc_ledger_history_sale_detail.php
index e747884a3..320632115 100644
--- a/include/template/acc_ledger_history_sale_detail.php
+++ b/include/template/acc_ledger_history_sale_detail.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/template/acc_ledger_history_sale_extended.php b/include/template/acc_ledger_history_sale_extended.php
index a9a76c6c6..97157fd0b 100644
--- a/include/template/acc_ledger_history_sale_extended.php
+++ b/include/template/acc_ledger_history_sale_extended.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/upgrade-core.php b/include/upgrade-core.php
index 8ccd967fd..7ff0e5284 100644
--- a/include/upgrade-core.php
+++ b/include/upgrade-core.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/upgrade-plugin.php b/include/upgrade-plugin.php
index d557e7cdf..099db9f73 100644
--- a/include/upgrade-plugin.php
+++ b/include/upgrade-plugin.php
@@ -7,7 +7,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/upgrade-template.php b/include/upgrade-template.php
index 3176d32fc..95eea01f1 100644
--- a/include/upgrade-template.php
+++ b/include/upgrade-template.php
@@ -7,7 +7,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/include/user_detail.inc.php b/include/user_detail.inc.php
index 8a37b1e40..8740238c8 100644
--- a/include/user_detail.inc.php
+++ b/include/user_detail.inc.php
@@ -22,7 +22,7 @@
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
-require_once NOALYSS_INCLUDE.'/lib/database.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
require_once NOALYSS_INCLUDE.'/lib/user_menu.php';
require_once NOALYSS_INCLUDE.'/class/user.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
diff --git a/scenario/FicheTest.php b/scenario/FicheTest.php
index 6e5c651da..b1970ec93 100644
--- a/scenario/FicheTest.php
+++ b/scenario/FicheTest.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/acc_ledger_AccountTest.php b/scenario/acc_ledger_AccountTest.php
index cc09e95c9..02be61717 100644
--- a/scenario/acc_ledger_AccountTest.php
+++ b/scenario/acc_ledger_AccountTest.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/acc_ledger_historyTest.php b/scenario/acc_ledger_historyTest.php
index 7337b8ca6..62dd95791 100644
--- a/scenario/acc_ledger_historyTest.php
+++ b/scenario/acc_ledger_historyTest.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/ajax_acc_plan_mtable.php b/scenario/ajax_acc_plan_mtable.php
index 935bde297..c782969ca 100644
--- a/scenario/ajax_acc_plan_mtable.php
+++ b/scenario/ajax_acc_plan_mtable.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/ajax_manage_table_sql.php b/scenario/ajax_manage_table_sql.php
index 83c1b4714..d7401060b 100644
--- a/scenario/ajax_manage_table_sql.php
+++ b/scenario/ajax_manage_table_sql.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/create-database.php b/scenario/create-database.php
index 6cd9b482f..02d2307af 100644
--- a/scenario/create-database.php
+++ b/scenario/create-database.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/html_tab.test.php b/scenario/html_tab.test.php
index f47ebd6bc..f629ef7ba 100644
--- a/scenario/html_tab.test.php
+++ b/scenario/html_tab.test.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/package_repository.test.php b/scenario/package_repository.test.php
index 5c14014b5..870015437 100644
--- a/scenario/package_repository.test.php
+++ b/scenario/package_repository.test.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/test_acc_plan_mtable.php b/scenario/test_acc_plan_mtable.php
index 383f63260..6c3840fd1 100644
--- a/scenario/test_acc_plan_mtable.php
+++ b/scenario/test_acc_plan_mtable.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/test_manage_table_sql.php b/scenario/test_manage_table_sql.php
index b342606cc..bfc4ae8ed 100644
--- a/scenario/test_manage_table_sql.php
+++ b/scenario/test_manage_table_sql.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/scenario/tva_parameter.php b/scenario/tva_parameter.php
index d721c5116..72154e8be 100644
--- a/scenario/tva_parameter.php
+++ b/scenario/tva_parameter.php
@@ -8,7 +8,7 @@
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * PhpCompta is distributed in the hope that it will be useful,
+ * NOALYSS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
diff --git a/unit-test/README b/unit-test/README
index 119aedde6..0aa553d9c 100644
--- a/unit-test/README
+++ b/unit-test/README
@@ -27,3 +27,11 @@ Permet de voir les lignes de code qui ont été testées
php /phpunit.phar --coverage-html html --bootstrap bootstrap.php include
exemple depuis NETBEANS "/usr/bin/php" "/home/dany/Program/phpunit-skelgen.phar" "--ansi" "generate-test" "--bootstrap=/home/dany/developpement/phpcompta/noalyss/unit-test/bootstrap.php" "View_SQL" "/home/dany/developpement/phpcompta/noalyss/include/lib/view_sql.class.php" "View_SQLTest" "/home/dany/developpement/phpcompta/noalyss/unit-test/include/lib/view_sql.classTest.php"
+
+Pour avoir tous les fichiers à inclure
+=========================================
+Depuis ici, faites
+
+cd ../include
+
+find class lib -type f | awk '{print "require_once NOALYSS_INCLUDE.--""--;";}'|sed -e 's/--/"/g' >> ../unit-test/bootstrap.php
diff --git a/unit-test/bootstrap.php.example b/unit-test/bootstrap.php.example
index 2d4bb8a12..fc3f769a8 100644
--- a/unit-test/bootstrap.php.example
+++ b/unit-test/bootstrap.php.example
@@ -150,3 +150,167 @@ require_once NOALYSS_INCLUDE.'/class/class_user.php';
require_once NOALYSS_INCLUDE.'/lib/class_zip_extended.php';
+require_once NOALYSS_INCLUDE."class/package_repository.class.php";
+require_once NOALYSS_INCLUDE."class/acc_compute.class.php";
+require_once NOALYSS_INCLUDE."class/sendmail.class.php";
+require_once NOALYSS_INCLUDE."class/fiche_attr.class.php";
+require_once NOALYSS_INCLUDE."class/acc_report.class.php";
+require_once NOALYSS_INCLUDE."class/database.class.php";
+require_once NOALYSS_INCLUDE."class/gestion_table.class.php";
+require_once NOALYSS_INCLUDE."class/acc_report_row.class.php";
+require_once NOALYSS_INCLUDE."class/package_core.class.php";
+require_once NOALYSS_INCLUDE."class/print_ledger.class.php";
+require_once NOALYSS_INCLUDE."class/pre_op_ods.class.php";
+require_once NOALYSS_INCLUDE."class/anc_table.class.php";
+require_once NOALYSS_INCLUDE."class/pdfbalance_simple.class.php";
+require_once NOALYSS_INCLUDE."class/tag.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_purchase.class.php";
+require_once NOALYSS_INCLUDE."class/lettering.class.php";
+require_once NOALYSS_INCLUDE."class/profile_menu.class.php";
+require_once NOALYSS_INCLUDE."class/forecast_cat.class.php";
+require_once NOALYSS_INCLUDE."class/anc_operation.class.php";
+require_once NOALYSS_INCLUDE."class/print_ledger_fin.class.php";
+require_once NOALYSS_INCLUDE."class/acc_bilan.class.php";
+require_once NOALYSS_INCLUDE."class/pre_op_ach.class.php";
+require_once NOALYSS_INCLUDE."class/exercice.class.php";
+require_once NOALYSS_INCLUDE."class/document_export.class.php";
+require_once NOALYSS_INCLUDE."class/admin.class.php";
+require_once NOALYSS_INCLUDE."class/class_print_ledger_misc.php.rej";
+require_once NOALYSS_INCLUDE."class/acc_payment.class.php";
+require_once NOALYSS_INCLUDE."class/acc_reconciliation.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_history_generic.class.php";
+require_once NOALYSS_INCLUDE."class/template_card_category.class.php";
+require_once NOALYSS_INCLUDE."class/print_ledger_simple.class.php";
+require_once NOALYSS_INCLUDE."class/anc_account_table.class.php";
+require_once NOALYSS_INCLUDE."class/todo_list.class.php";
+require_once NOALYSS_INCLUDE."class/supplier.class.php";
+require_once NOALYSS_INCLUDE."class/document.class.php";
+require_once NOALYSS_INCLUDE."class/periode.class.php";
+require_once NOALYSS_INCLUDE."class/fiche_def_ref.class.php";
+require_once NOALYSS_INCLUDE."class/anc_acc_link.class.php";
+require_once NOALYSS_INCLUDE."class/noalyss_parameter_folder.class.php";
+require_once NOALYSS_INCLUDE."class/extension.class.php";
+require_once NOALYSS_INCLUDE."class/pre_op_fin.class.php";
+require_once NOALYSS_INCLUDE."class/forecast_item.class.php";
+require_once NOALYSS_INCLUDE."class/manager.class.php";
+require_once NOALYSS_INCLUDE."class/anc_group_operation.class.php";
+require_once NOALYSS_INCLUDE."class/user.class.php";
+require_once NOALYSS_INCLUDE."class/menu_ref.class.php";
+require_once NOALYSS_INCLUDE."class/print_ledger_detail_item.class.php";
+require_once NOALYSS_INCLUDE."class/anc_plan.class.php";
+require_once NOALYSS_INCLUDE."class/anc_key.class.php";
+require_once NOALYSS_INCLUDE."class/gestion_purchase.class.php";
+require_once NOALYSS_INCLUDE."class/stock_goods.class.php";
+require_once NOALYSS_INCLUDE."class/anc_balance_double.class.php";
+require_once NOALYSS_INCLUDE."class/acc_account.class.php";
+require_once NOALYSS_INCLUDE."class/default_menu.class.php";
+require_once NOALYSS_INCLUDE."class/follow_up.class.php";
+require_once NOALYSS_INCLUDE."class/pre_operation.class.php";
+require_once NOALYSS_INCLUDE."class/class_acc_ledger.php.orig";
+require_once NOALYSS_INCLUDE."class/acc_balance.class.php";
+require_once NOALYSS_INCLUDE."class/anc_balance_simple.class.php";
+require_once NOALYSS_INCLUDE."class/anc_acc_list.class.php";
+require_once NOALYSS_INCLUDE."class/dossier.class.php";
+require_once NOALYSS_INCLUDE."class/anc_print.class.php";
+require_once NOALYSS_INCLUDE."class/print_ledger_simple_without_vat.class.php";
+require_once NOALYSS_INCLUDE."class/gestion_sold.class.php";
+require_once NOALYSS_INCLUDE."class/balance_age.class.php";
+require_once NOALYSS_INCLUDE."class/anc_group.class.php";
+require_once NOALYSS_INCLUDE."class/print_ledger_misc.class.php";
+require_once NOALYSS_INCLUDE."class/periode_ledger_table.class.php";
+require_once NOALYSS_INCLUDE."class/package_noalyss.class.php";
+require_once NOALYSS_INCLUDE."class/calendar.class.php";
+require_once NOALYSS_INCLUDE."class/forecast.class.php";
+require_once NOALYSS_INCLUDE."class/pdf.class.php";
+require_once NOALYSS_INCLUDE."class/package_template.class.php";
+require_once NOALYSS_INCLUDE."class/class_periode.php.orig";
+require_once NOALYSS_INCLUDE."class/package_plugin.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger.class.php";
+require_once NOALYSS_INCLUDE."class/tva_rate_mtable.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_fin.class.php";
+require_once NOALYSS_INCLUDE."class/print_ledger_detail.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_history_financial.class.php";
+require_once NOALYSS_INCLUDE."class/stock.class.php";
+require_once NOALYSS_INCLUDE."class/anc_listing.class.php";
+require_once NOALYSS_INCLUDE."class/anc_grandlivre.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_history.class.php";
+require_once NOALYSS_INCLUDE."class/customer.class.php";
+require_once NOALYSS_INCLUDE."class/fiche.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_info.class.php";
+require_once NOALYSS_INCLUDE."class/Acc_Account_LedgerTest.php";
+require_once NOALYSS_INCLUDE."class/class_print_ledger_misc.php.orig";
+require_once NOALYSS_INCLUDE."class/class_acc_ledger.php.rej";
+require_once NOALYSS_INCLUDE."class/package_contrib.class.php";
+require_once NOALYSS_INCLUDE."class/acc_parm_code.class.php";
+require_once NOALYSS_INCLUDE."class/acc_plan_mtable.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_history_sale.class.php";
+require_once NOALYSS_INCLUDE."class/pdf_operation.class.php";
+require_once NOALYSS_INCLUDE."class/periode_ledger.class.php";
+require_once NOALYSS_INCLUDE."class/contact.class.php";
+require_once NOALYSS_INCLUDE."class/pre_op_advanced.class.php";
+require_once NOALYSS_INCLUDE."class/document_type.class.php";
+require_once NOALYSS_INCLUDE."class/bank.class.php";
+require_once NOALYSS_INCLUDE."class/fiche_def.class.php";
+require_once NOALYSS_INCLUDE."class/acc_tva.class.php";
+require_once NOALYSS_INCLUDE."class/acc_operation.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_sold.class.php";
+require_once NOALYSS_INCLUDE."class/pdf_land.class.php";
+require_once NOALYSS_INCLUDE."class/pre_op_ven.class.php";
+require_once NOALYSS_INCLUDE."class/acc_account_ledger.class.php";
+require_once NOALYSS_INCLUDE."class/follow_up_detail.class.php";
+require_once NOALYSS_INCLUDE."class/class_periode.php.rej";
+require_once NOALYSS_INCLUDE."class/acc_ledger_history_purchase.class.php";
+require_once NOALYSS_INCLUDE."class/anticipation.class.php";
+require_once NOALYSS_INCLUDE."class/document_modele.class.php";
+require_once NOALYSS_INCLUDE."class/acc_ledger_search.class.php";
+require_once NOALYSS_INCLUDE."lib/irelated_action.class.php";
+require_once NOALYSS_INCLUDE."lib/http_input.class.php";
+require_once NOALYSS_INCLUDE."lib/zip_extended.class.php";
+require_once NOALYSS_INCLUDE."lib/sendmail_core.class.php";
+require_once NOALYSS_INCLUDE."lib/iperiod.class.php";
+require_once NOALYSS_INCLUDE."lib/single_record.class.php";
+require_once NOALYSS_INCLUDE."lib/icard.class.php";
+require_once NOALYSS_INCLUDE."lib/data_sql.class.php";
+require_once NOALYSS_INCLUDE."lib/ac_common.php";
+require_once NOALYSS_INCLUDE."lib/inplace_edit.class.php";
+require_once NOALYSS_INCLUDE."lib/noalyss_sql.class.php";
+require_once NOALYSS_INCLUDE."lib/iselect.class.php.orig";
+require_once NOALYSS_INCLUDE."lib/ibutton.class.php";
+require_once NOALYSS_INCLUDE."lib/user_common.php";
+require_once NOALYSS_INCLUDE."lib/icon_action.class.php";
+require_once NOALYSS_INCLUDE."lib/sort_table.class.php";
+require_once NOALYSS_INCLUDE."lib/ac_common.php.orig";
+require_once NOALYSS_INCLUDE."lib/iradio.class.php";
+require_once NOALYSS_INCLUDE."lib/ianccard.class.php";
+require_once NOALYSS_INCLUDE."lib/ispan.class.php";
+require_once NOALYSS_INCLUDE."lib/message_javascript.php";
+require_once NOALYSS_INCLUDE."lib/iconcerned.class.php";
+require_once NOALYSS_INCLUDE."lib/itva_popup.class.php";
+require_once NOALYSS_INCLUDE."lib/html_table.class.php";
+require_once NOALYSS_INCLUDE."lib/inplace_switch.class.php";
+require_once NOALYSS_INCLUDE."lib/noalyss_csv.class.php";
+require_once NOALYSS_INCLUDE."lib/database_core.class.php";
+require_once NOALYSS_INCLUDE."lib/html_input.class.php";
+require_once NOALYSS_INCLUDE."lib/function_javascript.php";
+require_once NOALYSS_INCLUDE."lib/iselect.class.php";
+require_once NOALYSS_INCLUDE."lib/iposte.class.php";
+require_once NOALYSS_INCLUDE."lib/select_box.class.php";
+require_once NOALYSS_INCLUDE."lib/ifile.class.php";
+require_once NOALYSS_INCLUDE."lib/output_html_tab.class.php";
+require_once NOALYSS_INCLUDE."lib/user_menu.php";
+require_once NOALYSS_INCLUDE."lib/html_tab.class.php";
+require_once NOALYSS_INCLUDE."lib/idate.class.php";
+require_once NOALYSS_INCLUDE."lib/itext.class.php";
+require_once NOALYSS_INCLUDE."lib/ac_common.php.rej";
+require_once NOALYSS_INCLUDE."lib/pdf_core.class.php";
+require_once NOALYSS_INCLUDE."lib/progress_bar.class.php";
+require_once NOALYSS_INCLUDE."lib/config_file.php";
+require_once NOALYSS_INCLUDE."lib/impress.class.php";
+require_once NOALYSS_INCLUDE."lib/iaction.class.php";
+require_once NOALYSS_INCLUDE."lib/inum.class.php";
+require_once NOALYSS_INCLUDE."lib/ipopup.class.php";
+require_once NOALYSS_INCLUDE."lib/icheckbox.class.php";
+require_once NOALYSS_INCLUDE."lib/itextarea.class.php";
+require_once NOALYSS_INCLUDE."lib/filetosend.class.php";
+require_once NOALYSS_INCLUDE."lib/ihidden.class.php";
+require_once NOALYSS_INCLUDE."lib/manage_table_sql.class.php";