phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r5216 - in phpcompta/trunk: . contrib/document_test doc


From: phpcompta-dev
Subject: [Phpcompta-dev] r5216 - in phpcompta/trunk: . contrib/document_test doc doc/developper html html/admin html/admin/sql/mod2 html/admin/sql/patch html/document/fr_be html/js html/js/lang include include/template include/tfpdf sql
Date: Sat, 4 May 2013 00:31:42 +0200 (CEST)

Author: danydb
Date: 2013-05-04 00:31:33 +0200 (Sat, 04 May 2013)
New Revision: 5216

Added:
   phpcompta/trunk/html/admin/sql/patch/upgrade103.sql
   phpcompta/trunk/html/admin/sql/patch/upgrade104.sql
   phpcompta/trunk/html/admin/sql/patch/upgrade105.sql
   phpcompta/trunk/html/js/nicEdit.js
   phpcompta/trunk/html/js/nicEditorIcons.gif
   phpcompta/trunk/html/js/sorttable.js
   phpcompta/trunk/include/ajax_boxcard_search.php
   phpcompta/trunk/include/ajax_view_action.php
   phpcompta/trunk/include/template/operation_detail_ach.php
   phpcompta/trunk/include/template/operation_detail_fin.php
   phpcompta/trunk/include/template/operation_detail_misc.php
   phpcompta/trunk/include/template/operation_detail_ven.php
Modified:
   phpcompta/trunk/
   phpcompta/trunk/contrib/document_test/
   phpcompta/trunk/contrib/document_test/all_tags.odt
   phpcompta/trunk/doc/developper/Doxyfile
   phpcompta/trunk/doc/manuel-fr.odt
   phpcompta/trunk/doc/manuel-fr.pdf
   phpcompta/trunk/html/admin/setup.php
   phpcompta/trunk/html/admin/sql/mod2/data.sql
   phpcompta/trunk/html/ajax_card.php
   phpcompta/trunk/html/ajax_history.php
   phpcompta/trunk/html/ajax_ledger.php
   phpcompta/trunk/html/ajax_misc.php
   phpcompta/trunk/html/ajax_poste.php
   phpcompta/trunk/html/do.php
   phpcompta/trunk/html/document/fr_be/bnb.form
   phpcompta/trunk/html/js/acc_ledger.js
   phpcompta/trunk/html/js/accounting_item.js
   phpcompta/trunk/html/js/anc_script.js
   phpcompta/trunk/html/js/card.js
   phpcompta/trunk/html/js/infobulle.js
   phpcompta/trunk/html/js/lang/calendar-al.js
   phpcompta/trunk/html/js/lang/calendar-he-utf8.js
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/html/show_document.php
   phpcompta/trunk/html/style-color.css
   phpcompta/trunk/html/style-epad.css
   phpcompta/trunk/html/style-light.css
   phpcompta/trunk/html/style-print.css
   phpcompta/trunk/html/style-test.css
   phpcompta/trunk/html/style.css
   phpcompta/trunk/include/ac_common.php
   phpcompta/trunk/include/action.common.inc.php
   phpcompta/trunk/include/action.inc.php
   phpcompta/trunk/include/ajax_add_menu.php
   phpcompta/trunk/include/ajax_get_menu_detail.php
   phpcompta/trunk/include/ajax_get_profile.php
   phpcompta/trunk/include/ajax_mod_document.php
   phpcompta/trunk/include/ajax_mod_periode.php
   phpcompta/trunk/include/ajax_mod_predf_op.php
   phpcompta/trunk/include/category_followup.inc.php
   phpcompta/trunk/include/class_acc_account_ledger.php
   phpcompta/trunk/include/class_acc_balance.php
   phpcompta/trunk/include/class_acc_compute.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_ledger_fin.php
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/class_acc_ledger_sold.php
   phpcompta/trunk/include/class_acc_operation.php
   phpcompta/trunk/include/class_acc_payment.php
   phpcompta/trunk/include/class_anticipation.php
   phpcompta/trunk/include/class_calendar.php
   phpcompta/trunk/include/class_database.php
   phpcompta/trunk/include/class_document.php
   phpcompta/trunk/include/class_document_type.php
   phpcompta/trunk/include/class_exercice.php
   phpcompta/trunk/include/class_fiche.php
   phpcompta/trunk/include/class_fiche_def.php
   phpcompta/trunk/include/class_follow_up.php
   phpcompta/trunk/include/class_html_input.php
   phpcompta/trunk/include/class_iaction.php
   phpcompta/trunk/include/class_ianccard.php
   phpcompta/trunk/include/class_ibutton.php
   phpcompta/trunk/include/class_icard.php
   phpcompta/trunk/include/class_icheckbox.php
   phpcompta/trunk/include/class_iconcerned.php
   phpcompta/trunk/include/class_idate.php
   phpcompta/trunk/include/class_ihidden.php
   phpcompta/trunk/include/class_impress.php
   phpcompta/trunk/include/class_inum.php
   phpcompta/trunk/include/class_iperiod.php
   phpcompta/trunk/include/class_iposte.php
   phpcompta/trunk/include/class_iradio.php
   phpcompta/trunk/include/class_irelated_action.php
   phpcompta/trunk/include/class_iselect.php
   phpcompta/trunk/include/class_itext.php
   phpcompta/trunk/include/class_itextarea.php
   phpcompta/trunk/include/class_itva_popup.php
   phpcompta/trunk/include/class_lettering.php
   phpcompta/trunk/include/class_periode.php
   phpcompta/trunk/include/class_phpcompta_sql.php
   phpcompta/trunk/include/class_print_ledger_fin.php
   phpcompta/trunk/include/class_print_ledger_simple.php
   phpcompta/trunk/include/class_print_ledger_simple_without_vat.php
   phpcompta/trunk/include/class_profile_menu.php
   phpcompta/trunk/include/class_tool_uos.php
   phpcompta/trunk/include/class_user.php
   phpcompta/trunk/include/client.inc.php
   phpcompta/trunk/include/compta_ach.inc.php
   phpcompta/trunk/include/compta_fin.inc.php
   phpcompta/trunk/include/compta_fin_rec.inc.php
   phpcompta/trunk/include/compta_fin_saldo.inc.php
   phpcompta/trunk/include/compta_ods.inc.php
   phpcompta/trunk/include/compta_ven.inc.php
   phpcompta/trunk/include/config_file.php
   phpcompta/trunk/include/constant.php
   phpcompta/trunk/include/contact.inc.php
   phpcompta/trunk/include/doc_state.inc.php
   phpcompta/trunk/include/dossier.inc.php
   phpcompta/trunk/include/export_balance_pdf.php
   phpcompta/trunk/include/export_fiche_balance_csv.php
   phpcompta/trunk/include/export_fiche_balance_pdf.php
   phpcompta/trunk/include/export_fiche_detail_csv.php
   phpcompta/trunk/include/export_fiche_detail_pdf.php
   phpcompta/trunk/include/export_fiche_pdf.php
   phpcompta/trunk/include/export_histo_csv.php
   phpcompta/trunk/include/export_poste_detail_csv.php
   phpcompta/trunk/include/export_poste_detail_pdf.php
   phpcompta/trunk/include/fiche.inc.php
   phpcompta/trunk/include/forecast.inc.php
   phpcompta/trunk/include/function_javascript.php
   phpcompta/trunk/include/history_operation.inc.php
   phpcompta/trunk/include/impress_gl_comptes.inc.php
   phpcompta/trunk/include/impress_jrn.inc.php
   phpcompta/trunk/include/impress_poste.inc.php
   phpcompta/trunk/include/lettering.account.inc.php
   phpcompta/trunk/include/lettering.card.inc.php
   phpcompta/trunk/include/menu.inc.php
   phpcompta/trunk/include/modele.inc.php
   phpcompta/trunk/include/opening.inc.php
   phpcompta/trunk/include/operation_ods_confirm.inc.php
   phpcompta/trunk/include/operation_ods_new.inc.php
   phpcompta/trunk/include/param_pcmn.inc.php
   phpcompta/trunk/include/param_sec.inc.php
   phpcompta/trunk/include/pref.inc.php
   phpcompta/trunk/include/profile.inc.php
   phpcompta/trunk/include/search.inc.php
   phpcompta/trunk/include/template/action_search.php
   phpcompta/trunk/include/template/dashboard.php
   phpcompta/trunk/include/template/detail-action.php
   phpcompta/trunk/include/template/document_mod_change.php
   phpcompta/trunk/include/template/fiche_list.php
   phpcompta/trunk/include/template/form_ledger_detail.php
   phpcompta/trunk/include/template/form_ledger_fin.php
   phpcompta/trunk/include/template/history_top.php
   phpcompta/trunk/include/template/ledger_detail_ach.php
   phpcompta/trunk/include/template/ledger_detail_bottom.php
   phpcompta/trunk/include/template/ledger_detail_fin.php
   phpcompta/trunk/include/template/ledger_detail_misc.php
   phpcompta/trunk/include/template/ledger_detail_top.php
   phpcompta/trunk/include/template/ledger_detail_ven.php
   phpcompta/trunk/include/template/letter_all.php
   phpcompta/trunk/include/template/letter_prop.php
   phpcompta/trunk/include/template/module.php
   phpcompta/trunk/include/template/periode_add_exercice.php
   phpcompta/trunk/include/template/search_top.php
   phpcompta/trunk/include/template/user_sec_profile.php
   phpcompta/trunk/include/tfpdf/tfpdf.php
   phpcompta/trunk/include/tva.inc.php
   phpcompta/trunk/include/user_detail.inc.php
   phpcompta/trunk/include/user_menu.php
   phpcompta/trunk/sql/upgrade.sql
Log:
Merged revisions 5056,5058-5206,5209-5215 via svnmerge from 
svn+ssh://address@hidden/svn/phpcompta/tags/rel650

........
  r5056 | danydb | 2012-06-30 14:39:28 +0200 (Sat, 30 Jun 2012) | 2 lines
  
  0000666: Limiter dans le tableau accueil, le calendrier ?\195?\160 exercice 
courant 
  0000667: DASHBOAD : agrandir les ?\195?\169l?\195?\169ments
........
  r5058 | danydb | 2012-06-30 18:43:34 +0200 (Sat, 30 Jun 2012) | 6 lines
  
  ------------------------------------------------------------------------
  r5057 | danydb | 2012-06-30 18:40:12 +0200 (Sat, 30 Jun 2012) | 1 line
  
  bug follow_up::get_late
  ------------------------------------------------------------------------
........
  r5059 | danydb | 2012-06-30 18:57:18 +0200 (Sat, 30 Jun 2012) | 1 line
  
  bug follow_up::get_late
........
  r5060 | danydb | 2012-06-30 18:58:55 +0200 (Sat, 30 Jun 2012) | 1 line
  
  bug follow_up::get_late
........
  r5061 | danydb | 2012-06-30 19:03:29 +0200 (Sat, 30 Jun 2012) | 1 line
  
  bug follow_up::get_late
........
  r5062 | danydb | 2012-06-30 19:36:51 +0200 (Sat, 30 Jun 2012) | 1 line
  
  bug follow_up::get_late
........
  r5063 | danydb | 2012-07-01 17:42:31 +0200 (Sun, 01 Jul 2012) | 1 line
  
  correct check_formula
........
  r5064 | danydb | 2012-07-03 00:56:38 +0200 (Tue, 03 Jul 2012) | 1 line
  
  Due to rewrite of parse formula, formula are not evaluated properly
........
  r5065 | danydb | 2012-07-08 20:58:45 +0200 (Sun, 08 Jul 2012) | 1 line
  
  Bug cannot create a new profile due a javascript error
........
  r5066 | danydb | 2012-07-09 18:43:20 +0200 (Mon, 09 Jul 2012) | 1 line
  
  0000674: Deux actions-gestion ne peuvent avoir le m?\195?\170me 
num?\195?\169ro de pi?\195?\168ce
........
  r5067 | danydb | 2012-07-10 12:34:55 +0200 (Tue, 10 Jul 2012) | 1 line
  
  duplicate Ref 
........
  r5068 | danydb | 2012-07-15 11:14:27 +0200 (Sun, 15 Jul 2012) | 2 lines
  
  New function : select exercice with end & start date
........
  r5069 | danydb | 2012-07-15 11:15:05 +0200 (Sun, 15 Jul 2012) | 2 lines
  
  Javascript var ask_global to reload window if it is <> 0
........
  r5070 | danydb | 2012-07-16 01:10:32 +0200 (Mon, 16 Jul 2012) | 1 line
  
  Fix bug in tool_uos
........
  r5071 | danydb | 2012-07-19 02:22:15 +0200 (Thu, 19 Jul 2012) | 1 line
  
  Improve printing of action - gestion
........
  r5072 | danydb | 2012-07-19 12:50:48 +0200 (Thu, 19 Jul 2012) | 2 lines
  
  0000672: Am?\195?\169lioration apparence
........
  r5073 | danydb | 2012-07-19 12:51:27 +0200 (Thu, 19 Jul 2012) | 2 lines
  
  Enl?\195?\168ve background blanc pour les notices
........
  r5074 | danydb | 2012-07-19 13:49:10 +0200 (Thu, 19 Jul 2012) | 1 line
  
  Improve printing of action - gestion
........
  r5075 | danydb | 2012-07-19 16:31:11 +0200 (Thu, 19 Jul 2012) | 1 line
  
  Add script for Javascript sort of table
........
  r5076 | danydb | 2012-07-19 17:52:24 +0200 (Thu, 19 Jul 2012) | 1 line
  
  Add script for Javascript sort of table
........
  r5077 | danydb | 2012-07-19 18:13:18 +0200 (Thu, 19 Jul 2012) | 1 line
  
  Add script for Javascript sort of table for reconciliation bank
........
  r5078 | danydb | 2012-07-20 14:55:50 +0200 (Fri, 20 Jul 2012) | 1 line
  
  Show default sorted column 
........
  r5079 | danydb | 2012-07-20 14:57:16 +0200 (Fri, 20 Jul 2012) | 1 line
  
  add documentation
........
  r5080 | danydb | 2012-07-26 17:31:54 +0200 (Thu, 26 Jul 2012) | 1 line
  
  Add ID 
........
  r5081 | danydb | 2012-07-29 13:56:59 +0200 (Sun, 29 Jul 2012) | 4 lines
  
  add new function 
  default_value_get
  default_value_post
  default_value_request
........
  r5082 | danydb | 2012-07-29 14:14:51 +0200 (Sun, 29 Jul 2012) | 1 line
  
  improve documentation
........
  r5083 | danydb | 2012-07-29 14:50:29 +0200 (Sun, 29 Jul 2012) | 1 line
  
  Add constant for year
........
  r5084 | danydb | 2012-07-29 15:08:11 +0200 (Sun, 29 Jul 2012) | 1 line
  
  Message for exercice
........
  r5085 | danydb | 2012-07-29 15:08:56 +0200 (Sun, 29 Jul 2012) | 1 line
  
  New constant for date range
........
  r5086 | danydb | 2012-07-30 20:13:30 +0200 (Mon, 30 Jul 2012) | 1 line
  
  cosmetic
........
  r5087 | danydb | 2012-07-30 20:38:17 +0200 (Mon, 30 Jul 2012) | 1 line
  
  cosmetic
........
  r5088 | danydb | 2012-07-30 21:28:46 +0200 (Mon, 30 Jul 2012) | 1 line
  
  define max_card_search
........
  r5089 | danydb | 2012-07-30 21:36:55 +0200 (Mon, 30 Jul 2012) | 1 line
  
  0000695: ajout d'un bouton pour chercher une fiche
........
  r5090 | danydb | 2012-07-30 21:42:06 +0200 (Mon, 30 Jul 2012) | 1 line
  
  Am?\195?\169lioration recherche
........
  r5091 | danydb | 2012-07-30 21:44:23 +0200 (Mon, 30 Jul 2012) | 1 line
  
  Am?\195?\169lioration recherche
........
  r5092 | danydb | 2012-08-23 20:29:52 +0200 (Thu, 23 Aug 2012) | 1 line
  
  add a field hidden
........
  r5093 | danydb | 2012-08-23 22:52:06 +0200 (Thu, 23 Aug 2012) | 2 lines
  
  0000705: Perte info lettrage lors de l'export .csv
  Nom de fichier comprennent la date et le poste comptable
........
  r5094 | danydb | 2012-08-23 23:00:58 +0200 (Thu, 23 Aug 2012) | 1 line
  
  0000700: CARD : historique, Dans le PDF, il manque le quick code et dans le 
CSV, il manque le nom
........
  r5095 | danydb | 2012-08-23 23:06:00 +0200 (Thu, 23 Aug 2012) | 1 line
  
  recherche aussi sur quick-code
........
  r5096 | danydb | 2012-08-23 23:20:32 +0200 (Thu, 23 Aug 2012) | 1 line
  
  #699 CARD : liste des fiches 
........
  r5097 | danydb | 2012-08-24 22:27:20 +0200 (Fri, 24 Aug 2012) | 1 line
  
  replace ob_clean by ob_end_clean
........
  r5098 | danydb | 2012-09-04 19:55:56 +0200 (Tue, 04 Sep 2012) | 1 line
  
  ajout ag_ref dans action aujourd'hui et action en retard
........
  r5099 | danydb | 2012-09-06 18:47:29 +0200 (Thu, 06 Sep 2012) | 1 line
  
  0000721: Nouveaux tag pour les stocks dans g?\195?\169n?\195?\169ration de 
documents
........
  r5100 | danydb | 2012-09-12 23:05:12 +0200 (Wed, 12 Sep 2012) | 1 line
  
  fix bug : when a value is empty then value is n ull
........
  r5101 | danydb | 2012-09-15 00:30:02 +0200 (Sat, 15 Sep 2012) | 1 line
  
  fix : missing closing tag </a>
........
  r5102 | danydb | 2012-09-15 15:22:08 +0200 (Sat, 15 Sep 2012) | 1 line
  
  Show type of menu
........
  r5103 | danydb | 2012-09-15 17:39:55 +0200 (Sat, 15 Sep 2012) | 1 line
  
  Improve add menu printing
........
  r5104 | danydb | 2012-09-15 17:48:42 +0200 (Sat, 15 Sep 2012) | 1 line
  
  Improve the profile configuration
........
  r5105 | danydb | 2012-09-16 03:01:44 +0200 (Sun, 16 Sep 2012) | 1 line
  
  Improve the style sheet with hx.title
........
  r5106 | danydb | 2012-09-16 18:40:59 +0200 (Sun, 16 Sep 2012) | 1 line
  
  bug : Impossible d'avoir impression GRAND LIVRE Pour compte non sold?\195?\169
........
  r5107 | danydb | 2012-09-16 18:53:59 +0200 (Sun, 16 Sep 2012) | 1 line
  
  Am?\195?\169liore apparence calculatrice
........
  r5108 | danydb | 2012-09-17 20:28:04 +0200 (Mon, 17 Sep 2012) | 1 line
  
  When adding a menu it cannot depend on itself
........
  r5109 | danydb | 2012-09-17 20:29:23 +0200 (Mon, 17 Sep 2012) | 1 line
  
  When adding a menu it cannot depend on itself (update)
........
  r5110 | danydb | 2012-09-17 20:46:17 +0200 (Mon, 17 Sep 2012) | 1 line
  
  Show default menu
........
  r5111 | danydb | 2012-09-17 20:55:13 +0200 (Mon, 17 Sep 2012) | 1 line
  
  bug : show default module
........
  r5112 | danydb | 2012-09-17 20:57:00 +0200 (Mon, 17 Sep 2012) | 1 line
  
  bug : show default module, otherwise menu
........
  r5113 | danydb | 2012-09-17 21:07:25 +0200 (Mon, 17 Sep 2012) | 1 line
  
  Default module otherwise try to find default menu if several results then 
returns the first one
........
  r5114 | danydb | 2012-09-17 21:13:43 +0200 (Mon, 17 Sep 2012) | 1 line
  
  Fix bug when clicking several times on search_poste
........
  r5115 | danydb | 2012-09-18 23:37:02 +0200 (Tue, 18 Sep 2012) | 1 line
  
  probl?\195?\168me quand utilisateur est administrateur global, impossible de 
voir les postes comptables
........
  r5116 | danydb | 2012-09-18 23:46:37 +0200 (Tue, 18 Sep 2012) | 1 line
  
  Improve the style sheet with hx.title
........
  r5117 | danydb | 2012-09-18 23:47:27 +0200 (Tue, 18 Sep 2012) | 1 line
  
  improve html widget with un ID
........
  r5118 | danydb | 2012-09-19 22:55:43 +0200 (Wed, 19 Sep 2012) | 1 line
  
  Bug locale must be in uppercase 
........
  r5119 | danydb | 2012-09-29 23:28:46 +0200 (Sat, 29 Sep 2012) | 1 line
  
  add the javascript function check_date and check_date_id
........
  r5120 | danydb | 2012-09-30 00:04:17 +0200 (Sun, 30 Sep 2012) | 1 line
  
  correct javascript function check_date_id
........
  r5121 | danydb | 2012-10-01 19:57:15 +0200 (Mon, 01 Oct 2012) | 1 line
  
  0000736: Totaux dans ?\195?\169cran
........
  r5122 | danydb | 2012-10-01 20:47:26 +0200 (Mon, 01 Oct 2012) | 1 line
  
  0000733: Impression op?\195?\169ration depuis POP ME OUT
........
  r5123 | danydb | 2012-10-01 20:47:56 +0200 (Mon, 01 Oct 2012) | 1 line
  
  Bug : id inconnu dans irelated_action
........
  r5124 | danydb | 2012-10-01 20:56:07 +0200 (Mon, 01 Oct 2012) | 1 line
  
  0000733: Impression op?\195?\169ration depuis POP ME OUT
........
  r5125 | danydb | 2012-10-01 20:58:53 +0200 (Mon, 01 Oct 2012) | 1 line
  
  bug css for select
........
  r5126 | danydb | 2012-10-01 21:07:00 +0200 (Mon, 01 Oct 2012) | 1 line
  
  0000732: Pouvoir imprimer les op?\195?\169rations avant confirmation
........
  r5127 | danydb | 2012-10-01 21:16:04 +0200 (Mon, 01 Oct 2012) | 1 line
  
  bug financier le nom de la banque n'est pas mis ?\195?\160 jour
........
  r5128 | danydb | 2012-10-01 21:23:16 +0200 (Mon, 01 Oct 2012) | 1 line
  
  CSS cosmetic nom de journal en h2.title
........
  r5129 | danydb | 2012-10-01 21:30:20 +0200 (Mon, 01 Oct 2012) | 1 line
  
  Grand Livre : surlign?\195?\169 ligne paire
........
  r5130 | danydb | 2012-10-01 22:03:42 +0200 (Mon, 01 Oct 2012) | 1 line
  
  CSS pr?\195?\169sentation, remplace fieldset
........
  r5131 | danydb | 2012-10-01 22:04:03 +0200 (Mon, 01 Oct 2012) | 1 line
  
  Ne surligne pas les actions clotur?\195?\169es
........
  r5132 | danydb | 2012-10-01 22:04:19 +0200 (Mon, 01 Oct 2012) | 1 line
  
  Les readonly sont en bleus
........
  r5133 | danydb | 2012-10-01 22:16:55 +0200 (Mon, 01 Oct 2012) | 1 line
  
  Bug in the search button if id was  not set
........
  r5134 | danydb | 2012-10-02 18:49:40 +0200 (Tue, 02 Oct 2012) | 1 line
  
  underline properly 
........
  r5135 | danydb | 2012-10-02 18:58:09 +0200 (Tue, 02 Oct 2012) | 3 lines
  
  Fix several some bugs : 
  * PRINTJRN column name for ledget ACH, simple without VAT
  * PRINTPOSTE show everything even when unlettered is choosen
........
  r5136 | danydb | 2012-10-02 18:58:34 +0200 (Tue, 02 Oct 2012) | 1 line
  
  Improve documentation
........
  r5137 | danydb | 2012-10-02 23:01:27 +0200 (Tue, 02 Oct 2012) | 1 line
  
  Fix problem with date suggest
........
  r5138 | danydb | 2012-10-03 11:27:52 +0200 (Wed, 03 Oct 2012) | 1 line
  
  Bug auto compute for action
........
  r5139 | danydb | 2012-10-16 00:58:52 +0200 (Tue, 16 Oct 2012) | 1 line
  
   Sugg?\195?\169rer la date = oui ne met plus la date ?\195?\160 jour dans les 
achats 
........
  r5140 | danydb | 2012-10-16 01:13:30 +0200 (Tue, 16 Oct 2012) | 1 line
  
  Sugg?\195?\169rer la date = oui ne met plus la date ?\195?\160 jour dans les 
achats
........
  r5141 | danydb | 2012-10-16 01:14:01 +0200 (Tue, 16 Oct 2012) | 1 line
  
  Sugg?\195?\169rer la date = oui ne met plus la date ?\195?\160 jour dans les 
achats
........
  r5142 | danydb | 2012-10-17 17:54:22 +0200 (Wed, 17 Oct 2012) | 1 line
  
  0000749: poste alphanum?\195?\169rique (fournisseur 44xxx)
........
  r5143 | danydb | 2012-10-20 19:13:04 +0200 (Sat, 20 Oct 2012) | 2 lines
  
  #754  Les totaux dans Pr?\195?\169visions 
  #753  Les totaux dans FOURNISSEUR, CLIENT et ADMINISTRATION incorrectes 
........
  r5144 | danydb | 2012-10-30 20:41:29 +0100 (Tue, 30 Oct 2012) | 1 line
  
  #372 syst?\195?\168me de nouvelles
........
  r5145 | danydb | 2012-10-30 20:42:45 +0100 (Tue, 30 Oct 2012) | 1 line
  
  add id to submit button
........
  r5146 | danydb | 2012-10-30 20:43:04 +0100 (Tue, 30 Oct 2012) | 1 line
  
  add a label to ibutton
........
  r5147 | danydb | 2012-10-30 20:43:43 +0100 (Tue, 30 Oct 2012) | 1 line
  
  add niceEdit.js
........
  r5148 | danydb | 2012-10-30 20:44:20 +0100 (Tue, 30 Oct 2012) | 1 line
  
  get_folder_access must also test global admin
........
  r5149 | danydb | 2012-10-30 22:14:26 +0100 (Tue, 30 Oct 2012) | 1 line
  
  0000755: Erreur en cr?\195?\169ation de fiche avec un compte (455) 
d?\195?\169j?\195?\160 utilis?\195?\169.
........
  r5150 | danydb | 2012-10-30 22:20:07 +0100 (Tue, 30 Oct 2012) | 2 lines
  
  0000744: (classe) 5Actif
  0000746: ajouter un espace l?\195?\160 o?\195?\185 il faut
........
  r5151 | danydb | 2012-10-30 22:25:19 +0100 (Tue, 30 Oct 2012) | 1 line
  
  0000743: le pointeur se trouve sur 'effacer'
........
  r5152 | danydb | 2012-11-11 20:47:20 +0100 (Sun, 11 Nov 2012) | 1 line
  
  0000756: Achat ou vente pour rembourser de la TVA, marchandise ou quant. = 0
........
  r5153 | danydb | 2012-11-11 20:51:40 +0100 (Sun, 11 Nov 2012) | 1 line
  
  0000750: place de nouvelle fiche et effacer
........
  r5154 | danydb | 2012-11-11 20:55:08 +0100 (Sun, 11 Nov 2012) | 1 line
  
  0000742: remplacer le mot 'classe ' par le mot ' poste (comptable)'
........
  r5155 | danydb | 2012-11-22 21:50:27 +0100 (Thu, 22 Nov 2012) | 1 line
  
  fix problem with french accounting
........
  r5156 | danydb | 2012-11-29 23:17:33 +0100 (Thu, 29 Nov 2012) | 1 line
  
  #738: Attribut en pourcent doit ?\195?\170tre compris entre 0 et 100 au lieu 
de 0 et 1
........
  r5157 | danydb | 2012-12-05 21:08:07 +0100 (Wed, 05 Dec 2012) | 2 lines
  
  0000766: Utilisation des moyens de paiements : libell?\195?\169 
diff?\195?\169rent pour l'op?\195?\169ration de paiement et d'achat/vente.
  0000765: affichage des colonnes Prix HTVA quand la soci?\195?\169t?\195?\169 
n'est pas assujettie ?\195?\160 la TVA
........
  r5158 | danydb | 2012-12-06 21:42:51 +0100 (Thu, 06 Dec 2012) | 1 line
  
  0000762: TVA intracommunautaire
........
  r5159 | danydb | 2012-12-06 21:43:22 +0100 (Thu, 06 Dec 2012) | 1 line
  
  Bug : the history doesn't show the first_name for VEN
........
  r5160 | danydb | 2012-12-06 21:51:09 +0100 (Thu, 06 Dec 2012) | 1 line
  
  0000762: TVA intracommunautaire typo
........
  r5161 | danydb | 2012-12-06 22:56:36 +0100 (Thu, 06 Dec 2012) | 1 line
  
  0000762: TVA intracommunautaire : montant facture au lieu montant 
op?\195?\169ration
........
  r5162 | danydb | 2012-12-06 23:09:20 +0100 (Thu, 06 Dec 2012) | 1 line
  
  0000745: en bas de page il appara?\195?\174t un pop up
........
  r5163 | danydb | 2012-12-08 19:10:52 +0100 (Sat, 08 Dec 2012) | 1 line
  
  patch version 104
........
  r5164 | danydb | 2012-12-08 20:48:57 +0100 (Sat, 08 Dec 2012) | 1 line
  
  patch version 104
........
  r5165 | danydb | 2012-12-08 21:12:14 +0100 (Sat, 08 Dec 2012) | 1 line
  
  cosmetique
........
  r5166 | danydb | 2012-12-08 21:30:44 +0100 (Sat, 08 Dec 2012) | 1 line
  
  rewriting
........
  r5167 | danydb | 2012-12-08 23:48:30 +0100 (Sat, 08 Dec 2012) | 1 line
  
  Ajout IMPJRN, d?\195?\169tail op?\195?\169ration
........
  r5168 | danydb | 2012-12-14 19:35:46 +0100 (Fri, 14 Dec 2012) | 1 line
  
  add personal expense
........
  r5169 | danydb | 2012-12-14 19:58:23 +0100 (Fri, 14 Dec 2012) | 1 line
  
  remove "choississez votre exercice"
........
  r5170 | danydb | 2013-01-03 21:15:40 +0100 (Thu, 03 Jan 2013) | 1 line
  
  0000773: Bug sur fiches avec double postes comptables
........
  r5171 | danydb | 2013-01-19 00:28:52 +0100 (Sat, 19 Jan 2013) | 1 line
  
  0000778: Si dossier n'existe pas alors il y a une erreur dans administration 
> dossier
........
  r5172 | danydb | 2013-01-20 15:57:40 +0100 (Sun, 20 Jan 2013) | 1 line
  
  0000778: Si dossier n'existe pas alors il y a une erreur dans administration 
> dossier
........
  r5173 | danydb | 2013-01-23 22:38:28 +0100 (Wed, 23 Jan 2013) | 2 lines
  
  
  #780 & #776 forbids some character in the quickcode
........
  r5174 | danydb | 2013-01-23 22:58:53 +0100 (Wed, 23 Jan 2013) | 1 line
  
  Improve format_name 
........
  r5175 | danydb | 2013-01-23 22:59:52 +0100 (Wed, 23 Jan 2013) | 1 line
  
  #778 skip the unexisting folder 
........
  r5176 | danydb | 2013-02-06 19:34:25 +0100 (Wed, 06 Feb 2013) | 1 line
  
  0000783: Apparence dans HISTO des notes
........
  r5177 | danydb | 2013-02-06 19:53:39 +0100 (Wed, 06 Feb 2013) | 1 line
  
  0000783: Apparence dans HISTO des notes
........
  r5178 | danydb | 2013-02-13 18:05:32 +0100 (Wed, 13 Feb 2013) | 1 line
  
  0000788: Lettrage : date invalide, bloque
........
  r5179 | danydb | 2013-02-13 18:15:46 +0100 (Wed, 13 Feb 2013) | 1 line
  
  0000788: Lettrage : date invalide, bloque
........
  r5180 | danydb | 2013-02-13 18:25:43 +0100 (Wed, 13 Feb 2013) | 1 line
  
  0000787: Rapprochement bancaire
........
  r5181 | danydb | 2013-02-13 19:13:10 +0100 (Wed, 13 Feb 2013) | 1 line
  
  Erreur si db inexistante alors echec
........
  r5182 | danydb | 2013-02-28 14:04:44 +0100 (Thu, 28 Feb 2013) | 1 line
  
  small bugs in javascript : typo
........
  r5183 | danydb | 2013-03-05 15:40:08 +0100 (Tue, 05 Mar 2013) | 2 lines
  
  0000791: Afficher dans la vue Param?\195?\168tres / Divers / TVA le code TVA
........
  r5184 | danydb | 2013-03-13 16:23:22 +0100 (Wed, 13 Mar 2013) | 2 lines
  
  0000795: Orthographe : dans le calendrier : t?\195?\162che suivi
........
  r5185 | danydb | 2013-03-13 16:30:37 +0100 (Wed, 13 Mar 2013) | 2 lines
  
  0000796: Lettrage : en code Hexad?\195?\169cimal ou en base 36 (A ?\195?\160 
Z + 0 ?\195?\160 10)
........
  r5186 | danydb | 2013-03-13 22:10:15 +0100 (Wed, 13 Mar 2013) | 2 lines
  
  0000796: Lettrage : en code Hexad?\195?\169cimal ou en base 36 (A ?\195?\160 
Z + 0 ?\195?\160 10)
........
  r5187 | danydb | 2013-03-14 00:04:53 +0100 (Thu, 14 Mar 2013) | 2 lines
  
  esth?\195?\169tique
........
  r5188 | danydb | 2013-03-17 01:24:05 +0100 (Sun, 17 Mar 2013) | 3 lines
  
  0000797: Am?\195?\169lioration du workflow : statut des documents / actions
........
  r5189 | danydb | 2013-03-20 13:57:01 +0100 (Wed, 20 Mar 2013) | 1 line
  
  code cleaning : remove function Acc_Payment::row
........
  r5190 | danydb | 2013-03-20 14:02:36 +0100 (Wed, 20 Mar 2013) | 1 line
  
  Code cleaning
........
  r5191 | danydb | 2013-03-25 23:42:49 +0100 (Mon, 25 Mar 2013) | 1 line
  
  Documentation : doxygen tag misplaced due to netbeans
........
  r5192 | danydb | 2013-03-27 19:54:37 +0100 (Wed, 27 Mar 2013) | 1 line
  
  cosmetic : width div for operation detail 
........
  r5193 | danydb | 2013-03-27 20:08:09 +0100 (Wed, 27 Mar 2013) | 1 line
  
  cosmetic : orthographe profile -> profil
........
  r5194 | danydb | 2013-03-27 20:17:51 +0100 (Wed, 27 Mar 2013) | 1 line
  
  cosmetic : ajout bouton fermeture si d?\195?\169tail non disponible
........
  r5195 | danydb | 2013-03-27 20:20:33 +0100 (Wed, 27 Mar 2013) | 1 line
  
  0000802: Bug : visibilit?\195?\169 des actions
........
  r5196 | danydb | 2013-03-27 20:22:53 +0100 (Wed, 27 Mar 2013) | 1 line
  
  0000802: Bug : visibilit?\195?\169 des actions
........
  r5197 | danydb | 2013-03-27 23:25:34 +0100 (Wed, 27 Mar 2013) | 1 line
  
  0000801: Ajouter un lien vers l'action
........
  r5198 | danydb | 2013-03-27 23:26:17 +0100 (Wed, 27 Mar 2013) | 1 line
  
  typo profile -> profil
........
  r5199 | danydb | 2013-03-28 00:12:02 +0100 (Thu, 28 Mar 2013) | 1 line
  
  javascript bug
........
  r5200 | danydb | 2013-03-28 00:12:25 +0100 (Thu, 28 Mar 2013) | 1 line
  
  bug last_operation <> late_operation
........
  r5201 | danydb | 2013-03-28 00:14:27 +0100 (Thu, 28 Mar 2013) | 1 line
  
  cosmetic
........
  r5202 | danydb | 2013-03-28 18:05:08 +0100 (Thu, 28 Mar 2013) | 1 line
  
  Add patch upgrade105
........
  r5203 | danydb | 2013-03-28 18:13:22 +0100 (Thu, 28 Mar 2013) | 1 line
  
  0000799: Pouvoir augmenter le nombre de lignes propos?\195?\169es pour un 
rapprochement
........
  r5204 | danydb | 2013-03-28 18:54:15 +0100 (Thu, 28 Mar 2013) | 1 line
  
  voir les heures dans commentaire
........
  r5205 | danydb | 2013-03-28 22:58:34 +0100 (Thu, 28 Mar 2013) | 1 line
  
  Cannot save a detail operation
........
  r5206 | danydb | 2013-03-28 23:23:50 +0100 (Thu, 28 Mar 2013) | 1 line
  
  Cannot save financial
........
  r5209 | danydb | 2013-04-04 20:53:49 +0200 (Thu, 04 Apr 2013) | 1 line
  
  0000807: Legend n'est pas agrandi
........
  r5210 | danydb | 2013-04-14 23:46:39 +0200 (Sun, 14 Apr 2013) | 1 line
  
  0000819: Note de d?\195?\169bit et de cr?\195?\169dit n?\195?\169gative avec 
TVA autoliquidation
........
  r5211 | danydb | 2013-04-15 18:57:05 +0200 (Mon, 15 Apr 2013) | 1 line
  
  Impossible de sauver dans journaux financiers dans certains cas
........
  r5212 | danydb | 2013-04-15 19:56:50 +0200 (Mon, 15 Apr 2013) | 1 line
  
  0000819: Note de d?\195?\169bit et de cr?\195?\169dit n?\195?\169gative avec 
TVA autoliquidation
........
  r5213 | danydb | 2013-04-24 23:28:32 +0200 (Wed, 24 Apr 2013) | 1 line
  
  0000824: Impossible de rechercher une action pour les actions li?\195?\169es
........
  r5214 | danydb | 2013-05-02 22:54:28 +0200 (Thu, 02 May 2013) | 1 line
  
  improve doc
........
  r5215 | danydb | 2013-05-03 23:56:40 +0200 (Fri, 03 May 2013) | 3 lines
  
  #0000822: G?\195?\169n?\195?\169ration document : changer le type de cellule
  
  Attention probl?\195?\168me si on a utiliser = devant le tag pour forcer le 
type num?\195?\169rique
........



Property changes on: phpcompta/trunk
___________________________________________________________________
Name: svnmerge-integrated
   - /phpcompta/tags/rel650:1-5054
   + /phpcompta/tags/rel650:1-5215


Property changes on: phpcompta/trunk/contrib/document_test
___________________________________________________________________
Name: svn:ignore
   + .~lock.all_tags.odt#


Modified: phpcompta/trunk/contrib/document_test/all_tags.odt
===================================================================
(Binary files differ)

Modified: phpcompta/trunk/doc/developper/Doxyfile
===================================================================
--- phpcompta/trunk/doc/developper/Doxyfile     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/doc/developper/Doxyfile     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -585,8 +585,9 @@
 # with spaces.
 
 INPUT                  = ../../include \
-                         ../../html
+                         ../../html 
 
+
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
 # also the default input encoding. Doxygen uses libiconv (or the iconv built
@@ -660,7 +661,7 @@
 # directories that are symbolic links (a Unix filesystem feature) are excluded
 # from the input.
 
-EXCLUDE_SYMLINKS       = YES
+EXCLUDE_SYMLINKS       = NO
 
 # If the value of the INPUT tag contains directories, you can use the
 # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude

Modified: phpcompta/trunk/doc/manuel-fr.odt
===================================================================
(Binary files differ)

Modified: phpcompta/trunk/doc/manuel-fr.pdf
===================================================================
(Binary files differ)

Modified: phpcompta/trunk/html/admin/setup.php
===================================================================
--- phpcompta/trunk/html/admin/setup.php        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/admin/setup.php        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -461,11 +461,21 @@
 //----------------------------------------------------------------------
 
 for ($e=0;$e < $MaxDossier;$e++) {
-  $db_row=$cn->fetch($e);
+   $db_row=Database::fetch_array($Resdossier,$e);
   echo "<h3>Patching ".$db_row['dos_name'].'</h3>';
-  $db=new Database($db_row['dos_id'],'dos');
-  $db->apply_patch($db_row['dos_name']);
-  Dossier::synchro_admin($db_row['dos_id']);
+
+  $name=$cn->format_name($db_row['dos_id'],'dos');
+
+  if ( $cn->exist_database($name)> 0 )
+  {
+    $db=new Database($db_row['dos_id'],'dos');
+    $db->apply_patch($db_row['dos_name']);
+    Dossier::synchro_admin($db_row['dos_id']);
+
+  } else
+  {
+      echo_warning(_("Dossier inexistant")." $name");
+  }
  }
 
 //----------------------------------------------------------------------
@@ -476,10 +486,18 @@
 echo "<h2>Mise &agrave; jour mod&egrave;le</h2>";
 
 for ($e=0;$e < $MaxDossier;$e++) {
-  $db_row=$cn->fetch($e);
+  $db_row=Database::fetch_array($Resdossier,$e);
   echo "<h3>Patching ".$db_row['mod_name']."</h3>";
-  $db=new Database($db_row['mod_id'],'mod');
-  $db->apply_patch($db_row['mod_name']);
+  $name=$cn->format_name($db_row['mod_id'],'mod');
+
+  if ( $cn->exist_database($name)> 0 )
+  {
+    $db=new Database($db_row['mod_id'],'mod');
+    $db->apply_patch($db_row['mod_name']);
+   } else
+  {
+      echo_warning(_("Modèle inexistant")." $name");
+  }
  }
 
 //----------------------------------------------------------------------

Modified: phpcompta/trunk/html/admin/sql/mod2/data.sql
===================================================================
--- phpcompta/trunk/html/admin/sql/mod2/data.sql        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/html/admin/sql/mod2/data.sql        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -578,10 +578,10 @@
 
 
 
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (2, '400', 'Client', true, 9);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (2, '410', 'Client', true, 9);
 INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (1, '604', 'Marchandises', true, 2);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (3, '5500', 'Banque', true, 4);
-INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (4, '440', 'Fournisseur', true, 8);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (3, '51', 'Banque', true, 4);
+INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (4, '400', 'Fournisseur', true, 8);
 INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (5, '61', 'S & B D', true, 3);
 INSERT INTO fiche_def (fd_id, fd_class_base, fd_label, fd_create_account, 
frd_id) VALUES (6, '700', 'Vente', true, 1);
 

Copied: phpcompta/trunk/html/admin/sql/patch/upgrade103.sql (from rev 5215, 
phpcompta/tags/rel650/html/admin/sql/patch/upgrade103.sql)
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/upgrade103.sql                         
(rev 0)
+++ phpcompta/trunk/html/admin/sql/patch/upgrade103.sql 2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -0,0 +1,37 @@
+begin;
+CREATE OR REPLACE FUNCTION comptaproc.format_account(p_account account_type)
+  RETURNS account_type AS
+$BODY$
+
+declare
+
+sResult account_type;
+
+begin
+sResult := lower(p_account);
+
+sResult := translate(sResult,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
+sResult := translate(sResult,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*','');
+
+return upper(sResult);
+
+end;
+$BODY$
+  LANGUAGE plpgsql ;
+
+COMMENT ON FUNCTION comptaproc.format_account(account_type) IS 'format the 
accounting :
+- upper case
+- remove space and special char.
+';
+
+update tmp_pcmn  set pcm_val_parent  = '62' where pcm_val='6202';
+
+update fiche_detail set ad_value = (to_number(ad_value,'9.99')*100)::text 
where ad_id in  (21,22,20,31) and ad_value is not null and ad_value <> '';
+
+update menu_ref set me_code='ACHISTO' WHERE me_code='ACHIMP';
+update menu_ref set me_code='VEHISTO' WHERE me_code='VENIMP';
+update menu_ref set me_code='FIHISTO' WHERE me_code='FIMP';
+update menu_ref set me_code='ODHISTO' WHERE me_code='ODSIMP';
+update version set val=104;
+
+commit;
\ No newline at end of file

Copied: phpcompta/trunk/html/admin/sql/patch/upgrade104.sql (from rev 5215, 
phpcompta/tags/rel650/html/admin/sql/patch/upgrade104.sql)
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/upgrade104.sql                         
(rev 0)
+++ phpcompta/trunk/html/admin/sql/patch/upgrade104.sql 2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -0,0 +1,105 @@
+begin;
+CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, 
tav_text text)
+  RETURNS integer AS
+$BODY$
+       declare
+       ns integer;
+       nExist integer;
+       tText text;
+       begin
+       tText := lower(trim(tav_text));
+       tText := replace(tText,' ','');
+       tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*','');
+       tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
+
+
+       loop
+               -- take the next sequence
+               select nextval('s_jnt_fic_att_value') into ns;
+               if length (tText) = 0 or tText is null then
+                       tText := 'FID'||ns;
+               end if;
+               -- av_text already used ?
+               select count(*) into nExist
+                       from fiche_detail
+               where
+                       ad_id=23 and  ad_value=upper(tText);
+
+               if nExist = 0 then
+                       exit;
+               end if;
+               tText:='FID'||ns;
+       end loop;
+
+
+       insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values 
(ns,nf_id,23,upper(tText));
+       return ns;
+       end;
+$BODY$
+LANGUAGE plpgsql;
+
+
+
+CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer, 
tav_text text)
+  RETURNS integer AS
+$BODY$
+       declare
+       ns integer;
+       nExist integer;
+       tText text;
+       old_qcode varchar;
+       begin
+       -- get current value
+       select ad_value into old_qcode from fiche_detail where jft_id=njft_id;
+       -- av_text didn't change so no update
+       if tav_text = upper( trim(old_qcode)) then
+               return 0;
+       end if;
+
+       tText := trim(lower(tav_text));
+       tText := replace(tText,' ','');
+       tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*','');
+       tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
+       tText := upper(tText);
+       if length ( tText) = 0 or tText is null then
+               return 0;
+       end if;
+
+       ns := njft_id;
+
+       loop
+               -- av_text already used ?
+               select count(*) into nExist
+                       from fiche_detail
+               where
+                       ad_id=23 and ad_value=tText;
+
+               if nExist = 0 then
+                       exit;
+               end if;
+               if tText = 'FID'||ns then
+                       -- take the next sequence
+                       select nextval('s_jnt_fic_att_value') into ns;
+               end if;
+               tText  :='FID'||ns;
+
+       end loop;
+       update fiche_detail set ad_value = tText where jft_id=njft_id;
+
+       -- update also the contact
+       update fiche_detail set ad_value = tText
+               where jft_id in
+                       ( select jft_id
+                               from fiche_detail
+                       where ad_id=25 and ad_value=old_qcode);
+
+
+       update jrnx set j_qcode=tText where j_qcode = old_qcode;
+       return ns;
+       end;
+$BODY$
+LANGUAGE plpgsql;
+
+update version set val=105;
+
+commit;
\ No newline at end of file

Copied: phpcompta/trunk/html/admin/sql/patch/upgrade105.sql (from rev 5215, 
phpcompta/tags/rel650/html/admin/sql/patch/upgrade105.sql)
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/upgrade105.sql                         
(rev 0)
+++ phpcompta/trunk/html/admin/sql/patch/upgrade105.sql 2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -0,0 +1,109 @@
+begin;
+
+CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, 
tav_text text)
+  RETURNS integer AS
+$BODY$
+       declare
+       ns integer;
+       nExist integer;
+       tText text;
+       begin
+       tText := lower(trim(tav_text));
+       tText := replace(tText,' ','');
+       tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*','');
+       tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
+
+
+       loop
+               -- take the next sequence
+               select nextval('s_jnt_fic_att_value') into ns;
+               if length (tText) = 0 or tText is null then
+                       tText := 'FID'||ns;
+               end if;
+               -- av_text already used ?
+               select count(*) into nExist
+                       from fiche_detail
+               where
+                       ad_id=23 and  ad_value=upper(tText);
+
+               if nExist = 0 then
+                       exit;
+               end if;
+               tText:='FID'||ns;
+       end loop;
+
+
+       insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values 
(ns,nf_id,23,upper(tText));
+       return ns;
+       end;
+$BODY$
+  LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer, 
tav_text text)
+  RETURNS integer AS
+$BODY$
+       declare
+       ns integer;
+       nExist integer;
+       tText text;
+       old_qcode varchar;
+       begin
+       -- get current value
+       select ad_value into old_qcode from fiche_detail where jft_id=njft_id;
+       -- av_text didn't change so no update
+       if tav_text = upper( trim(old_qcode)) then
+               return 0;
+       end if;
+
+       tText := trim(lower(tav_text));
+       tText := replace(tText,' ','');
+       tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*','');
+       tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
+       tText := upper(tText);
+       if length ( tText) = 0 or tText is null then
+               return 0;
+       end if;
+
+       ns := njft_id;
+
+       loop
+               -- av_text already used ?
+               select count(*) into nExist
+                       from fiche_detail
+               where
+                       ad_id=23 and ad_value=tText;
+
+               if nExist = 0 then
+                       exit;
+               end if;
+               if tText = 'FID'||ns then
+                       -- take the next sequence
+                       select nextval('s_jnt_fic_att_value') into ns;
+               end if;
+               tText  :='FID'||ns;
+
+       end loop;
+       update fiche_detail set ad_value = tText where jft_id=njft_id;
+
+       -- update also the contact
+       update fiche_detail set ad_value = tText
+               where jft_id in
+                       ( select jft_id
+                               from fiche_detail
+                       where ad_id=25 and ad_value=old_qcode);
+
+
+       update jrnx set j_qcode=tText where j_qcode = old_qcode;
+       return ns;
+       end;
+$BODY$
+  LANGUAGE plpgsql;
+
+
+alter table document_state add s_status char(1);
+
+update document_state set s_status='C' where s_id in (1,4);
+
+update version set val=106;
+
+commit;

Modified: phpcompta/trunk/html/ajax_card.php
===================================================================
--- phpcompta/trunk/html/ajax_card.php  2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/ajax_card.php  2013-05-03 22:31:33 UTC (rev 5216)
@@ -116,7 +116,7 @@
         echo $e->getMessage();
     }
     $html=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
     break;
     /* ------------------------------------------------------------ */
     /* Display card detail */
@@ -327,9 +327,11 @@
     $r.='<form method="GET" 
onsubmit="this.ctl=\'ipop_card\';search_get_card(this);return false;">';
     $q=new IText('query');
     $q->value=(isset($query))?$query:'';
-    $r.=_('Fiche contenant');
+       $r.='<span style="margin-left:50px">';
+    $r.=_('Fiche contenant').HtmlInput::infobulle(19);
     $r.=$q->input();
     $r.=HtmlInput::submit('fs',_('Recherche'));
+       $r.='</span>';
     $r.=dossier::hidden().HtmlInput::hidden('op','fs');
     $array=array();
     foreach (array('query','inp','jrn','label','typecard','price','tvaid') as 
$i)
@@ -393,7 +395,7 @@
     ob_start();
     require_once('template/card_result.php');
     $r.=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
     $ctl=$ctl.'_content';
     $html=$r;
     break;
@@ -442,7 +444,7 @@
         ob_start();
         require('template/category_of_card.php');
         $html.=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
 
     }
     else
@@ -511,7 +513,7 @@
          ob_start();
          $f->update($_GET);
          $html.=ob_get_contents();
-         ob_clean();
+         ob_end_clean();
          $html.=$f->Display(true);
          
$html.=HtmlInput::button('close_'.$ctl,'Fermer',"onclick=\"removeDiv('$ctl')\"");
        }

Modified: phpcompta/trunk/html/ajax_history.php
===================================================================
--- phpcompta/trunk/html/ajax_history.php       2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/ajax_history.php       2013-05-03 22:31:33 UTC (rev 
5216)
@@ -115,7 +115,7 @@
        echo $old;
 
         $html=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
       }
   }
 ///////////////////////////////////////////////////////////////////////////
@@ -185,7 +185,7 @@
        echo $old;
 
         $html=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
       }
   }
 $html=escape_xml($html);

Modified: phpcompta/trunk/html/ajax_ledger.php
===================================================================
--- phpcompta/trunk/html/ajax_ledger.php        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/ajax_ledger.php        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -71,8 +71,9 @@
 {
     ob_start();
     require_once ('template/ledger_detail_forbidden.php');
+       echo HtmlInput::button_close($div);
     $html=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
     $html=escape_xml($html);
     header('Content-type: text/xml; charset=UTF-8');
     echo <<<EOF
@@ -97,8 +98,9 @@
     ob_start();
        echo HtmlInput::title_box(_("Information"), $div);
     require_once ('template/ledger_detail_forbidden.php');
+       echo HtmlInput::button_close($div);
     $html=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
 
     $html=escape_xml($html);
     header('Content-type: text/xml; charset=UTF-8');
@@ -118,9 +120,9 @@
     ob_start();
        echo HtmlInput::title_box(_("Information"), $div);
     require_once ('template/ledger_detail_forbidden.php');
+       echo HtmlInput::button_close($div);
     $html=ob_get_contents();
-    ob_clean();
-
+    ob_end_clean();
     $html=escape_xml($html);
     header('Content-type: text/xml; charset=UTF-8');
     echo <<<EOF
@@ -158,7 +160,7 @@
                 $cn->rollback;
             }
             $html=ob_get_contents();
-            ob_clean();
+            ob_end_clean();
         }
     break;
     //////////////////////////////////////////////////////////////////////
@@ -197,7 +199,7 @@
         echo '<h2 class="error">Désolé il y a une erreur</h2>';
     }
     $html=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
 
     break;
     
/////////////////////////////////////////////////////////////////////////////
@@ -221,7 +223,7 @@
                        echo "<div>";
 
                }
-               echo "<h2>Document</h2>";
+               echo "<h1 class=\"legend\">Document</h1>";
         if ( $access=='W')
         {
             echo '<FORM METHOD="POST" ENCTYPE="multipart/form-data" 
id="form_file">';
@@ -278,7 +280,7 @@
                        echo "<div>";
 
                }
-               echo "<h2>Document</h2>";
+               echo "<h1 class=\"legend\">Document</h1>";
         echo '<div class="op_detail_frame">';
         $x='';
         if ($access=='W')
@@ -477,7 +479,7 @@
       alert( "Changement impossible: on ne peut pas changer la date dans une 
période fermée");
     }
     $html=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
 
     break;
 /////////////////////////////////////////////////////////////////////////////
@@ -525,7 +527,7 @@
         }
     }
     $html=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
     break;
 }
 $html=escape_xml($html);

Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php  2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/ajax_misc.php  2013-05-03 22:31:33 UTC (rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief this file respond to an ajax request
  * The parameters are
  * - gDossier
@@ -323,14 +323,33 @@
                $line.=td($max->input());
                $r.=tr($line);
 
+               $date_error="";
                // start date
                $start = new IDate('search_start');
+
+               /*  check if date are valid */
+               if (isset($search_start) && isDate($search_start) == null)
+               {
+                       ob_start();
+                       alert(_('Date malformée'));
+                       $date_error = ob_get_contents();
+                       ob_end_clean();
+                       $search_start=$first_per->first_day();
+               }
                $start->value = (isset($search_start)) ? $search_start : 
$first_per->first_day();
 
-
                $line = td('Date Debut') . td($start->input());
                // end date
                $end = new IDate('search_end');
+                                               /*  check if date are valid */
+               if (isset($search_end) && isDate($search_end) == null)
+               {
+                       ob_start();
+                       alert(_('Date malformée'));
+                       $date_error = ob_get_contents();
+                       ob_end_clean();
+                       $search_end=$last_per->last_day();
+               }
                $end->value = (isset($search_end)) ? $search_end : 
$last_per->last_day();
                $line.=td('Date Fin') . td($end->input());
                $r.=tr($line);
@@ -396,28 +415,8 @@
                        $form.=HtmlInput::hidden('sb', $_REQUEST['sb']);
                if (isset($_REQUEST['f_id']))
                        $form.=HtmlInput::hidden('f_id', $_REQUEST['f_id']);
-               /*  check if date are valid */
-               if ((isset($search_end) && isDate($search_end) == null) ||
-                               (isset($search_start) && isDate($search_start) 
== null))
-               {
-                       ob_start();
-                       alert(_('Date malformée, désolé'));
-                       $html = ob_get_contents();
-                       ob_clean();
 
-                       $html = escape_xml($html);
 
-                       header('Content-type: text/xml; charset=UTF-8');
-                       echo <<<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<data>
-<code>detail</code>
-<value>$html</value>
-</data>
-EOF;
-                       exit();
-               }
-
                // display a list of operation from the other side + box button
                if ($ot == 'account')
                {
@@ -458,7 +457,9 @@
                $form.=HtmlInput::submit('record', _('Sauver')) . $ret->input();
                $form.='</FORM>';
                $form.='</div>';
+
                $html = $r . $form;
+               $html.=$date_error;
                //       echo $html;exit;
                $html = escape_xml($html);
 
@@ -501,6 +502,9 @@
        case 'add_menu':
                require_once 'ajax_add_menu.php';
                break;
+       case 'cardsearch':
+               require_once 'ajax_boxcard_search.php';
+               break;
        case 'add_plugin':
                $me_code = new IText('me_code');
                $me_file = new IText('me_file');
@@ -561,6 +565,9 @@
        case 'fddetail':
                require_once 'ajax_fiche_def_detail.php';
                break;
+       case 'vw_action':
+               require_once 'ajax_view_action.php';
+               break;
        default:
                var_dump($_GET);
 }

Modified: phpcompta/trunk/html/ajax_poste.php
===================================================================
--- phpcompta/trunk/html/ajax_poste.php 2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/ajax_poste.php 2013-05-03 22:31:33 UTC (rev 5216)
@@ -62,7 +62,7 @@
 global $g_user;
 $g_user=new User($cn);
 $g_user->Check();
-if  ($g_user->get_folder_access(dossier::id()) == 'X') exit();
+if  ($g_user->check_dossier(dossier::id()) == 'X') exit();
 $xml="";
 
 switch ($op)
@@ -88,7 +88,7 @@
     ob_start();
     require_once('template/account_search.php');
     $r.=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
     $r.=dossier::hidden();
     $r.=(isset ($c))?HtmlInput::hidden('account',$c):"";
     $r.=(isset ($l))?HtmlInput::hidden('label',$l):"";
@@ -163,7 +163,7 @@
 
     require_once('template/account_result.php');
     $r.=ob_get_contents();
-    ob_clean();
+    ob_end_clean();
 
     $html=$r;
     break;

Modified: phpcompta/trunk/html/do.php
===================================================================
--- phpcompta/trunk/html/do.php 2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/do.php 2013-05-03 22:31:33 UTC (rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief Main file
  */
 require_once 'class_database.php';

Modified: phpcompta/trunk/html/document/fr_be/bnb.form
===================================================================
--- phpcompta/trunk/html/document/fr_be/bnb.form        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/html/document/fr_be/bnb.form        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -1,147 +1,147 @@
 # Les postesg*(-1)
- $C10=round([10%S],2)*(-1)
- $C100=round([100%S],2)*(-1)
- $C101=round([101%S],2)
- $C11=round([11%S],2)*(-1)
- $C12=round([12%S],2)*(-1)
- $C13=round([13%S],2)*(-1)
- $C130=round([130%S],2)*(-1)
- $C131=round([131%S],2)*(-1)
- $C1310=round([1310%S],2)*(-1)
- $C1311=round([1311%S],2)*(-1)
- $C132=round([132%S],2)*(-1)
- $C133=round([133%S],2)*(-1)
- $C14=round([14%S],2)*(-1)
- $C140=round([140%S],2)*(-1)
- $C141=round([141%S],2)
- $C15=round([15%S],2)*(-1)
- $C16=round([16%S],2)*(-1)
- $C160=round([160%S],2)*(-1)
- $C161=round([161%S],2)*(-1)
- $C162=round([162%S],2)*(-1)
- $C163=round([163%S],2)*(-1)
- $C164=round([164%S],2)*(-1)
- $C165=round([165%S],2)*(-1)
- $C168=round([168%S],2)*(-1)
-$C17=round([17%S],2)*(-1)
- $C170=round([170%S],2)*(-1)
- $C171=round([171%S],2)*(-1)
- $C172=round([172%S],2)*(-1)
- $C173=round([173%S],2)*(-1)
- $C174=round([174%S],2)*(-1)
- $C175=round([175%S],2)*(-1)
- $C176=round([176%S],2)*(-1)
- $C178=round([178%S],2)*(-1)
- $C179=round([179%S],2)*(-1)
-$C2=round([2%S],2)*(-1)
- $C20=round([20%S],2)
- $C21=round([21%S],2)
- $C22=round([22%S],2)
- $C23=round([23%S],2)
- $C24=round([24%S],2)
- $C25=round([25%S],2)
- $C26=round([26%S],2)
- $C27=round([27%S],2)
- $C28=round([28%S],2)
- $C29=round([29%S],2)
- $C290=round([290%S],2)
- $C291=round([291%S],2)
-$C3=round([3%S],2)
- $C30=round([30%S],2)
- $C31=round([31%S],2)
- $C32=round([32%S],2)
- $C33=round([33%S],2)
- $C34=round([34%S],2)
- $C35=round([35%S],2)
- $C36=round([36%S],2)
- $C37=round([37%S],2)
- $C40=round([40%S],2)
- $C41=round([41%S],2)
- $C42=round([42%S],2)*(-1)
- $C43=round([43%S],2)*(-1)
- $C439=round([439%S],2)*(-1)
- $C44=round([44%S],2)*(-1)
- $C440=round([440%S],2)*(-1)
- $C441=round([441%S],2)*(-1)
- $C444=round([444%S],2)*(-1)
- $C45=round([45%S],2)*(-1)
- $C450=round([450%S],2)*(-1)
- $C451=round([451%S],2)*(-1)
- $C452=round([452%S],2)*(-1)
- $C453=round([453%S],2)*(-1)
- $C454=round([454%S],2)*(-1)
-$C455=round([455%S],2)*(-1)
-$C456=round([456%S],2)*(-1)
-$C457=round([457%S],2)*(-1)
-$C458=round([458%S],2)*(-1)
- $C459=round([459%S],2)*(-1)
- $C46=round([46%S],2)
- $C47=round([47%S],2)*(-1)
- $C48=round([48%S],2)*(-1)
- $C49=round([49%S],2)
- $C490=round([490%S],2)
- $C491=round([491%S],2)
- $C492=round([492%S],2)*(-1)
- $C493=round([493%S],2)*(-1)
- $C50=round([50%S],2)
- $C51=round([51%S],2)
- $C52=round([52%S],2)
- $C53=round([53%S],2)
- $C54=round([54%S],2)
- $C55=round([55%S],2)
- $C56=round([56%S],2)
- $C57=round([57%S],2)
- $C58=round([58%S],2)
- $C60=round([60%S],2)
- $C61=round([61%S],2)
- $C62=round([62%S],2)
- $C63=round([63%S],2)
-$C630=round([630%S],2)
-$C631=round([631%S],2)
-$C632=round([632%S],2)
-$C633=round([633%S],2)
-$C634=round([634%S],2)
-$C635=round([635%S],2)
-$C636=round([636%S],2)
-$C637=round([637%S],2)
+ $C10=round([10%s],2)*(-1)
+ $C100=round([100%s],2)*(-1)
+ $C101=round([101%s],2)
+ $C11=round([11%s],2)*(-1)
+ $C12=round([12%s],2)*(-1)
+ $C13=round([13%s],2)*(-1)
+ $C130=round([130%s],2)*(-1)
+ $C131=round([131%s],2)*(-1)
+ $C1310=round([1310%s],2)*(-1)
+ $C1311=round([1311%s],2)*(-1)
+ $C132=round([132%s],2)*(-1)
+ $C133=round([133%s],2)*(-1)
+ $C14=round([14%s],2)*(-1)
+ $C140=round([140%s],2)*(-1)
+ $C141=round([141%s],2)
+ $C15=round([15%s],2)*(-1)
+ $C16=round([16%s],2)*(-1)
+ $C160=round([160%s],2)*(-1)
+ $C161=round([161%s],2)*(-1)
+ $C162=round([162%s],2)*(-1)
+ $C163=round([163%s],2)*(-1)
+ $C164=round([164%s],2)*(-1)
+ $C165=round([165%s],2)*(-1)
+ $C168=round([168%s],2)*(-1)
+$C17=round([17%s],2)*(-1)
+ $C170=round([170%s],2)*(-1)
+ $C171=round([171%s],2)*(-1)
+ $C172=round([172%s],2)*(-1)
+ $C173=round([173%s],2)*(-1)
+ $C174=round([174%s],2)*(-1)
+ $C175=round([175%s],2)*(-1)
+ $C176=round([176%s],2)*(-1)
+ $C178=round([178%s],2)*(-1)
+ $C179=round([179%s],2)*(-1)
+$C2=round([2%s],2)*(-1)
+ $C20=round([20%s],2)
+ $C21=round([21%s],2)
+ $C22=round([22%s],2)
+ $C23=round([23%s],2)
+ $C24=round([24%s],2)
+ $C25=round([25%s],2)
+ $C26=round([26%s],2)
+ $C27=round([27%s],2)
+ $C28=round([28%s],2)
+ $C29=round([29%s],2)
+ $C290=round([290%s],2)
+ $C291=round([291%s],2)
+$C3=round([3%s],2)
+ $C30=round([30%s],2)
+ $C31=round([31%s],2)
+ $C32=round([32%s],2)
+ $C33=round([33%s],2)
+ $C34=round([34%s],2)
+ $C35=round([35%s],2)
+ $C36=round([36%s],2)
+ $C37=round([37%s],2)
+ $C40=round([40%s],2)
+ $C41=round([41%s],2)
+ $C42=round([42%s],2)*(-1)
+ $C43=round([43%s],2)*(-1)
+ $C439=round([439%s],2)*(-1)
+ $C44=round([44%s],2)*(-1)
+ $C440=round([440%s],2)*(-1)
+ $C441=round([441%s],2)*(-1)
+ $C444=round([444%s],2)*(-1)
+ $C45=round([45%s],2)*(-1)
+ $C450=round([450%s],2)*(-1)
+ $C451=round([451%s],2)*(-1)
+ $C452=round([452%s],2)*(-1)
+ $C453=round([453%s],2)*(-1)
+ $C454=round([454%s],2)*(-1)
+$C455=round([455%s],2)*(-1)
+$C456=round([456%s],2)*(-1)
+$C457=round([457%s],2)*(-1)
+$C458=round([458%s],2)*(-1)
+ $C459=round([459%s],2)*(-1)
+ $C46=round([46%s],2)
+ $C47=round([47%s],2)*(-1)
+ $C48=round([48%s],2)*(-1)
+ $C49=round([49%s],2)
+ $C490=round([490%s],2)
+ $C491=round([491%s],2)
+ $C492=round([492%s],2)*(-1)
+ $C493=round([493%s],2)*(-1)
+ $C50=round([50%s],2)
+ $C51=round([51%s],2)
+ $C52=round([52%s],2)
+ $C53=round([53%s],2)
+ $C54=round([54%s],2)
+ $C55=round([55%s],2)
+ $C56=round([56%s],2)
+ $C57=round([57%s],2)
+ $C58=round([58%s],2)
+ $C60=round([60%s],2)
+ $C61=round([61%s],2)
+ $C62=round([62%s],2)
+ $C63=round([63%s],2)
+$C630=round([630%s],2)
+$C631=round([631%s],2)
+$C632=round([632%s],2)
+$C633=round([633%s],2)
+$C634=round([634%s],2)
+$C635=round([635%s],2)
+$C636=round([636%s],2)
+$C637=round([637%s],2)
  
- $C649=round([649%S],2)*(-1)
- $C64=round([64%S],2)
+ $C649=round([649%s],2)*(-1)
+ $C64=round([64%s],2)
 
- $C65=round([65%S],2)
- $C66=round([66%S],2)
- $C67=round([67%S],2)
- $C68=round([68%S],2)
- $C680=round([680%S],2)
-$C689=round([689%S],2)
- $C69=round([69%S],2)
- $C690=round([690%S],2)
- $C691=round([691%S],2)
- $C692=round([692%S],2)
- $C6920=round([6920%S],2)
- $C6921=round([6921%S],2)
- $C693=round([693%S],2)
- $C694=round([694%S],2)
- $C695=round([695%S],2)
- $C696=round([696%S],2)
+ $C65=round([65%s],2)
+ $C66=round([66%s],2)
+ $C67=round([67%s],2)
+ $C68=round([68%s],2)
+ $C680=round([680%s],2)
+$C689=round([689%s],2)
+ $C69=round([69%s],2)
+ $C690=round([690%s],2)
+ $C691=round([691%s],2)
+ $C692=round([692%s],2)
+ $C6920=round([6920%s],2)
+ $C6921=round([6921%s],2)
+ $C693=round([693%s],2)
+ $C694=round([694%s],2)
+ $C695=round([695%s],2)
+ $C696=round([696%s],2)
 
-$C7=round([7%S],2)*(-1)
- $C70=round([70%S],2)*(-1)
- $C71=round([71%S],2)*(-1)
- $C73=round([73%S],2)*(-1)
- $C72=round([72%S],2)*(-1)
- $C74=round([74%S],2)*(-1)
- $C75=round([75%S],2)*(-1)
- $C76=round([76%S],2)*(-1)
- $C77=round([77%S],2)*(-1)
-$C780=round([780%S],2)*(-1)
-$C789=round([789%S],2)*(-1)
- $C79=round([79%S],2)*(-1)
-$C790=round([790%S],2)*(-1)
-$C791=round([791%S],2)*(-1)
-$C792=round([792%S],2)*(-1)
-$C793=round([793%S],2)*(-1)
-$C794=round([794%S],2)*(-1)
+$C7=round([7%s],2)*(-1)
+ $C70=round([70%s],2)*(-1)
+ $C71=round([71%s],2)*(-1)
+ $C73=round([73%s],2)*(-1)
+ $C72=round([72%s],2)*(-1)
+ $C74=round([74%s],2)*(-1)
+ $C75=round([75%s],2)*(-1)
+ $C76=round([76%s],2)*(-1)
+ $C77=round([77%s],2)*(-1)
+$C780=round([780%s],2)*(-1)
+$C789=round([789%s],2)*(-1)
+ $C79=round([79%s],2)*(-1)
+$C790=round([790%s],2)*(-1)
+$C791=round([791%s],2)*(-1)
+$C792=round([792%s],2)*(-1)
+$C793=round([793%s],2)*(-1)
+$C794=round([794%s],2)*(-1)
 # Les formules (*-1)
 #
 $S1=abs($C2-$C29)

Modified: phpcompta/trunk/html/js/acc_ledger.js
===================================================================
--- phpcompta/trunk/html/js/acc_ledger.js       2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/js/acc_ledger.js       2013-05-03 22:31:33 UTC (rev 
5216)
@@ -324,6 +324,7 @@
         a=trim(g("e_march"+p_ctl_nb+'_tva_amount').value);
         g("e_march"+p_ctl_nb+'_tva_amount').value=a;
     }
+       if ( ! document.getElementById("e_march"+p_ctl_nb))  {return;}
     g("e_march"+p_ctl_nb).value=trim(g("e_march"+p_ctl_nb).value);
     var qcode=g("e_march"+p_ctl_nb).value;
 
@@ -375,12 +376,12 @@
     for (var i=0;i<g("nb_item").value;i++)
     {
         if( g('tva_march'+i))  tva+=g('tva_march'+i).value*1;
-        htva+=g('htva_march'+i).value*1;
-        tvac+=g('tvac_march'+i).value*1;
+        if (g('htva_march'+i)) htva+=g('htva_march'+i).value*1;
+        if (g('tvac_march'+i)) tvac+=g('tvac_march'+i).value*1;
     }
 
     if ( g('tva') ) g('tva').innerHTML=Math.round(tva*100)/100;
-    g('htva').innerHTML=Math.round(htva*100)/100;
+    if (g('htva')) g('htva').innerHTML=Math.round(htva*100)/100;
     if (g('tvac'))    g('tvac').innerHTML=Math.round(tvac*100)/100;
 }
 /**
@@ -449,12 +450,12 @@
     for (var i=0;i<g("nb_item").value;i++)
     {
         if ( g('tva_march') ) tva+=g('tva_march'+i).value*1;
-        htva+=g('htva_march'+i).value*1;
-        tvac+=g('tvac_march'+i).value*1;
+        if( g('htva_march'+i)) htva+=g('htva_march'+i).value*1;
+        if( g('tvac_march'+i))tvac+=g('tvac_march'+i).value*1;
     }
 
     if ( g('tva') ) g('tva').innerHTML=Math.round(tva*100)/100;
-    g('htva').innerHTML=Math.round(htva*100)/100;
+    if (g('htva')) g('htva').innerHTML=Math.round(htva*100)/100;
     if (g('tvac'))g('tvac').innerHTML=Math.round(tvac*100)/100;
 
 
@@ -564,17 +565,22 @@
 
     querystring='gDossier='+dossier+'&act=de&pcm_val='+p_value+'&div='+id;
     add_div(popup);
+
     var action=new Ajax.Request(
                    "ajax_history.php",
                    {
                    method:'get',
                    parameters:querystring,
                    onFailure:error_box,
-                   onSuccess:success_box
+                   onSuccess:function (req,xml)
+                                       {
+                                               success_box(req,xml);
+                                               
g(id).style.top=calcy(140+(layer*3));
+                                               g(id).style.left="10%";
+                                               g(id).style.width='80%';
+                                       }
                    }
                );
-    g(id).style.top=posY-40;
-    g(id).style.left=posX-10;
 
 }
 
@@ -588,7 +594,13 @@
                method:'get',
                parameters:querystring,
                onFailure:error_box,
-               onSuccess:success_box
+                 onSuccess:function (req,xml)
+                                       {
+                                               success_box(req,xml);
+                                               
g(obj.div).style.top=calcy(140+(layer*3));
+                                               g(obj.div).style.left="10%";
+                                               g(obj.div).style.width='80%';
+                                       }
            });
     } catch (e)
     {
@@ -618,12 +630,15 @@
                    method:'get',
                    parameters:querystring,
                    onFailure:error_box,
-                   onSuccess:success_box
+                   onSuccess:function (req,xml)
+                                       {
+                                               success_box(req,xml);
+                                               
g(id).style.top=calcy(140+(layer*3));
+                                               g(id).style.left="10%";
+                                               g(id).style.width='80%';
+                                       }
                    }
                );
-    g(id).style.top=posY-40;
-    g(id).style.left=posX-10;
-
 }
 
 function update_history_card(obj)
@@ -636,7 +651,13 @@
                method:'get',
                parameters:querystring,
                onFailure:error_box,
-               onSuccess:success_box
+                 onSuccess:function (req,xml)
+                                       {
+                                               success_box(req,xml);
+                                               
g(obj.div).style.top=calcy(140+(layer*3));
+                                               g(obj.div).style.left="10%";
+                                               g(obj.div).style.width='80%';
+                                       }
            });
     } catch (e)
     {
@@ -693,29 +714,31 @@
 /*!\brief
  * \param p_value jrn.jr_id
  */
-function modifyOperation(p_value,dossier)
+function modifyOperation(p_value, dossier)
 {
-    layer++;
-    id='det'+layer;
-    var popup={'id':
-           id,'cssclass':'inner_box'
-           ,'html':
-           loading(),'drag':
-               true};
-    querystring='gDossier='+dossier+'&act=de&jr_id='+p_value+'&div='+id;
-    add_div(popup);
-    var action=new Ajax.Request(
-                   "ajax_ledger.php",
-                   {
-                   method:'get',
-                   parameters:querystring,
-                   onFailure:error_box,
-                   onSuccess:success_box
-                   }
-               );
-    g(id).style.top=posY-40;
-    g(id).style.left=300;
-
+       layer++;
+       id = 'det' + layer;
+       var popup = {'id':
+                               id, 'cssclass': 'inner_box'
+                               , 'html':
+                               loading(), 'drag':
+                               true};
+       querystring = 'gDossier=' + dossier + '&act=de&jr_id=' + p_value + 
'&div=' + id;
+       add_div(popup);
+       var action = new Ajax.Request(
+                       "ajax_ledger.php",
+                       {
+                               method: 'get',
+                               parameters: querystring,
+                               onFailure: error_box,
+                               onSuccess: function(xml, txt) {
+                                       success_box(xml, txt);
+                                       g(id).style.top = calcy(100 + (layer * 
3));
+                                       g(id).style.left = '10%';
+                                       g(id).style.width = "80%";
+                               }
+                       }
+       );
 }
 
 /*!\brief
@@ -868,10 +891,11 @@
 address@hidden save an operation in ajax, it concerns only the
 * comment, the pj and the rapt
 * the form elements are access by their name
address@hidden form
address@hidden obj form
 */
 function op_save(obj)
 {
+       try {
     var queryString=$(obj).serialize();
     queryString+="&lib="+obj.lib.value;
     queryString+="&gDossier="+obj.gDossier.value;
@@ -906,6 +930,8 @@
                                     );
     }
     return false;
+       } catch (e)
+       { alert(e.message);}
 }
 function  get_history_account(ctl,dossier) {
        if ( $(ctl).value != '')

Modified: phpcompta/trunk/html/js/accounting_item.js
===================================================================
--- phpcompta/trunk/html/js/accounting_item.js  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/js/accounting_item.js  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -76,6 +76,7 @@
        }
 
        var div_style="z-index:15;top:"+sx;
+       removeDiv('search_account');
        
add_div({id:'search_account',cssclass:'inner_box',html:loading(),style:div_style,drag:true});
 
     var dossier=$('gDossier').value;

Modified: phpcompta/trunk/html/js/anc_script.js
===================================================================
--- phpcompta/trunk/html/js/anc_script.js       2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/js/anc_script.js       2013-05-03 22:31:33 UTC (rev 
5216)
@@ -124,6 +124,9 @@
  */
 function verify_ca(div)
 {
+       try
+       {
+
     var idx=0;
     var amount_error=0;
     // put a maximum
@@ -168,6 +171,12 @@
         return false;
     }
     return true;
+       }
+       catch  (e)
+       {
+               alert(e.message);
+               return false;
+       }
 }
 /*!
  * \brief open a window for searching a CA account,
@@ -209,7 +218,7 @@
         }
     }
     );
-    
+
 }
 function search_anc_form(obj)
 {

Modified: phpcompta/trunk/html/js/card.js
===================================================================
--- phpcompta/trunk/html/js/card.js     2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/js/card.js     2013-05-03 22:31:33 UTC (rev 5216)
@@ -25,6 +25,35 @@
 
 var card_layer=1;
 /**
+ address@hidden search a card an display the result into a inner box
+ */
+function boxsearch_card(p_dossier)
+{
+       try
+       {
+       waiting_box();
+       removeDiv('boxsearch_card_div');
+       var 
queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+$(card_search).value;
+       var action = new Ajax.Request(
+                                 "ajax_misc.php" ,
+                                 {
+                                     method:'get', parameters:queryString,
+                                     onFailure:ajax_misc_failure,
+                                     onSuccess:function(req){
+                                               remove_waiting_box();
+                                               var y=posY+15;
+                                               var 
div_style="left:10%;width:80%;"+";top:"+y;
+                                               
add_div({id:'boxsearch_card_div',cssclass:'inner_box',html:loading(),style:div_style,drag:true});
+                                               
$('boxsearch_card_div').innerHTML=req.responseText;
+                                     }
+                                 }
+                                 );
+       }catch( e)
+       {
+               alert(e.getMessage);
+       }
+}
+/**
  address@hidden show the ipopup with the form to search a card
  * the properties
  *  - jrn for the ledger

Modified: phpcompta/trunk/html/js/infobulle.js
===================================================================
--- phpcompta/trunk/html/js/infobulle.js        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/js/infobulle.js        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -44,7 +44,11 @@
 content[14]="Attention, le poste comptable doit exister, il ne sera pas 
vérifié";
 content[15]="Laissez à 0 pour ne rien changer";
 content[16]="Vous devez donner la date par opération";
-
+content[17]="Cliquez sur le titre d'une colonne pour trier";
+content[18]="Donnez une partie du nom, prénom, de la description, du poste 
comptable, du n° de TVA ou quick code";
+content[19]="Donnez une partie du nom, de la description,  du n° de TVA ou 
quick code";
+content[20]="Les menus ne peuvent dépendre que dans d'un menu principal ou 
d'un menu, si cette liste est vide, ajouter des modules ou menu principal sans 
donner de dépendance";
+content[21]="Donnez un nombre entre 0 & 100";
 function showBulle(p_ctl)
 {
     d=document.getElementById('bulle');

Modified: phpcompta/trunk/html/js/lang/calendar-al.js
===================================================================
--- phpcompta/trunk/html/js/lang/calendar-al.js 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/js/lang/calendar-al.js 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -89,8 +89,7 @@
 
 Calendar._TT["CLOSE"] = "Mbyll";
 Calendar._TT["TODAY"] = "Sot";
-Calendar._TT["TIME_PART"] = "Kliko me (Shift-)ose terhiqe per te ndryshuar 
-vleren";
+Calendar._TT["TIME_PART"] = "Kliko me (Shift-)ose terhiqe per te ndryshuar 
vleren";
 
 // date formats
 Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";

Modified: phpcompta/trunk/html/js/lang/calendar-he-utf8.js
===================================================================
--- phpcompta/trunk/html/js/lang/calendar-he-utf8.js    2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/html/js/lang/calendar-he-utf8.js    2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -83,7 +83,7 @@
 "הגירסא האחרונה זמינה ב: http://www.dynarch.com/projects/calendar/\n"; +
 "מופץ תחת זיכיון ה GNU LGPL.  עיין ב http://gnu.org/licenses/lgpl.html לפרטים 
נוספים." +
 "\n\n" +
-בחירת תאריך:\n" +
+"בחירת תאריך:\n" +
 "- השתמש בכפתורים \xab, \xbb לבחירת שנה\n" +
 "- השתמש בכפתורים " + String.fromCharCode(0x2039) + ", " + 
String.fromCharCode(0x203a) + " לבחירת חודש\n" +
 "- החזק העכבר לחוץ מעל הכפתורים המוזכרים לעיל לבחירה מהירה יותר.";

Copied: phpcompta/trunk/html/js/nicEdit.js (from rev 5215, 
phpcompta/tags/rel650/html/js/nicEdit.js)
===================================================================
--- phpcompta/trunk/html/js/nicEdit.js                          (rev 0)
+++ phpcompta/trunk/html/js/nicEdit.js  2013-05-03 22:31:33 UTC (rev 5216)
@@ -0,0 +1,112 @@
+/* NicEdit - Micro Inline WYSIWYG
+ * Copyright 2007-2008 Brian Kirchoff
+ *
+ * NicEdit is distributed under the terms of the MIT license
+ * For more information visit http://nicedit.com/
+ * Do not remove this copyright message
+ */
+var bkExtend=function(){var A=arguments;if(A.length==1){A=[this,A[0]]}for(var 
B in A[1]){A[0][B]=A[1][B]}return A[0]};function 
bkClass(){}bkClass.prototype.construct=function(){};bkClass.extend=function(C){var
 A=function(){if(arguments[0]!==bkClass){return 
this.construct.apply(this,arguments)}};var B=new 
this(bkClass);bkExtend(B,C);A.prototype=B;A.extend=this.extend;return A};var 
bkElement=bkClass.extend({construct:function(B,A){if(typeof 
(B)=="string"){B=(A||document).createElement(B)}B=$BK(B);return 
B},appendTo:function(A){A.appendChild(this);return 
this},appendBefore:function(A){A.parentNode.insertBefore(this,A);return 
this},addEvent:function(B,A){bkLib.addEvent(this,B,A);return 
this},setContent:function(A){this.innerHTML=A;return this},pos:function(){var 
C=curtop=0;var 
B=obj=this;if(obj.offsetParent){do{C+=obj.offsetLeft;curtop+=obj.offsetTop}while(obj=obj.offsetParent)}var
 
A=(!window.opera)?parseInt(this.getStyle("border-width")||this.style.border)||0:0;return[C+A,curtop+A+this.offsetHeight]},noSelect:function(){bkLib.noSelect(this);return
 this},parentTag:function(A){var 
B=this;do{if(B&&B.nodeName&&B.nodeName.toUpperCase()==A){return 
B}B=B.parentNode}while(B);return false},hasClass:function(A){return 
this.className.match(new 
RegExp("(\\s|^)nicEdit-"+A+"(\\s|$)"))},addClass:function(A){if(!this.hasClass(A)){this.className+="
 nicEdit-"+A}return 
this},removeClass:function(A){if(this.hasClass(A)){this.className=this.className.replace(new
 RegExp("(\\s|^)nicEdit-"+A+"(\\s|$)")," ")}return 
this},setStyle:function(A){var B=this.style;for(var C in 
A){switch(C){case"float":B.cssFloat=B.styleFloat=A[C];break;case"opacity":B.opacity=A[C];B.filter="alpha(opacity="+Math.round(A[C]*100)+")";break;case"className":this.className=A[C];break;default:B[C]=A[C]}}return
 this},getStyle:function(A,C){var 
B=(!C)?document.defaultView:C;if(this.nodeType==1){return(B&&B.getComputedStyle)?B.getComputedStyle(this,null).getPropertyValue(A):this.currentStyle[bkLib.camelize(A)]}},remove:function(){this.parentNode.removeChild(this);return
 this},setAttributes:function(A){for(var B in A){this[B]=A[B]}return 
this}});var 
bkLib={isMSIE:(navigator.appVersion.indexOf("MSIE")!=-1),addEvent:function(C,B,A){(C.addEventListener)?C.addEventListener(B,A,false):C.attachEvent("on"+B,A)},toArray:function(C){var
 B=C.length,A=new Array(B);while(B--){A[B]=C[B]}return 
A},noSelect:function(B){if(B.setAttribute&&B.nodeName.toLowerCase()!="input"&&B.nodeName.toLowerCase()!="textarea"){B.setAttribute("unselectable","on")}for(var
 
A=0;A<B.childNodes.length;A++){bkLib.noSelect(B.childNodes[A])}},camelize:function(A){return
 A.replace(/\-(.)/g,function(B,C){return 
C.toUpperCase()})},inArray:function(A,B){return(bkLib.search(A,B)!=null)},search:function(A,C){for(var
 B=0;B<A.length;B++){if(A[B]==C){return B}}return 
null},cancelEvent:function(A){A=A||window.event;if(A.preventDefault&&A.stopPropagation){A.preventDefault();A.stopPropagation()}return
 false},domLoad:[],domLoaded:function(){if(arguments.callee.done){return 
}arguments.callee.done=true;for(i=0;i<bkLib.domLoad.length;i++){bkLib.domLoad[i]()}},onDomLoaded:function(A){this.domLoad.push(A);if(document.addEventListener){document.addEventListener("DOMContentLoaded",bkLib.domLoaded,null)}else{if(bkLib.isMSIE){document.write("<style>.nicEdit-main
 p { margin: 0; }</style><script id=__ie_onload defer 
"+((location.protocol=="https:")?"src='javascript:void(0)'":"src=//0")+"><\/script>");$BK("__ie_onload").onreadystatechange=function(){if(this.readyState=="complete"){bkLib.domLoaded()}}}}window.onload=bkLib.domLoaded}};function
 $BK(A){if(typeof 
(A)=="string"){A=document.getElementById(A)}return(A&&!A.appendTo)?bkExtend(A,bkElement.prototype):A}var
 
bkEvent={addEvent:function(A,B){if(B){this.eventList=this.eventList||{};this.eventList[A]=this.eventList[A]||[];this.eventList[A].push(B)}return
 this},fireEvent:function(){var 
A=bkLib.toArray(arguments),C=A.shift();if(this.eventList&&this.eventList[C]){for(var
 
B=0;B<this.eventList[C].length;B++){this.eventList[C][B].apply(this,A)}}}};function
 __(A){return A}Function.prototype.closure=function(){var 
A=this,B=bkLib.toArray(arguments),C=B.shift();return function(){if(typeof 
(bkLib)!="undefined"){return 
A.apply(C,B.concat(bkLib.toArray(arguments)))}}};Function.prototype.closureListener=function(){var
 A=this,C=bkLib.toArray(arguments),B=C.shift();return 
function(E){E=E||window.event;if(E.target){var D=E.target}else{var 
D=E.srcElement}return A.apply(B,[E,D].concat(C))}};
+
+
+
+var nicEditorConfig = bkClass.extend({
+       buttons : {
+               'bold' : {name : __('Click to Bold'), command : 'Bold', tags : 
['B','STRONG'], css : {'font-weight' : 'bold'}, key : 'b'},
+               'italic' : {name : __('Click to Italic'), command : 'Italic', 
tags : ['EM','I'], css : {'font-style' : 'italic'}, key : 'i'},
+               'underline' : {name : __('Click to Underline'), command : 
'Underline', tags : ['U'], css : {'text-decoration' : 'underline'}, key : 'u'},
+               'left' : {name : __('Left Align'), command : 'justifyleft', 
noActive : true},
+               'center' : {name : __('Center Align'), command : 
'justifycenter', noActive : true},
+               'right' : {name : __('Right Align'), command : 'justifyright', 
noActive : true},
+               'justify' : {name : __('Justify Align'), command : 
'justifyfull', noActive : true},
+               'ol' : {name : __('Insert Ordered List'), command : 
'insertorderedlist', tags : ['OL']},
+               'ul' :  {name : __('Insert Unordered List'), command : 
'insertunorderedlist', tags : ['UL']},
+               'subscript' : {name : __('Click to Subscript'), command : 
'subscript', tags : ['SUB']},
+               'superscript' : {name : __('Click to Superscript'), command : 
'superscript', tags : ['SUP']},
+               'strikethrough' : {name : __('Click to Strike Through'), 
command : 'strikeThrough', css : {'text-decoration' : 'line-through'}},
+               'removeformat' : {name : __('Remove Formatting'), command : 
'removeformat', noActive : true},
+               'indent' : {name : __('Indent Text'), command : 'indent', 
noActive : true},
+               'outdent' : {name : __('Remove Indent'), command : 'outdent', 
noActive : true},
+               'hr' : {name : __('Horizontal Rule'), command : 
'insertHorizontalRule', noActive : true}
+       },
+       iconsPath : '../nicEditorIcons.gif',
+       buttonList : 
['save','bold','italic','underline','left','center','right','justify','ol','ul','fontSize','fontFamily','fontFormat','indent','outdent','image','upload','link','unlink','forecolor','bgcolor'],
+       iconList : 
{"bgcolor":1,"forecolor":2,"bold":3,"center":4,"hr":5,"indent":6,"italic":7,"justify":8,"left":9,"ol":10,"outdent":11,"removeformat":12,"right":13,"save":24,"strikethrough":15,"subscript":16,"superscript":17,"ul":18,"underline":19,"image":20,"link":21,"unlink":22,"close":23,"arrow":25,"upload":26}
+       
+});
+;
+var 
nicEditors={nicPlugins:[],editors:[],registerPlugin:function(B,A){this.nicPlugins.push({p:B,o:A})},allTextAreas:function(C){var
 A=document.getElementsByTagName("textarea");for(var 
B=0;B<A.length;B++){nicEditors.editors.push(new 
nicEditor(C).panelInstance(A[B]))}return 
nicEditors.editors},findEditor:function(C){var B=nicEditors.editors;for(var 
A=0;A<B.length;A++){if(B[A].instanceById(C)){return 
B[A].instanceById(C)}}}};var 
nicEditor=bkClass.extend({construct:function(C){this.options=new 
nicEditorConfig();bkExtend(this.options,C);this.nicInstances=new 
Array();this.loadedPlugins=new Array();var A=nicEditors.nicPlugins;for(var 
B=0;B<A.length;B++){this.loadedPlugins.push(new 
A[B].p(this,A[B].o))}nicEditors.editors.push(this);bkLib.addEvent(document.body,"mousedown",this.selectCheck.closureListener(this))},panelInstance:function(B,C){B=this.checkReplace($BK(B));var
 A=new 
bkElement("DIV").setStyle({width:(parseInt(B.getStyle("width"))||B.clientWidth)+"px"}).appendBefore(B);this.setPanel(A);return
 this.addInstance(B,C)},checkReplace:function(B){var 
A=nicEditors.findEditor(B);if(A){A.removeInstance(B);A.removePanel()}return 
B},addInstance:function(B,C){B=this.checkReplace($BK(B));if(B.contentEditable||!!window.opera){var
 A=new nicEditorInstance(B,C,this)}else{var A=new 
nicEditorIFrameInstance(B,C,this)}this.nicInstances.push(A);return 
this},removeInstance:function(C){C=$BK(C);var B=this.nicInstances;for(var 
A=0;A<B.length;A++){if(B[A].e==C){B[A].remove();this.nicInstances.splice(A,1)}}},removePanel:function(A){if(this.nicPanel){this.nicPanel.remove();this.nicPanel=null}},instanceById:function(C){C=$BK(C);var
 B=this.nicInstances;for(var A=0;A<B.length;A++){if(B[A].e==C){return 
B[A]}}},setPanel:function(A){this.nicPanel=new 
nicEditorPanel($BK(A),this.options,this);this.fireEvent("panel",this.nicPanel);return
 
this},nicCommand:function(B,A){if(this.selectedInstance){this.selectedInstance.nicCommand(B,A)}},getIcon:function(D,A){var
 C=this.options.iconList[D];var 
B=(A.iconFiles)?A.iconFiles[D]:"";return{backgroundImage:"url('"+((C)?this.options.iconsPath:B)+"')",backgroundPosition:((C)?((C-1)*-18):0)+"px
 0px"}},selectCheck:function(C,A){var 
B=false;do{if(A.className&&A.className.indexOf("nicEdit")!=-1){return 
false}}while(A=A.parentNode);this.fireEvent("blur",this.selectedInstance,A);this.lastSelectedInstance=this.selectedInstance;this.selectedInstance=null;return
 false}});nicEditor=nicEditor.extend(bkEvent);
+var 
nicEditorInstance=bkClass.extend({isSelected:false,construct:function(G,D,C){this.ne=C;this.elm=this.e=G;this.options=D||{};newX=parseInt(G.getStyle("width"))||G.clientWidth;newY=parseInt(G.getStyle("height"))||G.clientHeight;this.initialHeight=newY-8;var
 H=(G.nodeName.toLowerCase()=="textarea");if(H||this.options.hasPanel){var 
B=(bkLib.isMSIE&&!((typeof 
document.body.style.maxHeight!="undefined")&&document.compatMode=="CSS1Compat"));var
 E={width:newX+"px",border:"1px solid 
#ccc",borderTop:0,overflowY:"auto",overflowX:"hidden"};E[(B)?"height":"maxHeight"]=(this.ne.options.maxHeight)?this.ne.options.maxHeight+"px":null;this.editorContain=new
 bkElement("DIV").setStyle(E).appendBefore(G);var A=new 
bkElement("DIV").setStyle({width:(newX-8)+"px",margin:"4px",minHeight:newY+"px"}).addClass("main").appendTo(this.editorContain);G.setStyle({display:"none"});A.innerHTML=G.innerHTML;if(H){A.setContent(G.value);this.copyElm=G;var
 
F=G.parentTag("FORM");if(F){bkLib.addEvent(F,"submit",this.saveContent.closure(this))}}A.setStyle((B)?{height:newY+"px"}:{overflow:"hidden"});this.elm=A}this.ne.addEvent("blur",this.blur.closure(this));this.init();this.blur()},init:function(){this.elm.setAttribute("contentEditable","true");if(this.getContent()==""){this.setContent("<br
 
/>")}this.instanceDoc=document.defaultView;this.elm.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keypress",this.keyDown.closureListener(this)).addEvent("focus",this.selected.closure(this)).addEvent("blur",this.blur.closure(this)).addEvent("keyup",this.selected.closure(this));this.ne.fireEvent("add",this)},remove:function(){this.saveContent();if(this.copyElm||this.options.hasPanel){this.editorContain.remove();this.e.setStyle({display:"block"});this.ne.removePanel()}this.disable();this.ne.fireEvent("remove",this)},disable:function(){this.elm.setAttribute("contentEditable","false")},getSel:function(){return(window.getSelection)?window.getSelection():document.selection},getRng:function(){var
 A=this.getSel();if(!A||A.rangeCount===0){return 
}return(A.rangeCount>0)?A.getRangeAt(0):A.createRange()},selRng:function(A,B){if(window.getSelection){B.removeAllRanges();B.addRange(A)}else{A.select()}},selElm:function(){var
 C=this.getRng();if(!C){return }if(C.startContainer){var 
D=C.startContainer;if(C.cloneContents().childNodes.length==1){for(var 
B=0;B<D.childNodes.length;B++){var 
A=D.childNodes[B].ownerDocument.createRange();A.selectNode(D.childNodes[B]);if(C.compareBoundaryPoints(Range.START_TO_START,A)!=1&&C.compareBoundaryPoints(Range.END_TO_END,A)!=-1){return
 $BK(D.childNodes[B])}}}return $BK(D)}else{return 
$BK((this.getSel().type=="Control")?C.item(0):C.parentElement())}},saveRng:function(){this.savedRange=this.getRng();this.savedSel=this.getSel()},restoreRng:function(){if(this.savedRange){this.selRng(this.savedRange,this.savedSel)}},keyDown:function(B,A){if(B.ctrlKey){this.ne.fireEvent("key",this,B)}},selected:function(C,A){if(!A&&!(A=this.selElm)){A=this.selElm()}if(!C.ctrlKey){var
 
B=this.ne.selectedInstance;if(B!=this){if(B){this.ne.fireEvent("blur",B,A)}this.ne.selectedInstance=this;this.ne.fireEvent("focus",B,A)}this.ne.fireEvent("selected",B,A);this.isFocused=true;this.elm.addClass("selected")}return
 
false},blur:function(){this.isFocused=false;this.elm.removeClass("selected")},saveContent:function(){if(this.copyElm||this.options.hasPanel){this.ne.fireEvent("save",this);(this.copyElm)?this.copyElm.value=this.getContent():this.e.innerHTML=this.getContent()}},getElm:function(){return
 
this.elm},getContent:function(){this.content=this.getElm().innerHTML;this.ne.fireEvent("get",this);return
 
this.content},setContent:function(A){this.content=A;this.ne.fireEvent("set",this);this.elm.innerHTML=this.content},nicCommand:function(B,A){document.execCommand(B,false,A)}});
+var 
nicEditorIFrameInstance=nicEditorInstance.extend({savedStyles:[],init:function(){var
 
B=this.elm.innerHTML.replace(/^\s+|\s+$/g,"");this.elm.innerHTML="";(!B)?B="<br 
/>":B;this.initialContent=B;this.elmFrame=new 
bkElement("iframe").setAttributes({src:"javascript:;",frameBorder:0,allowTransparency:"true",scrolling:"no"}).setStyle({height:"100px",width:"100%"}).addClass("frame").appendTo(this.elm);if(this.copyElm){this.elmFrame.setStyle({width:(this.elm.offsetWidth-4)+"px"})}var
 A=["font-size","font-family","font-weight","color"];for(itm in 
A){this.savedStyles[bkLib.camelize(itm)]=this.elm.getStyle(itm)}setTimeout(this.initFrame.closure(this),50)},disable:function(){this.elm.innerHTML=this.getContent()},initFrame:function(){var
 B=$BK(this.elmFrame.contentWindow.document);B.designMode="on";B.open();var 
A=this.ne.options.externalCSS;B.write("<html><head>"+((A)?'<link href="'+A+'" 
rel="stylesheet" type="text/css" />':"")+'</head><body id="nicEditContent" 
style="margin: 0 !important; background-color: transparent 
!important;">'+this.initialContent+"</body></html>");B.close();this.frameDoc=B;this.frameWin=$BK(this.elmFrame.contentWindow);this.frameContent=$BK(this.frameWin.document.body).setStyle(this.savedStyles);this.instanceDoc=this.frameWin.document.defaultView;this.heightUpdate();this.frameDoc.addEvent("mousedown",this.selected.closureListener(this)).addEvent("keyup",this.heightUpdate.closureListener(this)).addEvent("keydown",this.keyDown.closureListener(this)).addEvent("keyup",this.selected.closure(this));this.ne.fireEvent("add",this)},getElm:function(){return
 
this.frameContent},setContent:function(A){this.content=A;this.ne.fireEvent("set",this);this.frameContent.innerHTML=this.content;this.heightUpdate()},getSel:function(){return(this.frameWin)?this.frameWin.getSelection():this.frameDoc.selection},heightUpdate:function(){this.elmFrame.style.height=Math.max(this.frameContent.offsetHeight,this.initialHeight)+"px"},nicCommand:function(B,A){this.frameDoc.execCommand(B,false,A);setTimeout(this.heightUpdate.closure(this),100)}});
+var 
nicEditorPanel=bkClass.extend({construct:function(E,B,A){this.elm=E;this.options=B;this.ne=A;this.panelButtons=new
 
Array();this.buttonList=bkExtend([],this.ne.options.buttonList);this.panelContain=new
 bkElement("DIV").setStyle({overflow:"hidden",width:"100%",border:"1px solid 
#cccccc",backgroundColor:"#efefef"}).addClass("panelContain");this.panelElm=new 
bkElement("DIV").setStyle({margin:"2px",marginTop:"0px",zoom:1,overflow:"hidden"}).addClass("panel").appendTo(this.panelContain);this.panelContain.appendTo(E);var
 C=this.ne.options;var D=C.buttons;for(button in 
D){this.addButton(button,C,true)}this.reorder();E.noSelect()},addButton:function(buttonName,options,noOrder){var
 button=options.buttons[buttonName];var 
type=(button.type)?eval("(typeof("+button.type+') == "undefined") ? null : 
'+button.type+";"):nicEditorButton;var 
hasButton=bkLib.inArray(this.buttonList,buttonName);if(type&&(hasButton||this.ne.options.fullPanel)){this.panelButtons.push(new
 
type(this.panelElm,buttonName,options,this.ne));if(!hasButton){this.buttonList.push(buttonName)}}},findButton:function(B){for(var
 A=0;A<this.panelButtons.length;A++){if(this.panelButtons[A].name==B){return 
this.panelButtons[A]}}},reorder:function(){var C=this.buttonList;for(var 
B=0;B<C.length;B++){var 
A=this.findButton(C[B]);if(A){this.panelElm.appendChild(A.margin)}}},remove:function(){this.elm.remove()}});
+var 
nicEditorButton=bkClass.extend({construct:function(D,A,C,B){this.options=C.buttons[A];this.name=A;this.ne=B;this.elm=D;this.margin=new
 
bkElement("DIV").setStyle({"float":"left",marginTop:"2px"}).appendTo(D);this.contain=new
 
bkElement("DIV").setStyle({width:"20px",height:"20px"}).addClass("buttonContain").appendTo(this.margin);this.border=new
 bkElement("DIV").setStyle({backgroundColor:"#efefef",border:"1px solid 
#efefef"}).appendTo(this.contain);this.button=new 
bkElement("DIV").setStyle({width:"18px",height:"18px",overflow:"hidden",zoom:1,cursor:"pointer"}).addClass("button").setStyle(this.ne.getIcon(A,C)).appendTo(this.border);this.button.addEvent("mouseover",this.hoverOn.closure(this)).addEvent("mouseout",this.hoverOff.closure(this)).addEvent("mousedown",this.mouseClick.closure(this)).noSelect();if(!window.opera){this.button.onmousedown=this.button.onclick=bkLib.cancelEvent}B.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this)).addEvent("key",this.key.closure(this));this.disable();this.init()},init:function(){},hide:function(){this.contain.setStyle({display:"none"})},updateState:function(){if(this.isDisabled){this.setBg()}else{if(this.isHover){this.setBg("hover")}else{if(this.isActive){this.setBg("active")}else{this.setBg()}}}},setBg:function(A){switch(A){case"hover":var
 B={border:"1px solid #666",backgroundColor:"#ddd"};break;case"active":var 
B={border:"1px solid #666",backgroundColor:"#ccc"};break;default:var 
B={border:"1px solid 
#efefef",backgroundColor:"#efefef"}}this.border.setStyle(B).addClass("button-"+A)},checkNodes:function(A){var
 
B=A;do{if(this.options.tags&&bkLib.inArray(this.options.tags,B.nodeName)){this.activate();return
 
true}}while(B=B.parentNode&&B.className!="nicEdit");B=$BK(A);while(B.nodeType==3){B=$BK(B.parentNode)}if(this.options.css){for(itm
 in 
this.options.css){if(B.getStyle(itm,this.ne.selectedInstance.instanceDoc)==this.options.css[itm]){this.activate();return
 true}}}this.deactivate();return 
false},activate:function(){if(!this.isDisabled){this.isActive=true;this.updateState();this.ne.fireEvent("buttonActivate",this)}},deactivate:function(){this.isActive=false;this.updateState();if(!this.isDisabled){this.ne.fireEvent("buttonDeactivate",this)}},enable:function(A,B){this.isDisabled=false;this.contain.setStyle({opacity:1}).addClass("buttonEnabled");this.updateState();this.checkNodes(B)},disable:function(A,B){this.isDisabled=true;this.contain.setStyle({opacity:0.6}).removeClass("buttonEnabled");this.updateState()},toggleActive:function(){(this.isActive)?this.deactivate():this.activate()},hoverOn:function(){if(!this.isDisabled){this.isHover=true;this.updateState();this.ne.fireEvent("buttonOver",this)}},hoverOff:function(){this.isHover=false;this.updateState();this.ne.fireEvent("buttonOut",this)},mouseClick:function(){if(this.options.command){this.ne.nicCommand(this.options.command,this.options.commandArgs);if(!this.options.noActive){this.toggleActive()}}this.ne.fireEvent("buttonClick",this)},key:function(A,B){if(this.options.key&&B.ctrlKey&&String.fromCharCode(B.keyCode||B.charCode).toLowerCase()==this.options.key){this.mouseClick();if(B.preventDefault){B.preventDefault()}}}});
+var 
nicPlugin=bkClass.extend({construct:function(B,A){this.options=A;this.ne=B;this.ne.addEvent("panel",this.loadPanel.closure(this));this.init()},loadPanel:function(C){var
 B=this.options.buttons;for(var A in 
B){C.addButton(A,this.options)}C.reorder()},init:function(){}});
+
+
+var nicPaneOptions = { };
+
+var 
nicEditorPane=bkClass.extend({construct:function(D,C,B,A){this.ne=C;this.elm=D;this.pos=D.pos();this.contain=new
 
bkElement("div").setStyle({zIndex:"99999",overflow:"hidden",position:"absolute",left:this.pos[0]+"px",top:this.pos[1]+"px"});this.pane=new
 bkElement("div").setStyle({fontSize:"12px",border:"1px solid 
#ccc",overflow:"hidden",padding:"4px",textAlign:"left",backgroundColor:"#ffffc9"}).addClass("pane").setStyle(B).appendTo(this.contain);if(A&&!A.options.noClose){this.close=new
 
bkElement("div").setStyle({"float":"right",height:"16px",width:"16px",cursor:"pointer"}).setStyle(this.ne.getIcon("close",nicPaneOptions)).addEvent("mousedown",A.removePane.closure(this)).appendTo(this.pane)}this.contain.noSelect().appendTo(document.body);this.position();this.init()},init:function(){},position:function(){if(this.ne.nicPanel){var
 B=this.ne.nicPanel.elm;var A=B.pos();var 
C=A[0]+parseInt(B.getStyle("width"))-(parseInt(this.pane.getStyle("width"))+8);if(C<this.pos[0]){this.contain.setStyle({left:C+"px"})}}},toggle:function(){this.isVisible=!this.isVisible;this.contain.setStyle({display:((this.isVisible)?"block":"none")})},remove:function(){if(this.contain){this.contain.remove();this.contain=null}},append:function(A){A.appendTo(this.pane)},setContent:function(A){this.pane.setContent(A)}});
+
+var 
nicEditorAdvancedButton=nicEditorButton.extend({init:function(){this.ne.addEvent("selected",this.removePane.closure(this)).addEvent("blur",this.removePane.closure(this))},mouseClick:function(){if(!this.isDisabled){if(this.pane&&this.pane.pane){this.removePane()}else{this.pane=new
 
nicEditorPane(this.contain,this.ne,{width:(this.width||"270px"),backgroundColor:"#fff"},this);this.addPane();this.ne.selectedInstance.saveRng()}}},addForm:function(C,G){this.form=new
 
bkElement("form").addEvent("submit",this.submit.closureListener(this));this.pane.append(this.form);this.inputs={};for(itm
 in C){var D=C[itm];var 
F="";if(G){F=G.getAttribute(itm)}if(!F){F=D.value||""}var 
A=C[itm].type;if(A=="title"){new 
bkElement("div").setContent(D.txt).setStyle({fontSize:"14px",fontWeight:"bold",padding:"0px",margin:"2px
 0"}).appendTo(this.form)}else{var B=new 
bkElement("div").setStyle({overflow:"hidden",clear:"both"}).appendTo(this.form);if(D.txt){new
 
bkElement("label").setAttributes({"for":itm}).setContent(D.txt).setStyle({margin:"2px
 
4px",fontSize:"13px",width:"50px",lineHeight:"20px",textAlign:"right","float":"left"}).appendTo(B)}switch(A){case"text":this.inputs[itm]=new
 
bkElement("input").setAttributes({id:itm,value:F,type:"text"}).setStyle({margin:"2px
 0",fontSize:"13px","float":"left",height:"20px",border:"1px solid 
#ccc",overflow:"hidden"}).setStyle(D.style).appendTo(B);break;case"select":this.inputs[itm]=new
 bkElement("select").setAttributes({id:itm}).setStyle({border:"1px solid 
#ccc","float":"left",margin:"2px 0"}).appendTo(B);for(opt in D.options){var 
E=new 
bkElement("option").setAttributes({value:opt,selected:(opt==F)?"selected":""}).setContent(D.options[opt]).appendTo(this.inputs[itm])}break;case"content":this.inputs[itm]=new
 bkElement("textarea").setAttributes({id:itm}).setStyle({border:"1px solid 
#ccc","float":"left"}).setStyle(D.style).appendTo(B);this.inputs[itm].value=F}}}new
 
bkElement("input").setAttributes({type:"submit"}).setStyle({backgroundColor:"#efefef",border:"1px
 solid #ccc",margin:"3px 
0","float":"left",clear:"both"}).appendTo(this.form);this.form.onsubmit=bkLib.cancelEvent},submit:function(){},findElm:function(B,A,E){var
 D=this.ne.selectedInstance.getElm().getElementsByTagName(B);for(var 
C=0;C<D.length;C++){if(D[C].getAttribute(A)==E){return 
$BK(D[C])}}},removePane:function(){if(this.pane){this.pane.remove();this.pane=null;this.ne.selectedInstance.restoreRng()}}});
+
+var 
nicButtonTips=bkClass.extend({construct:function(A){this.ne=A;A.addEvent("buttonOver",this.show.closure(this)).addEvent("buttonOut",this.hide.closure(this))},show:function(A){this.timer=setTimeout(this.create.closure(this,A),400)},create:function(A){this.timer=null;if(!this.pane){this.pane=new
 
nicEditorPane(A.button,this.ne,{fontSize:"12px",marginTop:"5px"});this.pane.setContent(A.options.name)}},hide:function(A){if(this.timer){clearTimeout(this.timer)}if(this.pane){this.pane=this.pane.remove()}}});nicEditors.registerPlugin(nicButtonTips);
+
+
+var nicSelectOptions = {
+       buttons : {
+               'fontSize' : {name : __('Select Font Size'), type : 
'nicEditorFontSizeSelect', command : 'fontsize'},
+               'fontFamily' : {name : __('Select Font Family'), type : 
'nicEditorFontFamilySelect', command : 'fontname'},
+               'fontFormat' : {name : __('Select Font Format'), type : 
'nicEditorFontFormatSelect', command : 'formatBlock'}
+       }
+};
+
+var 
nicEditorSelect=bkClass.extend({construct:function(D,A,C,B){this.options=C.buttons[A];this.elm=D;this.ne=B;this.name=A;this.selOptions=new
 Array();this.margin=new bkElement("div").setStyle({"float":"left",margin:"2px 
1px 0 1px"}).appendTo(this.elm);this.contain=new 
bkElement("div").setStyle({width:"90px",height:"20px",cursor:"pointer",overflow:"hidden"}).addClass("selectContain").addEvent("click",this.toggle.closure(this)).appendTo(this.margin);this.items=new
 bkElement("div").setStyle({overflow:"hidden",zoom:1,border:"1px solid 
#ccc",paddingLeft:"3px",backgroundColor:"#fff"}).appendTo(this.contain);this.control=new
 
bkElement("div").setStyle({overflow:"hidden","float":"right",height:"18px",width:"16px"}).addClass("selectControl").setStyle(this.ne.getIcon("arrow",C)).appendTo(this.items);this.txt=new
 
bkElement("div").setStyle({overflow:"hidden","float":"left",width:"66px",height:"14px",marginTop:"1px",fontFamily:"sans-serif",textAlign:"center",fontSize:"12px"}).addClass("selectTxt").appendTo(this.items);if(!window.opera){this.contain.onmousedown=this.control.onmousedown=this.txt.onmousedown=bkLib.cancelEvent}this.margin.noSelect();this.ne.addEvent("selected",this.enable.closure(this)).addEvent("blur",this.disable.closure(this));this.disable();this.init()},disable:function(){this.isDisabled=true;this.close();this.contain.setStyle({opacity:0.6})},enable:function(A){this.isDisabled=false;this.close();this.contain.setStyle({opacity:1})},setDisplay:function(A){this.txt.setContent(A)},toggle:function(){if(!this.isDisabled){(this.pane)?this.close():this.open()}},open:function(){this.pane=new
 
nicEditorPane(this.items,this.ne,{width:"88px",padding:"0px",borderTop:0,borderLeft:"1px
 solid #ccc",borderRight:"1px solid 
#ccc",borderBottom:"0px",backgroundColor:"#fff"});for(var 
C=0;C<this.selOptions.length;C++){var B=this.selOptions[C];var A=new 
bkElement("div").setStyle({overflow:"hidden",borderBottom:"1px solid 
#ccc",width:"88px",textAlign:"left",overflow:"hidden",cursor:"pointer"});var 
D=new bkElement("div").setStyle({padding:"0px 
4px"}).setContent(B[1]).appendTo(A).noSelect();D.addEvent("click",this.update.closure(this,B[0])).addEvent("mouseover",this.over.closure(this,D)).addEvent("mouseout",this.out.closure(this,D)).setAttributes("id",B[0]);this.pane.append(A);if(!window.opera){D.onmousedown=bkLib.cancelEvent}}},close:function(){if(this.pane){this.pane=this.pane.remove()}},over:function(A){A.setStyle({backgroundColor:"#ccc"})},out:function(A){A.setStyle({backgroundColor:"#fff"})},add:function(B,A){this.selOptions.push(new
 
Array(B,A))},update:function(A){this.ne.nicCommand(this.options.command,A);this.close()}});var
 
nicEditorFontSizeSelect=nicEditorSelect.extend({sel:{1:"1&nbsp;(8pt)",2:"2&nbsp;(10pt)",3:"3&nbsp;(12pt)",4:"4&nbsp;(14pt)",5:"5&nbsp;(18pt)",6:"6&nbsp;(24pt)"},init:function(){this.setDisplay("Font&nbsp;Size...");for(itm
 in this.sel){this.add(itm,'<font 
size="'+itm+'">'+this.sel[itm]+"</font>")}}});var 
nicEditorFontFamilySelect=nicEditorSelect.extend({sel:{arial:"Arial","comic 
sans ms":"Comic Sans","courier new":"Courier 
New",georgia:"Georgia",helvetica:"Helvetica",impact:"Impact","times new 
roman":"Times","trebuchet 
ms":"Trebuchet",verdana:"Verdana"},init:function(){this.setDisplay("Font&nbsp;Family...");for(itm
 in this.sel){this.add(itm,'<font 
face="'+itm+'">'+this.sel[itm]+"</font>")}}});var 
nicEditorFontFormatSelect=nicEditorSelect.extend({sel:{p:"Paragraph",pre:"Pre",h6:"Heading&nbsp;6",h5:"Heading&nbsp;5",h4:"Heading&nbsp;4",h3:"Heading&nbsp;3",h2:"Heading&nbsp;2",h1:"Heading&nbsp;1"},init:function(){this.setDisplay("Font&nbsp;Format...");for(itm
 in this.sel){var A=itm.toUpperCase();this.add("<"+A+">","<"+itm+' 
style="padding: 0px; margin: 
0px;">'+this.sel[itm]+"</"+A+">")}}});nicEditors.registerPlugin(nicPlugin,nicSelectOptions);
+
+
+var nicLinkOptions = {
+       buttons : {
+               'link' : {name : 'Add Link', type : 'nicLinkButton', tags : 
['A']},
+               'unlink' : {name : 'Remove Link',  command : 'unlink', noActive 
: true}
+       }
+};
+
+var 
nicLinkButton=nicEditorAdvancedButton.extend({addPane:function(){this.ln=this.ne.selectedInstance.selElm().parentTag("A");this.addForm({"":{type:"title",txt:"Add/Edit
 
Link"},href:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},title:{type:"text",txt:"Title"},target:{type:"select",txt:"Open
 In",options:{"":"Current Window",_blank:"New 
Window"},style:{width:"100px"}}},this.ln)},submit:function(C){var 
A=this.inputs.href.value;if(A=="http://";||A==""){alert("You must enter a URL to 
Create a Link");return false}this.removePane();if(!this.ln){var 
B="javascript:nicTemp();";this.ne.nicCommand("createlink",B);this.ln=this.findElm("A","href",B)}if(this.ln){this.ln.setAttributes({href:this.inputs.href.value,title:this.inputs.title.value,target:this.inputs.target.options[this.inputs.target.selectedIndex].value})}}});nicEditors.registerPlugin(nicPlugin,nicLinkOptions);
+
+
+var nicColorOptions = {
+       buttons : {
+               'forecolor' : {name : __('Change Text Color'), type : 
'nicEditorColorButton', noClose : true},
+               'bgcolor' : {name : __('Change Background Color'), type : 
'nicEditorBgColorButton', noClose : true}
+       }
+};
+
+var 
nicEditorColorButton=nicEditorAdvancedButton.extend({addPane:function(){var 
D={0:"00",1:"33",2:"66",3:"99",4:"CC",5:"FF"};var H=new 
bkElement("DIV").setStyle({width:"270px"});for(var A in D){for(var F in 
D){for(var E in D){var I="#"+D[A]+D[E]+D[F];var C=new 
bkElement("DIV").setStyle({cursor:"pointer",height:"15px","float":"left"}).appendTo(H);var
 G=new bkElement("DIV").setStyle({border:"2px solid "+I}).appendTo(C);var B=new 
bkElement("DIV").setStyle({backgroundColor:I,overflow:"hidden",width:"11px",height:"11px"}).addEvent("click",this.colorSelect.closure(this,I)).addEvent("mouseover",this.on.closure(this,G)).addEvent("mouseout",this.off.closure(this,G,I)).appendTo(G);if(!window.opera){C.onmousedown=B.onmousedown=bkLib.cancelEvent}}}}this.pane.append(H.noSelect())},colorSelect:function(A){this.ne.nicCommand("foreColor",A);this.removePane()},on:function(A){A.setStyle({border:"2px
 solid #000"})},off:function(A,B){A.setStyle({border:"2px solid "+B})}});var 
nicEditorBgColorButton=nicEditorColorButton.extend({colorSelect:function(A){this.ne.nicCommand("hiliteColor",A);this.removePane()}});nicEditors.registerPlugin(nicPlugin,nicColorOptions);
+
+
+var nicImageOptions = {
+       buttons : {
+               'image' : {name : 'Add Image', type : 'nicImageButton', tags : 
['IMG']}
+       }
+       
+};
+
+var 
nicImageButton=nicEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm({"":{type:"title",txt:"Add/Edit
 
Image"},src:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},alt:{type:"text",txt:"Alt
 
Text",style:{width:"100px"}},align:{type:"select",txt:"Align",options:{none:"Default",left:"Left",right:"Right"}}},this.im)},submit:function(B){var
 C=this.inputs.src.value;if(C==""||C=="http://";){alert("You must enter a Image 
URL to insert");return false}this.removePane();if(!this.im){var 
A="javascript:nicImTemp();";this.ne.nicCommand("insertImage",A);this.im=this.findElm("IMG","src",A)}if(this.im){this.im.setAttributes({src:this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}}});nicEditors.registerPlugin(nicPlugin,nicImageOptions);
+
+
+var nicSaveOptions = {
+       buttons : {
+               'save' : {name : __('Save this content'), type : 
'nicEditorSaveButton'}
+       }
+};
+
+var 
nicEditorSaveButton=nicEditorButton.extend({init:function(){if(!this.ne.options.onSave){this.margin.setStyle({display:"none"})}},mouseClick:function(){var
 B=this.ne.options.onSave;var 
A=this.ne.selectedInstance;B(A.getContent(),A.elm.id,A)}});nicEditors.registerPlugin(nicPlugin,nicSaveOptions);
+
+
+var nicUploadOptions = {
+       buttons : {
+               'upload' : {name : 'Upload Image', type : 'nicUploadButton'}
+       }
+       
+};
+
+var 
nicUploadButton=nicEditorAdvancedButton.extend({nicURI:"http://api.imgur.com/2/upload.json",errorText:"Failed
 to upload image",addPane:function(){if(typeof 
window.FormData==="undefined"){return this.onError("Image uploads are not 
supported in this browser, use Chrome, Firefox, or Safari 
instead.")}this.im=this.ne.selectedInstance.selElm().parentTag("IMG");var A=new 
bkElement("div").setStyle({padding:"10px"}).appendTo(this.pane.pane);new 
bkElement("div").setStyle({fontSize:"14px",fontWeight:"bold",paddingBottom:"5px"}).setContent("Insert
 an Image").appendTo(A);this.fileInput=new 
bkElement("input").setAttributes({type:"file"}).appendTo(A);this.progress=new 
bkElement("progress").setStyle({width:"100%",display:"none"}).setAttributes("max",100).appendTo(A);this.fileInput.onchange=this.uploadFile.closure(this)},onError:function(A){this.removePane();alert(A||"Failed
 to upload image")},uploadFile:function(){var 
B=this.fileInput.files[0];if(!B||!B.type.match(/image.*/)){this.onError("Only 
image files can be uploaded");return 
}this.fileInput.setStyle({display:"none"});this.setProgress(0);var A=new 
FormData();A.append("image",B);A.append("key","b7ea18a4ecbda8e92203fa4968d10660");var
 C=new 
XMLHttpRequest();C.open("POST",this.ne.options.uploadURI||this.nicURI);C.onload=function(){try{var
 D=JSON.parse(C.responseText)}catch(E){return 
this.onError()}this.onUploaded(D.upload)}.closure(this);C.onerror=this.onError.closure(this);C.upload.onprogress=function(D){this.setProgress(D.loaded/D.total)}.closure(this);C.send(A)},setProgress:function(A){this.progress.setStyle({display:"block"});if(A<0.98){this.progress.value=A}else{this.progress.removeAttribute("value")}},onUploaded:function(B){this.removePane();var
 D=B.links.original;if(!this.im){this.ne.selectedInstance.restoreRng();var 
C="javascript:nicImTemp();";this.ne.nicCommand("insertImage",D);this.im=this.findElm("IMG","src",D)}var
 
A=parseInt(this.ne.selectedInstance.elm.getStyle("width"));if(this.im){this.im.setAttributes({src:D,width:(A&&B.image.width)?Math.min(A,B.image.width):""})}}});nicEditors.registerPlugin(nicPlugin,nicUploadOptions);
+

Copied: phpcompta/trunk/html/js/nicEditorIcons.gif (from rev 5215, 
phpcompta/tags/rel650/html/js/nicEditorIcons.gif)
===================================================================
(Binary files differ)

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/js/scripts.js  2013-05-03 22:31:33 UTC (rev 5216)
@@ -23,6 +23,8 @@
  * \brief javascript script, always added to every page
  *
  */
+
+var ask_reload=0;
 /**
 * callback function when we just need to update a hidden div with an info
 * message
@@ -135,7 +137,7 @@
 
 /**
  address@hidden will reload the window but it is dangerous if we have submitted
- * a form
+ * a form with POST
  */
 function refresh_window()
 {
@@ -653,6 +655,13 @@
     {
         document.body.removeChild(g(elt));
     }
+       // if reloaded if asked the window will be reloaded when
+       // the box is closed
+       if ( ask_reload == 1)
+       {
+               // avoid POST window.location = window.location.href;
+               window.location.reload();
+       }
 }
 /**
  *show a box while loading
@@ -664,6 +673,7 @@
        obj={
                id:'wait_box',html:loading()
                };
+       obj.style=fixed_position(350,200)+";width:200px";
        if ($('wait_box')){
                removeDiv('wait_box');
                }
@@ -892,6 +902,8 @@
     }
     var sid='calc1';
     var shtml='';
+       shtml+='<div 
style="float:right;height:10px;display:block;margin-top:2px;margin-right:2px">  
   <a onclick="removeDiv(\'calc1\');" href="javascript:void(0)" 
id="close_div">Fermer</a></div>';
+       shtml+='<div>   <h2 class="info">Calculatrice</h2></div>';
     shtml+='<form name="calc_line"  method="GET" onSubmit="cal();return 
false;" >Calculatrice simplifiée: écrivez simplement les opérations que vous 
voulez puis la touche retour. exemple : 1+2+3*(1/5) <input class="input_text" 
type="text" size="30" id="inp" name="calculator"> <input type="button" 
value="Efface tout" class="button" onClick="Clean();return false;" > <input 
type="button" class="button" value="Fermer" onClick="removeDiv(\'calc1\')" >';
     shtml+='</form><span id="result">  </span><br><span id="sub_total">  Taper 
une formule (ex 20*5.1) puis enter  </span><br><span id="listing"> </span>';
 
@@ -1080,7 +1092,7 @@
        var target="search_op";
        removeDiv(target);
        var str_style=fixed_position(77, 99);
-        str_style+=";width:80%";
+        str_style+=";width:92%;overflow:auto;";
 
     var div={id:target, 
cssclass:'inner_box',style:str_style,html:loading(),drag:1};
 
@@ -1184,7 +1196,7 @@
                                                  
$('detail_profile').innerHTML=req.responseText;
                                                  
req.responseText.evalScripts();
                                                  $('detail_profile').show();
-                                                 
profile_show('profile_gen_div');
+                                                 if ( profile_id != "-1" ) 
profile_show('profile_gen_div');
                                          }
                                  }
                                );
@@ -1248,11 +1260,12 @@
 }
 function add_menu(obj)
 {
-       pdossier=obj.dossier;
-       p_id=obj.p_id
+       var pdossier=obj.dossier;
+       var p_id=obj.p_id;
+       var p_type=obj.type;
        waiting_box();
        removeDiv('divdm'+p_id);
-       var qs="op=add_menu&gDossier="+pdossier+"&p_id="+p_id+"&ctl=divdm"+p_id;
+       var 
qs="op=add_menu&gDossier="+pdossier+"&p_id="+p_id+"&ctl=divdm"+p_id+"&type="+p_type;
        var pos=fixed_position(250,150);
        var action=new Ajax.Request ( 'ajax_misc.php',
                                  {
@@ -1626,4 +1639,77 @@
                                      }
                                  }
                                  );
+}
+/**
+ * @brief check if the parameter is a valid a valid date or not, returns true 
if it is valid otherwise
+ * false
+ * @parameter p_str_date the string of the date (format DD.MM.YYYY)
+ */
+function check_date(p_str_date)
+{
+    var format = /^\d{2}\.\d{2}\.\d{4}$/;
+    if(!format.test(p_str_date)){
+       return false;
+    }
+    else{
+       var date_temp = p_str_date.split('.');
+        var nMonth=parseFloat(date_temp[1])-1;
+       var ma_date = new Date(date_temp[2], nMonth, date_temp[0]);
+       if(ma_date.getFullYear()==date_temp[2] && ma_date.getMonth()==nMonth && 
ma_date.getDate()==date_temp[0]){
+           return true;
+       }
+       else{
+           return false;
+       }
+    }
+
+}
+/**
+ * @brief get the string in the id and check if the date is valid
+ * @parameter p_id_date is the id of the element to check
+ * @return true if the date is valid
+ * @see check_date
+ */
+function check_date_id(p_id_date)
+{
+       var str_date=$(p_id_date).value;
+       return check_date(str_date);
+}
+/**
+ *
+ * @param ag_id to view
+ * @param dossier is the folder
+ * @param modify : show the modify button values : 0 for no 1 for yes
+ */
+function view_action(ag_id,dossier,modify)
+{
+       waiting_box();
+       layer++;
+       id = 'action' + layer;
+
+       querystring = 'gDossier=' + dossier + '&op=vw_action&ag_id=' + ag_id + 
'&div=' + id+'&mod='+modify;
+       var action = new Ajax.Request(
+                       "ajax_misc.php",
+                       {
+                               method: 'get',
+                               parameters: querystring,
+                               onFailure: error_box,
+                               onSuccess: function(req) {
+                                       try {
+                                               remove_waiting_box();
+                                               var pos = fixed_position(0, 50) 
+ ";width:90%;left:5%;";
+                                               add_div({
+                                                       id: id,
+                                                       drag: 1,
+                                                       cssclass: "inner_box",
+                                                       style: pos
+                                               });
+                                               $(id).innerHTML = 
req.responseText;
+                                               compute_all_ledger();
+                                       } catch (e) {
+                                               alert(e.message);
+                                       }
+                               }
+                       }
+       );
 }
\ No newline at end of file

Copied: phpcompta/trunk/html/js/sorttable.js (from rev 5215, 
phpcompta/tags/rel650/html/js/sorttable.js)
===================================================================
--- phpcompta/trunk/html/js/sorttable.js                                (rev 0)
+++ phpcompta/trunk/html/js/sorttable.js        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -0,0 +1,515 @@
+/**
+ *
+  SortTable
+  version 2
+  7th April 2007
+  Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
+
+  Instructions:
+  Download this file
+  Add <script src="sorttable.js"></script> to your HTML
+  Add class="sortable" to any table you'd like to make sortable
+  Click on the headers to sort
+
+  Thanks to many, many people for contributions and suggestions.
+  Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
+  This basically means: do what you want with it.
+
address@hidden
+Documentation http://www.kryogenix.org/code/browser/sorttable/
+
+Show the default order
+example:
+<th class=" sorttable_sorted_reverse">
+....<span id="sorttable_sortrevind">&nbsp;&blacktriangle;</span>
+<th class=" sorttable_sorted">
+....<span id="sorttable_sortfwdind">&nbsp;&nbsp;&#x25BE;</span>
+
+Sort on date
+<td sorttable_customkey="<?=$row_bank['b_date']?>"> // format YYYYMMDD
+
+force as numeric (normally useless):
+<th class="sorttable_numeric">Part number</th>
+
+To avoid the sort on the last row, use tfoot
+
+*/
+
+
+var stIsIE = /address@hidden@*/false;
+
+sorttable = {
+  init: function() {
+    // quit if this function has already been called
+    if (arguments.callee.done) return;
+    // flag this function so we don't do the same thing twice
+    arguments.callee.done = true;
+    // kill the timer
+    if (_timer) clearInterval(_timer);
+
+    if (!document.createElement || !document.getElementsByTagName) return;
+
+    sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
+
+    forEach(document.getElementsByTagName('table'), function(table) {
+      if (table.className.search(/\bsortable\b/) != -1) {
+        sorttable.makeSortable(table);
+      }
+    });
+
+  },
+
+  makeSortable: function(table) {
+    if (table.getElementsByTagName('thead').length == 0) {
+      // table doesn't have a tHead. Since it should have, create one and
+      // put the first table row in it.
+      the = document.createElement('thead');
+      the.appendChild(table.rows[0]);
+      table.insertBefore(the,table.firstChild);
+    }
+    // Safari doesn't support table.tHead, sigh
+    if (table.tHead == null) table.tHead = 
table.getElementsByTagName('thead')[0];
+
+    if (table.tHead.rows.length != 1) return; // can't cope with two header 
rows
+
+    // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
+    // "total" rows, for example). This is B&R, since what you're supposed
+    // to do is put them in a tfoot. So, if there are sortbottom rows,
+    // for backwards compatibility, move them to tfoot (creating it if needed).
+    sortbottomrows = [];
+    for (var i=0; i<table.rows.length; i++) {
+      if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
+        sortbottomrows[sortbottomrows.length] = table.rows[i];
+      }
+    }
+    if (sortbottomrows) {
+      if (table.tFoot == null) {
+        // table doesn't have a tfoot. Create one.
+        tfo = document.createElement('tfoot');
+        table.appendChild(tfo);
+      }
+      for (var i=0; i<sortbottomrows.length; i++) {
+        tfo.appendChild(sortbottomrows[i]);
+      }
+      delete sortbottomrows;
+    }
+
+    // work through each column and calculate its type
+    headrow = table.tHead.rows[0].cells;
+    for (var i=0; i<headrow.length; i++) {
+      // manually override the type with a sorttable_type attribute
+      if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this 
col
+        mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
+        if (mtch) { override = mtch[1]; }
+             if (mtch && typeof sorttable["sort_"+override] == 'function') {
+               headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
+             } else {
+               headrow[i].sorttable_sortfunction = 
sorttable.guessType(table,i);
+             }
+             // make it clickable to sort
+             headrow[i].sorttable_columnindex = i;
+             headrow[i].sorttable_tbody = table.tBodies[0];
+             dean_addEvent(headrow[i],"click", function(e) {
+
+          if (this.className.search(/\bsorttable_sorted\b/) != -1) {
+            // if we're already sorted by this column, just
+            // reverse the table, which is quicker
+            sorttable.reverse(this.sorttable_tbody);
+            this.className = this.className.replace('sorttable_sorted',
+                                                    
'sorttable_sorted_reverse');
+            this.removeChild(document.getElementById('sorttable_sortfwdind'));
+            sortrevind = document.createElement('span');
+            sortrevind.id = "sorttable_sortrevind";
+            sortrevind.innerHTML = stIsIE ? '&nbsp<font 
face="webdings">5</font>' : '&nbsp;&#x25B4;';
+            this.appendChild(sortrevind);
+            return;
+          }
+          if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
+            // if we're already sorted by this column in reverse, just
+            // re-reverse the table, which is quicker
+            sorttable.reverse(this.sorttable_tbody);
+            this.className = this.className.replace('sorttable_sorted_reverse',
+                                                    'sorttable_sorted');
+            this.removeChild(document.getElementById('sorttable_sortrevind'));
+            sortfwdind = document.createElement('span');
+            sortfwdind.id = "sorttable_sortfwdind";
+            sortfwdind.innerHTML = stIsIE ? '&nbsp<font 
face="webdings">6</font>' : '&nbsp;&#x25BE;';
+            this.appendChild(sortfwdind);
+            return;
+          }
+
+          // remove sorttable_sorted classes
+          theadrow = this.parentNode;
+          forEach(theadrow.childNodes, function(cell) {
+            if (cell.nodeType == 1) { // an element
+              cell.className = 
cell.className.replace('sorttable_sorted_reverse','');
+              cell.className = cell.className.replace('sorttable_sorted','');
+            }
+          });
+          sortfwdind = document.getElementById('sorttable_sortfwdind');
+          if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
+          sortrevind = document.getElementById('sorttable_sortrevind');
+          if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
+
+          this.className += ' sorttable_sorted';
+          sortfwdind = document.createElement('span');
+          sortfwdind.id = "sorttable_sortfwdind";
+          sortfwdind.innerHTML = stIsIE ? '&nbsp<font 
face="webdings">6</font>' : '&nbsp;&#x25BE;';
+          this.appendChild(sortfwdind);
+
+               // build an array to sort. This is a Schwartzian transform 
thing,
+               // i.e., we "decorate" each row with the actual sort key,
+               // sort based on the sort keys, and then put the rows back in 
order
+               // which is a lot faster because you only do getInnerText once 
per row
+               row_array = [];
+               col = this.sorttable_columnindex;
+               rows = this.sorttable_tbody.rows;
+               for (var j=0; j<rows.length; j++) {
+                 row_array[row_array.length] = 
[sorttable.getInnerText(rows[j].cells[col]), rows[j]];
+               }
+               /* If you want a stable sort, uncomment the following line */
+               //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
+               /* and comment out this one */
+               row_array.sort(this.sorttable_sortfunction);
+
+               tb = this.sorttable_tbody;
+               for (var j=0; j<row_array.length; j++) {
+                 tb.appendChild(row_array[j][1]);
+               }
+
+               delete row_array;
+             });
+           }
+    }
+  },
+
+  guessType: function(table, column) {
+    // guess the type of a column based on its first non-blank row
+    sortfn = sorttable.sort_alpha;
+    for (var i=0; i<table.tBodies[0].rows.length; i++) {
+      text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
+      if (text != '') {
+        if (text.match(/^-?[�$�]?[\d,.]+%?$/)) {
+          return sorttable.sort_numeric;
+        }
+        // check for a date: dd/mm/yyyy or dd/mm/yy
+        // can have / or . or - as separator
+        // can be mm/dd as well
+        possdate = text.match(sorttable.DATE_RE)
+        if (possdate) {
+          // looks like a date
+          first = parseInt(possdate[1]);
+          second = parseInt(possdate[2]);
+          if (first > 12) {
+            // definitely dd/mm
+            return sorttable.sort_ddmm;
+          } else if (second > 12) {
+            return sorttable.sort_mmdd;
+          } else {
+            // looks like a date, but we can't tell which, so assume
+            // that it's dd/mm (English imperialism!) and keep looking
+            sortfn = sorttable.sort_ddmm;
+          }
+        }
+      }
+    }
+    return sortfn;
+  },
+
+  getInnerText: function(node) {
+    // gets the text we want to use for sorting for a cell.
+    // strips leading and trailing whitespace.
+    // this is *not* a generic getInnerText function; it's special to 
sorttable.
+    // for example, you can override the cell text with a customkey attribute.
+    // it also gets .value for <input> fields.
+
+    if (!node) return "";
+
+    hasInputs = (typeof node.getElementsByTagName == 'function') &&
+                 node.getElementsByTagName('input').length;
+
+    if (node.getAttribute("sorttable_customkey") != null) {
+      return node.getAttribute("sorttable_customkey");
+    }
+    else if (typeof node.textContent != 'undefined' && !hasInputs) {
+      return node.textContent.replace(/^\s+|\s+$/g, '');
+    }
+    else if (typeof node.innerText != 'undefined' && !hasInputs) {
+      return node.innerText.replace(/^\s+|\s+$/g, '');
+    }
+    else if (typeof node.text != 'undefined' && !hasInputs) {
+      return node.text.replace(/^\s+|\s+$/g, '');
+    }
+    else {
+      switch (node.nodeType) {
+        case 3:
+          if (node.nodeName.toLowerCase() == 'input') {
+            return node.value.replace(/^\s+|\s+$/g, '');
+          }
+        case 4:
+          return node.nodeValue.replace(/^\s+|\s+$/g, '');
+          break;
+        case 1:
+        case 11:
+          var innerText = '';
+          for (var i = 0; i < node.childNodes.length; i++) {
+            innerText += sorttable.getInnerText(node.childNodes[i]);
+          }
+          return innerText.replace(/^\s+|\s+$/g, '');
+          break;
+        default:
+          return '';
+      }
+    }
+  },
+
+  reverse: function(tbody) {
+    // reverse the rows in a tbody
+    newrows = [];
+    for (var i=0; i<tbody.rows.length; i++) {
+      newrows[newrows.length] = tbody.rows[i];
+    }
+    for (var i=newrows.length-1; i>=0; i--) {
+       tbody.appendChild(newrows[i]);
+    }
+    delete newrows;
+  },
+
+  /* sort functions
+     each sort function takes two parameters, a and b
+     you are comparing a[0] and b[0] */
+  sort_numeric: function(a,b) {
+    aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
+    if (isNaN(aa)) aa = 0;
+    bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
+    if (isNaN(bb)) bb = 0;
+    return aa-bb;
+  },
+  sort_alpha: function(a,b) {
+    if (a[0]==b[0]) return 0;
+    if (a[0]<b[0]) return -1;
+    return 1;
+  },
+  sort_ddmm: function(a,b) {
+    mtch = a[0].match(sorttable.DATE_RE);
+    y = mtch[3]; m = mtch[2]; d = mtch[1];
+    if (m.length == 1) m = '0'+m;
+    if (d.length == 1) d = '0'+d;
+    dt1 = y+m+d;
+    mtch = b[0].match(sorttable.DATE_RE);
+    y = mtch[3]; m = mtch[2]; d = mtch[1];
+    if (m.length == 1) m = '0'+m;
+    if (d.length == 1) d = '0'+d;
+    dt2 = y+m+d;
+    if (dt1==dt2) return 0;
+    if (dt1<dt2) return -1;
+    return 1;
+  },
+  sort_mmdd: function(a,b) {
+    mtch = a[0].match(sorttable.DATE_RE);
+    y = mtch[3]; d = mtch[2]; m = mtch[1];
+    if (m.length == 1) m = '0'+m;
+    if (d.length == 1) d = '0'+d;
+    dt1 = y+m+d;
+    mtch = b[0].match(sorttable.DATE_RE);
+    y = mtch[3]; d = mtch[2]; m = mtch[1];
+    if (m.length == 1) m = '0'+m;
+    if (d.length == 1) d = '0'+d;
+    dt2 = y+m+d;
+    if (dt1==dt2) return 0;
+    if (dt1<dt2) return -1;
+    return 1;
+  },
+
+  shaker_sort: function(list, comp_func) {
+    // A stable sort function to allow multi-level sorting of data
+    // see: http://en.wikipedia.org/wiki/Cocktail_sort
+    // thanks to Joseph Nahmias
+    var b = 0;
+    var t = list.length - 1;
+    var swap = true;
+
+    while(swap) {
+        swap = false;
+        for(var i = b; i < t; ++i) {
+            if ( comp_func(list[i], list[i+1]) > 0 ) {
+                var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
+                swap = true;
+            }
+        } // for
+        t--;
+
+        if (!swap) break;
+
+        for(var i = t; i > b; --i) {
+            if ( comp_func(list[i], list[i-1]) < 0 ) {
+                var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
+                swap = true;
+            }
+        } // for
+        b++;
+
+    } // while(swap)
+  }
+}
+
+/* ******************************************************************
+   Supporting functions: bundled here to avoid depending on a library
+   ****************************************************************** */
+
+// Dean Edwards/Matthias Miller/John Resig
+
+/* for Mozilla/Opera9 */
+if (document.addEventListener) {
+    document.addEventListener("DOMContentLoaded", sorttable.init, false);
+}
+
+/* for Internet Explorer */
+/address@hidden @*/
+/address@hidden (@_win32)
+    document.write("<script id=__ie_onload defer 
src=javascript:void(0)><\/script>");
+    var script = document.getElementById("__ie_onload");
+    script.onreadystatechange = function() {
+        if (this.readyState == "complete") {
+            sorttable.init(); // call the onload handler
+        }
+    };
+/address@hidden @*/
+
+/* for Safari */
+if (/WebKit/i.test(navigator.userAgent)) { // sniff
+    var _timer = setInterval(function() {
+        if (/loaded|complete/.test(document.readyState)) {
+            sorttable.init(); // call the onload handler
+        }
+    }, 10);
+}
+
+/* for other browsers */
+window.onload = sorttable.init;
+
+// written by Dean Edwards, 2005
+// with input from Tino Zijdel, Matthias Miller, Diego Perini
+
+// http://dean.edwards.name/weblog/2005/10/add-event/
+
+function dean_addEvent(element, type, handler) {
+       if (element.addEventListener) {
+               element.addEventListener(type, handler, false);
+       } else {
+               // assign each event handler a unique ID
+               if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
+               // create a hash table of event types for the element
+               if (!element.events) element.events = {};
+               // create a hash table of event handlers for each element/event 
pair
+               var handlers = element.events[type];
+               if (!handlers) {
+                       handlers = element.events[type] = {};
+                       // store the existing event handler (if there is one)
+                       if (element["on" + type]) {
+                               handlers[0] = element["on" + type];
+                       }
+               }
+               // store the event handler in the hash table
+               handlers[handler.$$guid] = handler;
+               // assign a global event handler to do all the work
+               element["on" + type] = handleEvent;
+       }
+};
+// a counter used to create unique IDs
+dean_addEvent.guid = 1;
+
+function removeEvent(element, type, handler) {
+       if (element.removeEventListener) {
+               element.removeEventListener(type, handler, false);
+       } else {
+               // delete the event handler from the hash table
+               if (element.events && element.events[type]) {
+                       delete element.events[type][handler.$$guid];
+               }
+       }
+};
+
+function handleEvent(event) {
+       var returnValue = true;
+       // grab the event object (IE uses a global event object)
+       event = event || fixEvent(((this.ownerDocument || this.document || 
this).parentWindow || window).event);
+       // get a reference to the hash table of event handlers
+       var handlers = this.events[event.type];
+       // execute each event handler
+       for (var i in handlers) {
+               this.$$handleEvent = handlers[i];
+               if (this.$$handleEvent(event) === false) {
+                       returnValue = false;
+               }
+       }
+       return returnValue;
+};
+
+function fixEvent(event) {
+       // add W3C standard event methods
+       event.preventDefault = fixEvent.preventDefault;
+       event.stopPropagation = fixEvent.stopPropagation;
+       return event;
+};
+fixEvent.preventDefault = function() {
+       this.returnValue = false;
+};
+fixEvent.stopPropagation = function() {
+  this.cancelBubble = true;
+}
+
+// Dean's forEach: http://dean.edwards.name/base/forEach.js
+/*
+       forEach, version 1.0
+       Copyright 2006, Dean Edwards
+       License: http://www.opensource.org/licenses/mit-license.php
+*/
+
+// array-like enumeration
+if (!Array.forEach) { // mozilla already supports this
+       Array.forEach = function(array, block, context) {
+               for (var i = 0; i < array.length; i++) {
+                       block.call(context, array[i], i, array);
+               }
+       };
+}
+
+// generic enumeration
+Function.prototype.forEach = function(object, block, context) {
+       for (var key in object) {
+               if (typeof this.prototype[key] == "undefined") {
+                       block.call(context, object[key], key, object);
+               }
+       }
+};
+
+// character enumeration
+String.forEach = function(string, block, context) {
+       Array.forEach(string.split(""), function(chr, index) {
+               block.call(context, chr, index, string);
+       });
+};
+
+// globally resolve forEach enumeration
+var forEach = function(object, block, context) {
+       if (object) {
+               var resolve = Object; // default
+               if (object instanceof Function) {
+                       // functions have a "length" property
+                       resolve = Function;
+               } else if (object.forEach instanceof Function) {
+                       // the object implements a custom forEach method so use 
that
+                       object.forEach(block, context);
+                       return;
+               } else if (typeof object == "string") {
+                       // the object is a string
+                       resolve = String;
+               } else if (typeof object.length == "number") {
+                       // the object is array-like
+                       resolve = Array;
+               }
+               resolve.forEach(object, block, context);
+       }
+};
+

Modified: phpcompta/trunk/html/show_document.php
===================================================================
--- phpcompta/trunk/html/show_document.php      2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/show_document.php      2013-05-03 22:31:33 UTC (rev 
5216)
@@ -20,7 +20,7 @@
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
 // Verify parameters
-/* ! \file
+/** \file
  * \brief retrieve a document
  */
 

Modified: phpcompta/trunk/html/style-color.css
===================================================================
--- phpcompta/trunk/html/style-color.css        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/style-color.css        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -13,7 +13,7 @@
        font-style: italic;
 }
 
-table.table_large, table.result  ,table.resultfooter {
+table.sortable, table.table_large, table.result  ,table.resultfooter {
        color:blue;
        /* border:blue solid 1px; */
        width:100%;
@@ -27,7 +27,7 @@
 
 
 }
-table.table_large th,table.result th {
+table.sortable th, table.table_large th,table.result th {
        font-weight:bold;
        font-family:verdana,helvetica,sans-serif;
        border-bottom:1px solid blue;
@@ -104,11 +104,6 @@
        font-size:14px;
 }
 
-h1.title {
-       color: blue;
-       font-size:25px;
-}
-
 div.u_tmenu {
        margin-top:0px;
        width:100%;
@@ -555,7 +550,7 @@
        margin:1px;
        background-color: orange;
 }
-legend {
+h1.legend, legend {
        font-weight: bold;
        font-style: italic;
        font-size: 120% ;
@@ -945,14 +940,14 @@
        position:absolute;
        border:1px solid black;
        top:15%;left:100;
-       margin-left:25%
-               z-index:2;
+       margin-left:25%;
+       z-index:2;
        width:50%;
        display:none;
        background-color:#e4e7ed;
 }
 
-table.table_large td, table.result td
+table.sortable td,table.table_large td, table.result td
 {
        padding-left:5px;
        padding-right:5px;
@@ -1117,4 +1112,40 @@
 div.foldercontent {
        width:80%;
        margin-left:10%;
-       }
\ No newline at end of file
+       }
+h1.title {
+       color: #046fff;
+       font-size:24px;
+       font-style: italic;
+}
+h2.title {
+       color: #046fff;
+       font-size:16px;
+       font-style: italic;
+       margin-left: 15px;
+}
+h3.title {
+       color: #046fff;
+       font-size:14px;
+       margin-left: 30px;
+}
+h4.title {
+       color: #046fff;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: underline;
+}
+h5.title {
+       color: #046fff;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: none;
+       font-style: italic;
+}
+div.myfieldset
+{
+       margin-top: 5px;
+       margin-left:5px;
+       margin-right: 5px;
+       border:lightgrey 2px groove;
+}
\ No newline at end of file

Modified: phpcompta/trunk/html/style-epad.css
===================================================================
--- phpcompta/trunk/html/style-epad.css 2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/style-epad.css 2013-05-03 22:31:33 UTC (rev 5216)
@@ -13,7 +13,7 @@
        font-style: italic;
 }
 
-table.table_large, table.result  ,table.resultfooter {
+table.table_large, table.result  ,table.resultfooter,table.sortable  {
        color:blue;
        /* border:blue solid 1px; */
        width:100%;
@@ -27,7 +27,7 @@
 
 
 }
-table.table_large th,table.result th {
+table.table_large th,table.result th,table.sortable th {
        font-weight:bold;
        font-family:verdana,helvetica,sans-serif;
        border-bottom:1px solid blue;
@@ -104,11 +104,6 @@
        font-size:16px;
 }
 
-h1.title {
-       color: blue;
-       font-size:27px;
-}
-
 div.u_tmenu {
        margin-top:0px;
        width:100%;
@@ -555,7 +550,7 @@
        margin:1px;
        background-color: orange;
 }
-legend {
+h1.legend,legend {
        font-weight: bold;
        font-style: italic;
        font-size: 120% ;
@@ -947,7 +942,7 @@
        background-color:#e4e7ed;
 }
 
-table.table_large td, table.result td
+table.table_large td, table.result td,table.sortable td
 {
        padding-left:5px;
        padding-right:5px;
@@ -1104,4 +1099,40 @@
        display:inline;
        float:left;
        top:0px;
+}
+h1.title {
+       color: #046fff;
+       font-size:30px;
+       font-style: italic;
+}
+h2.title {
+       color: #046fff;
+       font-size:24px;
+       font-style: italic;
+       margin-left: 15px;
+}
+h3.title {
+       color: #046fff;
+       font-size:16px;
+       margin-left: 30px;
+}
+h4.title {
+       color: blue;
+       font-size:14px;
+       margin-left: 45px;
+       text-decoration: underline;
+}
+h5.title {
+       color: blue;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: none;
+       font-style: italic;
+}
+div.myfieldset
+{
+       margin-top: 5px;
+       margin-left:5px;
+       margin-right: 5px;
+       border:lightgrey 2px groove;
 }
\ No newline at end of file

Modified: phpcompta/trunk/html/style-light.css
===================================================================
--- phpcompta/trunk/html/style-light.css        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/style-light.css        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -9,11 +9,12 @@
        color:blue;
 }
 .notice {
+       background: white;
        color:red;
        font-style: italic;
 }
 
-table.table_large, table.result  ,table.resultfooter {
+table.sortable, table.table_large, table.result  ,table.resultfooter {
        color:blue;
        /* border:blue solid 1px; */
        width:100%;
@@ -24,10 +25,9 @@
 table.resultfooter tfoot {
        font-size:110%;
        font-weight: bold;
+}
 
-
-}
-table.table_large th,table.result th {
+table.table_large th,table.result th ,table.sortable th{
        font-weight:bold;
        font-family:verdana,helvetica,sans-serif;
        border-bottom:1px solid blue;
@@ -86,7 +86,7 @@
 h3.info {
        background:#879ed4;
        color:white;
-       font-size:14px;
+       font-size:12px;
        text-align:center;
 }
 
@@ -104,11 +104,6 @@
        font-size:14px;
 }
 
-h1.title {
-       color: blue;
-       font-size:25px;
-}
-
 div.u_tmenu {
        margin-top:0px;
        width:100%;
@@ -550,7 +545,7 @@
        margin:1px;
        background-color: orange;
 }
-legend {
+h1.legend, legend {
        font-weight: bold;
        font-style: italic;
        font-size: 120% ;
@@ -947,7 +942,7 @@
        background-color:#e4e7ed;
 }
 
-table.table_large td, table.result td
+table.table_large td, table.result td,table.sortable td
 {
        padding-left:5px;
        padding-right:5px;
@@ -1108,4 +1103,41 @@
 }
 div.foldercontent {
        padding:20px 30px 0px 40px;
-       }
\ No newline at end of file
+       }
+
+h1.title {
+       color: #046fff;
+       font-size:24px;
+       font-style: italic;
+}
+h2.title {
+       color: #046fff;
+       font-size:16px;
+       font-style: italic;
+       margin-left: 15px;
+}
+h3.title {
+       color: #046fff;
+       font-size:14px;
+       margin-left: 30px;
+}
+h4.title {
+       color: #046fff;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: underline;
+}
+h5.title {
+       color: #046fff;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: none;
+       font-style: italic;
+}
+div.myfieldset
+{
+       margin-top: 5px;
+       margin-left:5px;
+       margin-right: 5px;
+       border:lightgrey 2px groove;
+}
\ No newline at end of file

Modified: phpcompta/trunk/html/style-print.css
===================================================================
--- phpcompta/trunk/html/style-print.css        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/html/style-print.css        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -1,13 +1,15 @@
 body {
-       font-size:7px;
+       font-size:8px;
        }
-select ,.input_text{
+input, select ,.input_text{
+       font-size:8px;
 border:1px solid #FFFFFF;
  }
 form {
   display:none;
  }
 .print {
+       font-size:8px;
        display: block;
        }
 .noprint  {
@@ -30,6 +32,11 @@
        font-size:7px;
        font-family:sans-serif;
 }
+h3,h4 {
+       font-size:10px;
+       text-decoration: underline;
+       font-family:sans-serif;
+}
 
 h2 {
        font-size:12px;
@@ -42,7 +49,7 @@
 .content  {
        font-size:7px;
 }
-h1.content,h1,h2.info {
+h1.content,h1,h2.info,legend {
        font-size:14px;
        font-weight:bold;
        font-family:sans-serif;
@@ -244,6 +251,39 @@
 }
 .num {
        text-align:right;
+       font-size:8px;
 }
-
+h1.title {
+       font-size:24px;
+       font-style: italic;
+}
+h2.title {
+       font-size:16px;
+       font-style: italic;
+       margin-left: 15px;
+}
+h3.title {
+       font-size:14px;
+       margin-left: 30px;
+}
+h4.title {
+       color: blue;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: underline;
+}
+h5.title {
+       color: blue;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: none;
+       font-style: italic;
+}
 /* </style> */
+div.myfieldset
+{
+       margin-top: 5px;
+       margin-left:5px;
+       margin-right: 5px;
+       border:lightgrey 2px groove;
+}
\ No newline at end of file

Modified: phpcompta/trunk/html/style-test.css
===================================================================
--- phpcompta/trunk/html/style-test.css 2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/style-test.css 2013-05-03 22:31:33 UTC (rev 5216)
@@ -1,6 +1,6 @@
 span.tmenu {
-          padding-left:20px; 
-          padding-right:20px; 
+          padding-left:20px;
+          padding-right:20px;
           border:solid 1px blue;
           background-color: #6699dd ;
 }
@@ -14,8 +14,7 @@
          width:150px;
 }
 a.tmenu:link {
-          background-color: #6699dd ;  
-//         color:#683af2;
+          background-color: #6699dd ;
            color:white;
            }
 a.tmenu:visited {
@@ -47,7 +46,7 @@
 }
 div.ddownload {
              color:white;
-             background-color:#6699dd ;        
+             background-color:#6699dd ;
 }
 div.content {
            margin-left:10%;
@@ -60,7 +59,7 @@
    color:blue;
    background-color:white;
 }
-table.result td 
+table.sortable td,table.result td
 {
        padding-left:5px;
        padding-right:5px;

Modified: phpcompta/trunk/html/style.css
===================================================================
--- phpcompta/trunk/html/style.css      2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/html/style.css      2013-05-03 22:31:33 UTC (rev 5216)
@@ -13,7 +13,7 @@
         font-style: italic;
         }
 
-table.table_large, table.result  ,table.resultfooter {
+table.sortable, table.table_large, table.result  ,table.resultfooter {
   color:blue;
   /* border:blue solid 1px; */
   width:100%;
@@ -27,7 +27,7 @@
 
 
 }
-table.table_large th,table.result th {
+table.sortable th,  table.table_large th,table.result th {
   font-weight:bold;
   font-family:verdana,helvetica,sans-serif;
  border-bottom:1px solid blue;
@@ -99,10 +99,6 @@
        font-size:14px;
 }
 
-h1.title {
-       color: blue;
-       font-size:25px;
-}
 
 div.u_tmenu {
   margin-top:0px;
@@ -539,6 +535,7 @@
 .input_text_ro {
           border:solid 1px blue;
           background:#EDEDED;
+          color:blue;
        margin:1px;
 }
 .input_text {
@@ -550,10 +547,10 @@
        margin:1px;
        background-color: orange;
 }
-legend {
+h1.legend, legend {
 font-weight: bold;
 font-style: italic;
-font-size: 120% ;
+font-size: 110% ;
 
 }
 fieldset fieldset legend {
@@ -565,7 +562,6 @@
 margin:2px;
 background-color:white;
 
-
 }
 
 
@@ -880,7 +876,7 @@
                border-top:1px solid  #b4bbc2;
                border-right:1px solid  #b4bbc2;
        padding: 5px;
-       width: 30%;
+       width: 40%;
 }
 body.op_detail_frame,div.op_detail_frame  {
   background-color:#e4e7ed;
@@ -946,7 +942,7 @@
              background-color:#e4e7ed;
 }
 
-table.table_large td, table.result td
+table.sortable td, table.table_large td, table.result td
 {
        padding-left:5px;
        padding-right:5px;
@@ -1107,3 +1103,41 @@
 div.foldercontent {
        padding:20px 30px 0px 40px;
        }
+
+h1.title {
+       color: blue;
+       font-size:18px;
+       font-style: italic;
+}
+h2.title {
+       color: blue;
+       font-size:14px;
+       font-weight:bold;
+       font-style: italic;
+       margin-left: 15px;
+}
+h3.title {
+       color: blue;
+       font-size:14px;
+       margin-left: 30px;
+}
+h4.title {
+       color: blue;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: underline;
+}
+h5.title {
+       color: blue;
+       font-size:12px;
+       margin-left: 45px;
+       text-decoration: none;
+       font-style: italic;
+}
+div.myfieldset
+{
+       margin-top: 5px;
+       margin-left:5px;
+       margin-right: 5px;
+       border:lightgrey 2px groove;
+}

Modified: phpcompta/trunk/include/ac_common.php
===================================================================
--- phpcompta/trunk/include/ac_common.php       2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/ac_common.php       2013-05-03 22:31:33 UTC (rev 
5216)
@@ -29,7 +29,7 @@
 require_once('class_database.php');
 require_once('class_periode.php');
 
-/* !\brief to protect again bad characters which can lead to a cross scripting 
attack
+/**\brief to protect again bad characters which can lead to a cross scripting 
attack
   the string to be diplayed must be protected
  */
 
@@ -71,7 +71,7 @@
 {
     return '<h1 ' . $p_class . '>' . htmlspecialchars($p_string) . '</h1>';
 }
-/* !\brief surround the string with td
+/**\brief surround the string with td
  * \param $p_string string to surround by TD
  * \param $p_extra extra info (class, style, javascript...)
  * \return string surrounded by td
@@ -87,7 +87,7 @@
     return '<tr  ' . $p_extra . '>' . $p_string . '</tr>';
 }
 
-/* !\brief escape correctly php string to javascript */
+/**\brief escape correctly php string to javascript */
 
 function j($p_string)
 {
@@ -133,7 +133,7 @@
     return $r;
 }
 
-/* !
+/**
  * \brief  log error into the /tmp/phpcompta_error.log it doesn't work on 
windows
  *
  * \param p_log message
@@ -155,7 +155,7 @@
     }
 }
 
-/* !
+/**
  * \brief  Compare 2 dates
  * \param p_date
  * \param p_date_oth
@@ -230,7 +230,7 @@
        if (sizeof($l_date) != 3)
            return null;
 
-       if ($l_date[2] > 2050)
+       if ($l_date[2] > COMPTA_MAX_YEAR || $l_date[2] < COMPTA_MIN_YEAR)
        {
            return null;
        }
@@ -243,7 +243,7 @@
     return $p_date;
 }
 
-/* !
+/**
  * \brief Default page header for each page
  *
  * \param p_theme default theme
@@ -317,7 +317,7 @@
 
 }
 
-/* !
+/**
  * \brief Minimal  page header for each page, used for small popup window
  *
  * \param p_theme default theme
@@ -372,7 +372,7 @@
     }
 }
 
-/* !
+/**
  * \brief end tag
  *
  */
@@ -383,7 +383,7 @@
     echo "</HTML>";
 }
 
-/* !
+/**
  * \brief Echo no access and stop
  *
  * \return nothing
@@ -413,7 +413,7 @@
 {
     return sql_string($p_string);
 }
-/* !
+/**
  * \brief Fix the problem with the quote char for the database
  *
  * \param $p_string
@@ -430,7 +430,7 @@
     return $p_string;
 }
 
-/* !
+/**
   /* \brief store the string which print
  *           the content of p_array in a table
  *           used to display the menu
@@ -499,7 +499,7 @@
     return $ret;
 }
 
-/* !
+/**
  * \brief warns
  *
  * \param p_string error message
@@ -514,7 +514,7 @@
     echo '<H2 class="error">' . $p_string . "</H2>";
 }
 
-/* !
+/**
  * \brief Show the periode which found thanks its id
  *
  *
@@ -534,7 +534,7 @@
     return $ret;
 }
 
-/* !
+/**
  * \brief Return the period corresponding to the
  *           date
  *
@@ -554,7 +554,7 @@
     return $R;
 }
 
-/* !\brief Decode the html for the widegt richtext and remove newline
+/**\brief Decode the html for the widegt richtext and remove newline
  * \param $p_html string to decode
  * \return the html code without new line
  */
@@ -567,7 +567,7 @@
     return $p_html;
 }
 
-/* !\brief Create the condition to filter on the j_tech_per
+/**\brief Create the condition to filter on the j_tech_per
  *        thanks a from and to date.
  * \param $p_cn database conx
  * \param $p_from start date (date)
@@ -611,7 +611,7 @@
     return $periode;
 }
 
-/* !\brief alert in javascript
+/**\brief alert in javascript
  * \param $p_msg is the message
  * \param $buffer if false, echo directly and execute the javascript, if 
$buffer is true, the alert javascript
  * is in the return string
@@ -853,27 +853,53 @@
            p_type_display='M' and
            user_name=$1 and pm_default=1", array($g_user->login));
 
+       /*
+        * Try to find the smallest order for module
+        */
     if (empty($default_module))
     {
                $default_module = $cn->get_array("select me_code
-                       from profile_menu join profile_user using (p_id)
-                       where
-                       user_name=$1 and p_order=(select min(p_order) from 
profile_menu join profile_user using (p_id)
-                       where user_name=$2) limit 1", array($g_user->login, 
$g_user->login));
-               /*
-                * if nothing found, there is no profile for this user => exit
-                */
+           from profile_menu join profile_user using (p_id)
+           where
+           p_type_display='M' and
+           user_name=$1 order by p_order limit 1", array($g_user->login));
+
+               // if no default try to find the default menu
                if ( empty ($default_module))
                {
-                       echo_warning(_("Utilisateur n'a pas de profile"));
-                       exit();
+                       $default_module = $cn->get_array("select me_code
+                        from profile_menu join profile_user using (p_id)
+                          where
+                          p_type_display='E' and
+                          user_name=$1 and pm_default=1 ", 
array($g_user->login));
+                       /*
+                        * Try to find a default menu by order
+                        */
+                       if (empty ($default_module))
+                       {
+                               $default_module = $cn->get_array("select me_code
+                               from profile_menu join profile_user using (p_id)
+                               where
+                               user_name=$1 and p_order=(select min(p_order) 
from profile_menu join profile_user using (p_id)
+                               where user_name=$2) limit 1", 
array($g_user->login, $g_user->login));
+                       }
+
+                       /*
+                       * if nothing found, there is no profile for this user 
=> exit
+                       */
+                       if (empty ($default_module))
+                       {
+                               echo_warning(_("Utilisateur n'a pas de 
profile"));
+                               exit();
+                       }
                }
                return $default_module[0]['me_code'];
     }
 
     if (count($default_module) > 1)
     {
-               echo_error(_("Plusieurs modules sont le module par défaut"), 
__LINE__, __FILE__);
+               // return the first module found
+               return $default_module[0]['me_code'];
     }
     elseif (count($default_module) == 1)
     {

Modified: phpcompta/trunk/include/action.common.inc.php
===================================================================
--- phpcompta/trunk/include/action.common.inc.php       2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/action.common.inc.php       2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief this file is common to suivi client, suivi fournisseur, suivi
  * administration.
  * The needed variables are
@@ -84,19 +84,16 @@
        {
                $act2 = new Follow_Up($cn);
                $act2->fromArray($_POST);
-               $sub_action = "detail";
-               put_global(array(array('key' => "sa", "value" => "detail")));
-               if ($g_user->can_write_action($act2->ag_id))
+               if ($g_user->can_write_action($act2->ag_id) == false )
                {
-                       $act2->Update();
-               }
-               else
-               {
                        echo '<div class="redcontent">';
                        echo '<h2 class="error"> Cette action ne vous est pas 
autorisée Contactez votre responsable</h2>';
                        echo '</div>';
                        exit();
                }
+               $sub_action = "detail";
+               put_global(array(array('key' => "sa", "value" => "detail")));
+               $act2->Update() ;
        }
        //----------------------------------------------------------------------
        // Add a related action
@@ -194,7 +191,7 @@
        Follow_Up::show_action_list($cn, $base);
        // Add a button to export to Csv
        echo '<form method="GET" ACTION="export.php">';
-       echo 
HtmlInput::request_to_hidden(array("remind_date_end","remind_date","sag_ref", 
"remind_date","only_internal", "state", "gDossier", "qcode", "start_date", 
"end_date", "ag_id", "ag_dest_query",
+       echo 
HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref",
 "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", 
"end_date", "ag_id", "ag_dest_query",
                "tdoc",   "query"));
        echo HtmlInput::hidden("act", "CSV:ActionGestion");
        echo HtmlInput::submit("follow_up_csv", "Export CSV");

Modified: phpcompta/trunk/include/action.inc.php
===================================================================
--- phpcompta/trunk/include/action.inc.php      2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/action.inc.php      2013-05-03 22:31:33 UTC (rev 
5216)
@@ -24,7 +24,7 @@
 require_once('class_ipopup.php');
 global $g_user;
 $retour=HtmlInput::button_anchor(_('Retour liste'),
-               
HtmlInput::request_to_string(array("remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate")));
+               
HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate")));
 //-----------------------------------------------------
 // Follow_Up
 //-----------------------------------------------------

Modified: phpcompta/trunk/include/ajax_add_menu.php
===================================================================
--- phpcompta/trunk/include/ajax_add_menu.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/ajax_add_menu.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -25,6 +25,9 @@
  * @file
  * @brief show the form to add a menu
  */
+$type=$_GET['type'];
+if ( $type=='me')
+{
 $ame_code_dep=$cn->make_array("
        select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') 
from
        menu_ref
@@ -38,10 +41,20 @@
        order by 1
        ",1);
 $ame_code=$cn->make_array("
-       select me_code,me_code||' '||me_menu||' '||coalesce(me_description,'') 
from
+select me_code,me_code||' '||coalesce(me_menu,'')||' 
'||coalesce(me_description,'')
+       ||'('|| case when me_type='SP' then 'Special'
+               when me_type='PR' then 'Impression'
+               when me_type='PL' then 'Plugin'
+               when me_type='ME' and me_file is null and me_javascript is null 
and me_url is null then 'Module - Menu principal'
+               when me_type='ME' then 'Menu'
+               else
+               me_type
+               end||')'
+       from
        menu_ref
        order by 1
        ");
+
 $p_order=new INum("p_order","10");
 $atype=$cn->make_array("select pm_type,pm_desc from profile_menu_type order by 
1");
 
@@ -67,7 +80,7 @@
        <td><?=$me_code->input()?></td>
 </tr>
 <tr>
-       <td>Dépendant de </td>
+       <td>Dépendant de <?=HtmlInput::infobulle(20)?></td>
        <td><?=$me_code_dep->input()?></td>
 </tr>
 
@@ -87,4 +100,47 @@
 <?
 echo HtmlInput::submit('add_menu',"Valider");
 echo '</form>';
+}
+if ($type=='pr')
+{
+
+$ame_code=$cn->make_array("
+select me_code,me_code||' '||coalesce(me_menu,'')||' 
'||coalesce(me_description,'')
+       from
+       menu_ref
+       where me_type='PR'
+       and me_code not in (select me_code from profile_menu where 
p_id=".sql_string($p_id).")
+       order by 1
+       ");
+
+$me_code=new ISelect('me_code');
+$me_code->value=$ame_code;
+
+       echo HtmlInput::title_box("Nouveau menu", $ctl);
+       if (count($ame_code)==0)
+       {
+               echo h2("Aucune impression disponible à 
ajouter",'class="notice"');
+               return;
+       }
 ?>
+<form method="POST" onsubmit="return confirm('Vous confirmez ?')">
+       <?
+       echo HtmlInput::hidden('tab','profile_print_div');
+       ?>
+       <?=HtmlInput::hidden('p_id',$p_id)?>
+       <?=HtmlInput::hidden('p_order',10)?>
+       <?=HtmlInput::hidden('me_code_dep','')?>
+       <?=HtmlInput::hidden('p_type','PR')?>
+<table>
+<tr>
+       <td>Code</td>
+       <td><?=$me_code->input()?></td>
+</tr>
+
+</table>
+<?
+echo HtmlInput::submit('add_impress',"Valider");
+echo '</form>';
+}
+
+?>

Copied: phpcompta/trunk/include/ajax_boxcard_search.php (from rev 5215, 
phpcompta/tags/rel650/include/ajax_boxcard_search.php)
===================================================================
--- phpcompta/trunk/include/ajax_boxcard_search.php                             
(rev 0)
+++ phpcompta/trunk/include/ajax_boxcard_search.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -0,0 +1,105 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief show result card search
+ *
+ */
+$sql="
+       select 
vw.f_id,vw_name,vw_first_name,vw_description,fd_label,quick_code,pc.ad_value as 
poste,tva_num
+       from vw_fiche_attr as vw
+       join fiche_def as fd on (vw.fd_id=fd.fd_id)
+       left join (select f_id,ad_value from fiche_detail where ad_id=5) as pc 
on (pc.f_id=vw.f_id)
+       where
+       vw_name ~* $1
+       or vw_first_name ~* $1
+       or vw_description ~* $1
+       or tva_num ~* $1
+       or pc.ad_value like $1||'%'
+       or quick_code like upper($1||'%')
+       order by 2
+";
+$array=$cn->get_array($sql,array($_GET['card']));
+echo HtmlInput::title_box("Résultat recherche", "boxsearch_card_div");
+$max=(count($array)>MAX_CARD_SEARCH)?MAX_CARD_SEARCH:count($array);
+?>
+<? if (count($array)>MAX_CARD_SEARCH ): ?>
+<h2 class="notice">Résultat limité à <?=MAX_CARD_SEARCH?>, nombre de fiches 
trouvées : <?=count($array)?> </h2>
+
+<? endif?>
+<table class="sortable">
+       <tr>
+               <th>
+                       Categorie
+               </th>
+               <th>
+                       Quick Code
+               </th>
+               <th>
+                       Nom
+               </th>
+               <th>
+                       Description
+               </th>
+               <th>
+                       Numéro TVA
+               </th>
+               <th>
+                       Poste comptable
+               </th>
+
+       </tr>
+<? if (count($array)==0) : ?>
+       <h2 class="notice"> Aucun résultat</h2>
+<?endif?>
+<? for ($i=0;$i<$max;$i++):?>
+       <tr>
+               <td>
+                       <?=h($array[$i]['fd_label'])?>
+               </td>
+               <td>
+                       <?=HtmlInput::card_detail($array[$i]['quick_code'])?>
+               </td>
+               <td>
+                       <?=h($array[$i]['vw_name'])?>&nbsp;
+                       <?=h($array[$i]['vw_first_name'])?>
+               </td>
+               <td>
+                       <?=h($array[$i]['vw_description'])?>
+
+               </td>
+               <td>
+                       <?=h($array[$i]['tva_num'])?>
+
+               </td>
+               <td>
+                       <?=h($array[$i]['poste'])?>
+
+               </td>
+       </tr>
+
+
+<? endfor; ?>
+</table>
+<?=HtmlInput::button_close("boxsearch_card_div")?>
\ No newline at end of file

Modified: phpcompta/trunk/include/ajax_get_menu_detail.php
===================================================================
--- phpcompta/trunk/include/ajax_get_menu_detail.php    2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/ajax_get_menu_detail.php    2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -94,12 +94,15 @@
 <? endif;?>
 </table>
        <p>
-Cochez cette case si vous souhaitez effacer ce menu 
+Cochez cette case si vous souhaitez effacer ce menu
 <?
 $delete=new ICheckBox('delete',"1");
 echo $delete->input();
 ?>
 </p>
+<?
+if ($array[0]['p_type_display']!='P'):
+?>
        <p>
 Cochez cette case si vous souhaitez effacer ce menu ainsi que ceux qui en 
dépendent
 <?
@@ -107,6 +110,7 @@
 echo $delete->input();
 ?>
 </p>
+<? endif;?>
 <?
 echo HtmlInput::submit('mod',"Valider");
 echo '</form>';

Modified: phpcompta/trunk/include/ajax_get_profile.php
===================================================================
--- phpcompta/trunk/include/ajax_get_profile.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/ajax_get_profile.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -31,7 +31,8 @@
 require_once 'class_profile_menu.php';
 $profile=new Profile_sql($cn,$p_id);
 $gDossier=Dossier::id();
-$add_one=HtmlInput::button("add", "Ajout 
Menu","onclick=\"add_menu({dossier:$gDossier,p_id:$p_id})\"");
+$add_menu=HtmlInput::button("add", "Ajout 
Menu","onclick=\"add_menu({dossier:$gDossier,p_id:$p_id,type:'me'})\"");
+$add_impression=HtmlInput::button("add", "Ajout 
Menu","onclick=\"add_menu({dossier:$gDossier,p_id:$p_id,type:'pr'})\"");
 ?>
 <hr>
 <h1>Profil <?=$profile->p_name?></h1>
@@ -89,21 +90,21 @@
         echo '<div style="display:none" id="profile_menu_div">';
        //Menu / Module /plugin in this profile
        echo "<h2>Menu</h2>";
-       echo $add_one;
+       echo $add_menu;
        $profile_menu = new Profile_Menu($cn);
        $profile_menu->listing_profile($p_id);
         echo '</div>';
         echo '<div style="display:none" id="profile_print_div">';
        echo "<h2>Impression</h2>";
        $profile_menu->printing($p_id);
-       echo $add_one;
+       echo $add_impression;
         echo '</div>';
         echo '<div style="display:none" id="profile_gestion_div">';
-       echo "<h1>Action gestion accessible</h1>";
+       echo "<h2>Action gestion accessible</h2>";
        $profile_menu->available_profile($p_id);
         echo '</div>';
         echo '<div style="display:none" id="profile_repo_div">';
-       echo "<h1>Dépôt de stock accessible</h1>";
+       echo "<h2>Dépôt de stock accessible</h2>";
        $profile_menu->available_repository($p_id);
         echo '</div>';
         if ( isset ($_POST['tab']))

Modified: phpcompta/trunk/include/ajax_mod_document.php
===================================================================
--- phpcompta/trunk/include/ajax_mod_document.php       2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/ajax_mod_document.php       2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -38,7 +38,7 @@
 require('template/modele_document.php');
 
 $html=ob_get_contents();
-ob_clean();
+ob_end_clean();
 $html=escape_xml($html);
 header('Content-type: text/xml; charset=UTF-8');
 

Modified: phpcompta/trunk/include/ajax_mod_periode.php
===================================================================
--- phpcompta/trunk/include/ajax_mod_periode.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/ajax_mod_periode.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -22,7 +22,7 @@
 // Copyright Author Dany De Bontridder address@hidden
 require_once('class_periode.php');
 
-/* !\file
+/**\file
  * \brief display or save a periode
  * variable received $op, $cn $g_user
  */

Modified: phpcompta/trunk/include/ajax_mod_predf_op.php
===================================================================
--- phpcompta/trunk/include/ajax_mod_predf_op.php       2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/ajax_mod_predf_op.php       2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief display a form to change the name of a predefined operation
  */
 ob_start();
@@ -41,7 +41,7 @@
 
 
 $html = ob_get_contents();
-ob_clean();
+ob_end_clean();
 $html = escape_xml($html);
 
 header('Content-type: text/xml; charset=UTF-8');

Copied: phpcompta/trunk/include/ajax_view_action.php (from rev 5215, 
phpcompta/tags/rel650/include/ajax_view_action.php)
===================================================================
--- phpcompta/trunk/include/ajax_view_action.php                                
(rev 0)
+++ phpcompta/trunk/include/ajax_view_action.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -0,0 +1,55 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief show the detail of an action
+ *
+ */
+require_once 'class_follow_up.php';
+echo HtmlInput::title_box(_("Détail action"), $div);
+$act = new Follow_Up($cn);
+$act->ag_id = $ag_id;
+$act->get();
+if ($g_user->can_write_action($ag_id) == true || 
$g_user->can_read_action($ag_id) == true || $act->ag_dest == -1)
+{
+       echo $act->Display('READ', false, "ajax", "");
+       $action=HtmlInput::array_to_string(array("gDossier","ag_id"), 
$_GET)."&ac=FOLLOW&sa=detail";
+       if ( $_GET['mod']== 1) :
+       ?>
+<a href="<?=$action?>" target="_blank" class="button">Modifier </a>
+    <?
+       endif;
+}
+else
+{
+       echo h2(_("Ce document n'est pas accessible"),"error");
+       ?>
+       <div style="margin:0;padding:0;background-color:red;text-align:center;">
+<h2 class="error">Accès interdit : vous n'avez pas accès à cette information, 
contactez votre responsable</h2>;
+</div>
+       <?
+}
+echo HtmlInput::button_close($div);
+
+?>
\ No newline at end of file

Modified: phpcompta/trunk/include/category_followup.inc.php
===================================================================
--- phpcompta/trunk/include/category_followup.inc.php   2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/category_followup.inc.php   2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -36,8 +36,10 @@
  */
 $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:"list";
 $ag_id=(isset($_REQUEST['ag_id']))?$_REQUEST['ag_id']:0;
+if (! isset($_GET['submit_query'])) 
{$_REQUEST['closed_action']=1;$_GET['closed_action']=1;}
+
 $p_action=$_REQUEST['ac'];
-$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","sb","sc"),"");
+$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","sb","sc"),"");
 $retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base);
 $fiche=new Fiche($cn,$_REQUEST['f_id']);
 

Modified: phpcompta/trunk/include/class_acc_account_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_account_ledger.php        2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/class_acc_account_ledger.php        2013-05-03 
22:31:33 UTC (rev 5216)
@@ -127,7 +127,8 @@
        if ( $solded == 1)
          {
            $filter=str_replace('jrn_def_id','jr_def_id',$filter_sql);
-           $bal_sql="select sum(amount_deb) as s_deb,sum(amount_cred) as 
s_cred, j_poste from                                          (select case when 
j_debit='t' then j_montant else 0 end as amount_deb,
+           $bal_sql="select sum(amount_deb) as s_deb,sum(amount_cred) as 
s_cred, j_poste
+                               from                                            
(select case when j_debit='t' then j_montant else 0 end as amount_deb,
                                                                case when 
j_debit='f' then j_montant else 0 end as amount_cred,
                                                                j_poste
                                                                from jrnx join 
jrn on (j_grpt = jr_grpt_id)
@@ -354,7 +355,7 @@
             $vw_operation=sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>',
                                   $op['jr_id'], dossier::id(), 
$op['jr_internal']);
             $let='';
-            if ( $op['letter'] !=-1) $let=$op['letter'];
+            if ( $op['letter'] !=-1) $let=  strtoupper (base_convert ( 
$op['letter'],10,36));
            $tmp_diff=bcsub($op['deb_montant'],$op['cred_montant']);
 
            /*

Modified: phpcompta/trunk/include/class_acc_balance.php
===================================================================
--- phpcompta/trunk/include/class_acc_balance.php       2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_acc_balance.php       2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -33,7 +33,7 @@
     var $jrn;                                          /*!< idx of a table of 
ledger create by user->get_ledger */
     var $from_poste;                           /*!< from_poste  filter on the 
post */
     var $to_poste;                             /*!< to_poste filter on the 
post*/
-    var $unsold;                               /*!< if true only the no solded 
account (saldo != 0) */
+    var $unsold;                               /**= 0) */
     function Acc_Balance($p_cn)
     {
         $this->db=$p_cn;

Modified: phpcompta/trunk/include/class_acc_compute.php
===================================================================
--- phpcompta/trunk/include/class_acc_compute.php       2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_acc_compute.php       2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -49,7 +49,7 @@
                  'nd_vat_rate'=>'nd_vat_rate',
                  'amount_perso'=>'amount_perso',
                  'amount_perso_rate'=>'amount_perso_rate'                      
          );
- 
+
  */
 
 
@@ -126,9 +126,11 @@
         if ( $this->check && $this->order > 2 )  throw new Exception ('ORDER 
NOT RESPECTED');
 
         $this->amount_nd=bcmul($this->amount,$this->amount_nd_rate);
+        $this->amount_nd=bcdiv($this->amount_nd,100);
         $this->amount_nd=round($this->amount_nd,2);
         // the nd part for the vat
         $nd_vat=bcmul($this->amount_vat,$this->amount_nd_rate);
+        $nd_vat=bcdiv($nd_vat,100);
         $nd_vat=round($nd_vat,2);
 
     }
@@ -139,6 +141,7 @@
 
         if ($this->amount_vat == 0 ) $this->compute_vat();
         $this->nd_vat=bcmul($this->amount_vat,$this->nd_vat_rate);
+        $this->nd_vat=bcdiv($this->nd_vat,100);
         $this->nd_vat=round($this->nd_vat,2);
     }
 
@@ -149,6 +152,7 @@
 
         if ($this->amount_vat == 0 ) $this->compute_vat();
         $this->nd_ded_vat=bcmul($this->amount_vat,$this->nd_ded_vat_rate);
+        $this->nd_ded_vat=bcdiv($this->nd_ded_vat,100);
         $this->nd_ded_vat=round($this->nd_ded_vat,2);
     }
 
@@ -158,6 +162,7 @@
         $this->order=2;
         if ( $this->amount == 0 ) return;
         $this->amount_perso=bcmul($this->amount,$this->amount_perso_rate);
+        $this->amount_perso=bcdiv($this->amount_perso,100);
         $this->amount_perso=round($this->amount_perso,2);
 
 

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -44,24 +44,24 @@
 require_once 'class_sort_table.php';
 require_once 'class_jrn_def_sql.php';
 require_once 'class_acc_payment.php';
-/* !\file
- * \brief Class for jrn,  class acc_ledger for manipulating the ledger
+/** \file
+ * @brief Class for jrn,  class acc_ledger for manipulating the ledger
  */
 
-/* !\brief Class for jrn,  class acc_ledger for manipulating the ledger
+/** @brief Class for jrn,  class acc_ledger for manipulating the ledger
  *
  */
 
 class Acc_Ledger extends jrn_def_sql
 {
 
-       var $id;   /* !< jrn_def.jrn_def_id */
-       var $name;   /* !< jrn_def.jrn_def_name */
-       var $db;   /* !< database connextion */
-       var $row;   /* !< row of the ledger */
-       var $type;   /* !< type of the ledger ACH ODS FIN
+       var $id;   /**< jrn_def.jrn_def_id */
+       var $name;   /**< jrn_def.jrn_def_name */
+       var $db;   /**< database connextion */
+       var $row;   /**< row of the ledger */
+       var $type;   /**< type of the ledger ACH ODS FIN
          VEN or GL */
-       var $nb;   /* !< default number of rows by
+       var $nb;   /**< default number of rows by
          default 10 */
 
        /**
@@ -84,7 +84,7 @@
                {
                        $ret = $this->db->get_array("select 
last_value,is_called from s_jrn_pj" . $this->id);
                        $last = $ret[0]['last_value'];
-                       /* !
+                       /**
                         * \note  With PSQL sequence , the last_value column is 
1 when before   AND after the first call, to make the difference between them
                         * I have to check whether the sequence has been 
already called or not */
                        if ($ret[0]['is_called'] == 'f')
@@ -96,8 +96,8 @@
                return 0;
        }
 
-       /* !
-        * \brief Return the type of a ledger (ACH,VEN,ODS or FIN) or GL
+       /**
+        * @brief Return the type of a ledger (ACH,VEN,ODS or FIN) or GL
         *
         */
 
@@ -331,8 +331,8 @@
                }
        }
 
-       /* !
-        * \brief Return the name of a ledger
+       /**
+        * @brief Return the name of a ledger
         *
         */
 
@@ -354,14 +354,14 @@
                return $ret['jrn_def_name'];
        }
 
-       /* ! \function  get_row
-        * \brief  Get The data
+       /** \function  get_row
+        * @brief  Get The data
         *
         *
-        * \param p_from from periode
-        * \param p_to to periode
-        * \param p_limit starting line
-        * \param p_offset number of lines
+        * @paramp_from from periode
+        * @paramp_to to periode
+        * @paramp_limit starting line
+        * @paramp_offset number of lines
         * \return Array with the asked data
         *
         */
@@ -509,13 +509,13 @@
                return $a;
        }
 
-       /* ! \brief  Get simplified row from ledger
+       /** @brief  Get simplified row from ledger
         *
-        * \param from periode
-        * \param to periode
-        * \param p_limit starting line
-        * \param p_offset number of lines
-        * \param trunc if data must be truncated (pdf export)
+        * @paramfrom periode
+        * @paramto periode
+        * @paramp_limit starting line
+        * @paramp_offset number of lines
+        * @paramtrunc if data must be truncated (pdf export)
         *
         * \return an Array with the asked data
         */
@@ -545,7 +545,7 @@
              jrn_def_type,
              jrn.jr_tech_per
              FROM jrn join jrn_def on (jrn_def_id=jr_def_id)
-             WHERE $periode $jrn order by jr_date $cond_limite";
+             WHERE $periode $jrn order by 
jr_date,substring(jrn.jr_pj_number,'\\\d+$')::numeric asc  $cond_limite";
 
                $Res = $this->db->exec_sql($sql);
                $Max = Database::num_row($Res);
@@ -580,7 +580,8 @@
 
 // end function get_rowSimple
 
-       /* !\brief guess what  the next pj should be
+       /**
+        * @brief guess what  the next pj should be
         */
 
        function guess_pj()
@@ -591,10 +592,11 @@
                return $pj_pref . $pj_seq;
        }
 
-       /* !\brief Show all the operation
-        * \param $sql is the sql stmt, normally created by build_search_sql
-        * \param $offset the offset
-        * \param $p_paid if we want to see info about payment
+       /**
+        * @brief Show all the operation
+        * @param$sql is the sql stmt, normally created by build_search_sql
+        * @param$offset the offset
+        * @param$p_paid if we want to see info about payment
          \code
          // Example
          // Build the sql
@@ -625,7 +627,7 @@
        {
                global $g_parameter, $g_user;
                $gDossier = dossier::id();
-               $limit = " LIMIT 25";
+               $limit = " LIMIT ".MAX_RECONCILE;
                // Sort
                // Count
                $count = $this->db->count_sql($sql);
@@ -716,7 +718,7 @@
                        $tmp_jr_comment = h($row['jr_comment']);
                        $r.=$tmp_jr_comment;
                        $r.="</TD>";
-                       $r.=td(h($row['n_text']), ' style="font-size:6"');
+                       $r.=td(h($row['n_text']), ' style="font-size:90%"');
                        // Amount
                        // If the ledger is financial :
                        // the credit must be negative and written in red
@@ -766,10 +768,11 @@
                return array($count, $r);
        }
 
-       /* !\brief Show all the operation
-        * \param $sql is the sql stmt, normally created by build_search_sql
-        * \param $offset the offset
-        * \param $p_paid if we want to see info about payment
+       /**
+        * @brief Show all the operation
+        * @param$sql is the sql stmt, normally created by build_search_sql
+        * @param$offset the offset
+        * @param$p_paid if we want to see info about payment
          \code
          // Example
          // Build the sql
@@ -799,6 +802,7 @@
        public function list_operation($sql, $offset, $p_paid = 0)
        {
                global $g_parameter, $g_user;
+               bcscale(2);
                $table = new Sort_Table();
                $gDossier = dossier::id();
                $amount_paid = 0.0;
@@ -910,7 +914,7 @@
                        $tmp_jr_comment = h($row['jr_comment']);
                        $r.=$tmp_jr_comment;
                        $r.="</TD>";
-                       $r.=td(h($row['n_text']), ' style="font-size:6"');
+                       $r.=td(h($row['n_text']), ' style="font-size:90%"');
                        // Amount
                        // If the ledger is financial :
                        // the credit must be negative and written in red
@@ -924,10 +928,19 @@
                                        $positive = ($positive < 0) ? 1 : 0;
                        }
                        $r.="<TD align=\"right\">";
-
-                       $tot = ($positive != 0) ? $tot - $row['jr_montant'] : 
$tot + $row['jr_montant'];
+                       $t_amount=$row['jr_montant'];
+                       if ($row['total_invoice'] != null && 
$row['total_invoice'] != $row['jr_montant'])
+                               $t_amount=$row['total_invoice'];
+                       $tot = ($positive != 0) ? bcsub($tot , $t_amount ): 
bcadd($tot , $t_amount);
                        //STAN $positive always == 0
-                       $r.=( $positive != 0 ) ? "<font color=\"red\">  - " . 
nbm($row['jr_montant']) . "</font>" : nbm($row['jr_montant']);
+                       if ($row [ 'jrn_def_type']=='FIN')
+                       {
+                               $r.=( $positive != 0 ) ? "<font color=\"red\">  
- " . nbm($t_amount) . "</font>" : nbm($t_amount);
+                       }
+                       else
+                       {
+                               $r.=( $t_amount <  0 ) ? "<font color=\"red\">  
" . nbm($t_amount) . "</font>" : nbm($t_amount);
+                       }
                        $r.="</TD>";
 
 
@@ -943,9 +956,9 @@
                                $h->name = "set_jr_id" . $row['jr_id'];
                                $r.='<TD>' . $w->input() . $h->input() . 
'</TD>';
                                if ($row['jr_rapt'] == 'paid')
-                                       $amount_paid+=$row['jr_montant'];
+                                       
$amount_paid=bcadd($amount_paid,$t_amount);
                                else
-                                       $amount_unpaid+=$row['jr_montant'];
+                                       
$amount_unpaid=bcadd($amount_unpaid,$t_amount);
                        }
 
                        // Rapprochement
@@ -1011,8 +1024,8 @@
                return array($count, $r);
        }
 
-       /* !
-        * \brief get_detail gives the detail of row
+       /**
+        * @brief get_detail gives the detail of row
         * this array must contains at least the field
         *       <ul>
         *       <li> montant</li>
@@ -1029,12 +1042,12 @@
         *          </ul>
         *       </ul>
         *
-        * \param p_array the structure is set in get_rowSimple, this array is
+        * @paramp_array the structure is set in get_rowSimple, this array is
         *        modified,
-        * \param $trunc if the data must be truncated, usefull for pdf export
-        * \param p_jrn_type is the type of the ledger (ACH or VEN)
-        * \param $a_TVA TVA Array (default null)
-        * \param $a_ParmCode Array (default null)
+        * @param$trunc if the data must be truncated, usefull for pdf export
+        * @paramp_jrn_type is the type of the ledger (ACH or VEN)
+        * @param$a_TVA TVA Array (default null)
+        * @param$a_ParmCode Array (default null)
         * \return p_array
         */
 
@@ -1193,8 +1206,8 @@
        }
 
 // retrieve data from jrnx
-       /* !
-        * \brief  Get the properties of a journal
+       /**
+        * @brief  Get the properties of a journal
         *
         * \return an array containing properties
         *
@@ -1219,9 +1232,9 @@
                return Database::fetch_array($Res, 0);
        }
 
-       /* ! \function GetDefLine
-        * \brief Get the number of lines of a journal
-        * \param $p_cred deb or cred
+       /** \function GetDefLine
+        * @brief Get the number of lines of a journal
+        * @param$p_cred deb or cred
         *
         * \return an integer
         */
@@ -1237,9 +1250,10 @@
                return $Res[0]['value'];
        }
 
-       /* !\brief get the saldo of a ledger for a specific period
-        * \param $p_from start period
-        * \param $p_to end period
+       /**
+        * @brief get the saldo of a ledger for a specific period
+        * @param$p_from start period
+        * @param$p_to end period
         */
 
        function get_solde($p_from, $p_to)
@@ -1270,11 +1284,11 @@
                return $response;
        }
 
-       /* !
-        * \brief Show a select list   of the ledgers you can access in
+       /**
+        * @brief Show a select list   of the ledgers you can access in
         * writing, reading or simply accessing.
-        * \param $p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS)
-        * \param $p_access =3 for READ and WRITE, 2 for write and 1 for 
readonly
+        * @param$p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS)
+        * @param$p_access =3 for READ and WRITE, 2 for write and 1 for readonly
         * \return     object HtmlInput select
         */
 
@@ -1302,8 +1316,8 @@
                return $select;
        }
 
-       /* !
-        * \brief retrieve the jrn_def_fiche and return them into a array
+       /**
+        * @brief retrieve the jrn_def_fiche and return them into a array
         *        index deb, cred
         * \param
         * \param
@@ -1328,8 +1342,8 @@
                return $res[0];
        }
 
-       /* !
-        * \brief retrieve the jrn_def_class_deb and return it
+       /**
+        * @brief retrieve the jrn_def_class_deb and return it
         *
         *
         * \return return an string
@@ -1351,10 +1365,10 @@
                return $res[0];
        }
 
-       /* !
-        * \brief show the result of the array to confirm
+       /**
+        * @brief show the result of the array to confirm
         * before inserting
-        * \param $p_array array from the form
+        * @param$p_array array from the form
         * \return string
         */
 
@@ -1514,10 +1528,10 @@
                return $ret;
        }
 
-       /* !
-        * \brief Show the form to encode your operation
-        * \param $p_array if you correct or use a predef operation (default = 
null)
-        * \param $p_readonly 1 for readonly 0 for writable (default 0)
+       /**
+        * @brief Show the form to encode your operation
+        * @param$p_array if you correct or use a predef operation (default = 
null)
+        * @param$p_readonly 1 for readonly 0 for writable (default 0)
         *
         * \return a string containing the form
         */
@@ -1536,8 +1550,10 @@
                {
                        $add_js = "update_pj();";
                }
-               $add_js.='get_last_date();';
-
+               if ($g_parameter->MY_DATE_SUGGEST=='Y')
+               {
+                       $add_js.='get_last_date();';
+               }
                $ret = "";
                if ($g_user->check_action(FICADD) == 1)
                {
@@ -1750,7 +1766,8 @@
                return $ret;
        }
 
-       /* !\brief
+       /**
+        * @brief
         * check if the current ledger is closed
         * \return 1 for yes, otherwise 0
         * \see Periode::is_closed
@@ -1765,9 +1782,9 @@
                return $ret;
        }
 
-       /* !
-        * \brief verify that the operation can be saved
-        * \param $p_array array of data same layout that the $_POST from 
show_form
+       /**
+        * @brief verify that the operation can be saved
+        * @param$p_array array of data same layout that the $_POST from 
show_form
         *
         *
         * \throw  the getcode  value is 1 incorrect balance,  2 date
@@ -1897,11 +1914,11 @@
                return $msg;
        }
 
-       /* !
-        * \brief compute the internal code of the saved operation and set the 
$this->jr_internal to
+       /**
+        * @brief compute the internal code of the saved operation and set the 
$this->jr_internal to
         *  the computed value
         *
-        * \param $p_grpt id in jr_grpt_
+        * @param$p_grpt id in jr_grpt_
         *
         * \return string internal_code
         *      -
@@ -1920,10 +1937,10 @@
                return $internal_code;
        }
 
-       /* !
-        * \brief save the operation into the jrnx,jrn, ,
+       /**
+        * @brief save the operation into the jrnx,jrn, ,
         *  CA and pre_def
-        * \param $p_array
+        * @param$p_array
         *
         * \return array with [0] = false if failed otherwise true, [1] error
         * code
@@ -2087,8 +2104,8 @@
                return true;
        }
 
-       /* !
-        * \brief get all the data from request and build the object
+       /**
+        * @brief get all the data from request and build the object
         */
 
        function get_request()
@@ -2096,10 +2113,10 @@
                $this->id = $_REQUEST['p_jrn'];
        }
 
-       /* !
-        * \brief retrieve the next number for this type of ledger
-        * \param p_cn connx
-        * \param p_type ledger type
+       /**
+        * @brief retrieve the next number for this type of ledger
+        * @paramp_cn connx
+        * @paramp_type ledger type
         *
         * \return the number
         *
@@ -2113,8 +2130,9 @@
                return $Ret + 1;
        }
 
-       /* !\brief get the first ledger
-        * \param the type
+       /**
+        * @brief get the first ledger
+        * @paramthe type
         * \return the j_id
         */
 
@@ -2125,8 +2143,9 @@
                return $all[0];
        }
 
-       /* !\brief Update the paiment  in the list of operation
-        * \param $p_array is normally $_GET
+       /**
+        * @brief Update the paiment  in the list of operation
+        * @param$p_array is normally $_GET
         */
 
        function update_paid($p_array)
@@ -2161,9 +2180,10 @@
                                " jr_grpt_id = " . $this->grpt_id);
        }
 
-       /* !\brief retrieve all the card for this type of ledger, make them
+       /**
+        * @brief retrieve all the card for this type of ledger, make them
         * into a string separated by comma
-        * \param none
+        * @paramnone
         * \return all the card or null is nothing is found
         */
 
@@ -2197,8 +2217,9 @@
                return $card;
        }
 
-       /* !\brief get the saldo of an exercice, used for the opening of a 
folder
-        * \param $p_exercice is the exercice we want
+       /**
+        * @brief get the saldo of an exercice, used for the opening of a folder
+        * @param$p_exercice is the exercice we want
         * \return an array
         * index =
         * - solde (debit > 0 ; credit < 0)
@@ -2225,8 +2246,8 @@
                return $res;
        }
 
-       /* !
-        * \brief Check if a Dossier is using the strict mode or not
+       /**
+        * @brief Check if a Dossier is using the strict mode or not
         * \return true if we are using the strict_mode
         */
 
@@ -2240,8 +2261,8 @@
                exit("Valeur invalid " . __FILE__ . ':' . __LINE__);
        }
 
-       /* !
-        * \brief Check if a Dossier is using the check on the periode, if true 
than the user has to enter the date
+       /**
+        * @brief Check if a Dossier is using the check on the periode, if true 
than the user has to enter the date
         * and the periode, it is a security check
         * \return true if we are using the double encoding (date+periode)
         */
@@ -2256,7 +2277,8 @@
                exit("Valeur invalid " . __FILE__ . ':' . __LINE__);
        }
 
-       /* !\brief get the date of the last operation
+       /**
+        * @brief get the date of the last operation
         */
 
        function get_last_date()
@@ -2268,9 +2290,10 @@
                return $date;
        }
 
-       /* !\brief retrieve the jr_id thanks the internal code, do not change
+       /**
+        * @brief retrieve the jr_id thanks the internal code, do not change
         * anything to the current object
-        * \param the internal code
+        * @paramthe internal code
         * \return the jr_id or 0 if not found
         */
 
@@ -2283,10 +2306,11 @@
                return $value;
        }
 
-       /* !\brief create the invoice and saved it as attachment to the
+       /**
+        * @brief create the invoice and saved it as attachment to the
         * operation,
-        * \param $internal is the internal code
-        * \param $p_array is normally the $_POST
+        * @param$internal is the internal code
+        * @param$p_array is normally the $_POST
         * \return a string
         */
 
@@ -2309,8 +2333,9 @@
                return h($doc->d_name . ' (' . $doc->d_filename . ')');
        }
 
-       /* !\brief check if the payment method is valid
-        * \param $e_mp is the value and $e_mp_qcode is the quickcode
+       /**
+        * @brief check if the payment method is valid
+        * @param$e_mp is the value and $e_mp_qcode is the quickcode
         * \return nothing throw an Exception
         */
 
@@ -2346,7 +2371,8 @@
                }
        }
 
-       /* !\brief increment the sequence for the pj */
+       /**
+        * @brief increment the sequence for the pj */
 
        function inc_seq_pj()
        {
@@ -2354,7 +2380,8 @@
                $this->db->exec_sql($sql);
        }
 
-       /* address@hidden return a HTML string with the form for the search
+       /**
+        * @brief return a HTML string with the form for the search
         * @param $p_type if the type of ledger possible 
values=ALL,VEN,ACH,ODS,FIN
         * @param $all_type_ledger
         *       values :
@@ -2462,15 +2489,16 @@
                ob_start();
                require_once('template/ledger_search.php');
                $r.=ob_get_contents();
-               ob_clean();
+               ob_end_clean();
                return $r;
        }
 
-       /* !\brief this function will create a sql stmt to use to create the 
list for
+       /**
+        * @brief this function will create a sql stmt to use to create the 
list for
         * the ledger,
-        * \param $p_array is usually the $_GET,
-        * \param $p_order the order of the row
-        * \param $p_where is the sql condition if not null then the $p_array 
will not be used
+        * @param$p_array is usually the $_GET,
+        * @param$p_order the order of the row
+        * @param$p_where is the sql condition if not null then the $p_array 
will not be used
         * \note the p_action will be used to filter the ledger but gl means ALL
         * struct array $p_array
          \verbatim
@@ -2526,7 +2554,7 @@
                and f_id=(select qf_other from quant_fin where 
quant_fin.jr_id=x.jr_id))
            end as name,
           case
-            when jrn_def_type='VEB' then (select ad_value from fiche_detail 
where ad_id=32 and f_id=(select max(qs_client) from quant_sold join jrnx using 
(j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
+            when jrn_def_type='VEN' then (select ad_value from fiche_detail 
where ad_id=32 and f_id=(select max(qs_client) from quant_sold join jrnx using 
(j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
            when jrn_def_type = 'ACH' then (select ad_value from fiche_detail 
where ad_id=32 and f_id=(select max(qp_supplier) from quant_purchase join jrnx 
using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
            when jrn_def_type = 'FIN' then (select ad_value from fiche_detail 
where ad_id=32 and f_id=(select qf_other from quant_fin where 
quant_fin.jr_id=x.jr_id))
            end as first_name,
@@ -2534,7 +2562,20 @@
             when jrn_def_type='VEN' then (select ad_value from fiche_detail 
where ad_id=23 and f_id=(select max(qs_client) from quant_sold join jrnx using 
(j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
            when jrn_def_type = 'ACH' then (select ad_value from fiche_detail 
where ad_id=23 and f_id=(select max(qp_supplier) from quant_purchase join jrnx 
using (j_id) join jrn as e on (e.jr_grpt_id=j_grpt) where e.jr_id=x.jr_id))
            when jrn_def_type = 'FIN' then (select ad_value from fiche_detail 
where ad_id=23 and f_id=(select qf_other from quant_fin where 
quant_fin.jr_id=x.jr_id))
-           end as quick_code
+           end as quick_code,
+           case
+            when jrn_def_type='VEN' then
+                    (select sum(qs_price)+sum(vat) from
+                               (select qs_internal,qs_price,case when 
qs_vat_sided<>0 then 0 else qs_vat end as vat from quant_sold where 
qs_internal=X.jr_internal) as ven_invoice
+                         )
+           when jrn_def_type = 'ACH' then
+                       (
+                               select 
sum(qp_price)+sum(vat)+sum(qp_nd_tva)+sum(qp_nd_tva_recup)
+                               from
+                                (select 
qp_internal,qp_price,qp_nd_tva,qp_nd_tva_recup,case when qp_vat_sided<>0 then 0 
else qp_vat end as vat from quant_purchase where qp_internal=X.jr_internal) as 
invoice_purchase
+                       )
+               else null
+               end as total_invoice
 
 
              from
@@ -2708,7 +2749,8 @@
                return array($sql, $where);
        }
 
-       /* !\brief return a html string with the search_form
+       /**
+        * @brief return a html string with the search_form
         * \return a HTML string with the FORM
         * \see build_search_sql
         * \see search_form
@@ -2753,8 +2795,9 @@
                return $r;
        }
 
-       /* !\brief return the last p_limit operation into an array
-        * \param $p_limit is the max of operation to return
+       /**
+        * @brief return the last p_limit operation into an array
+        * @param$p_limit is the max of operation to return
         * \return $p_array of Follow_Up object
         */
 
@@ -2977,8 +3020,8 @@
        
////////////////////////////////////////////////////////////////////////////////
        // TEST MODULE
        
////////////////////////////////////////////////////////////////////////////////
-       /* !
-        * \brief this function is intended to test this class
+       /**
+        * @brief this function is intended to test this class
         */
        static function test_me($pCase = '')
        {

Modified: phpcompta/trunk/include/class_acc_ledger_fin.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_fin.php    2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_acc_ledger_fin.php    2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief the class Acc_Ledger_Fin inherits from Acc_Ledger, this
  * object permit to manage the financial ledger
  */
@@ -46,7 +46,7 @@
                $this->type = 'FIN';
        }
 
-       /* !\brief verify that the data are correct before inserting or 
confirming
+       /**\brief verify that the data are correct before inserting or 
confirming
         * \param an array (usually $_POST)
         * \return String
         * \throw Exception on error occurs
@@ -223,7 +223,7 @@
                }
        }
 
-       /* !\brief
+       /**\brief
         * \param $p_array contains the value usually it is $_POST
         * \return string with html code
         * \note the form tag are not  set here
@@ -291,12 +291,14 @@
 
                // Ledger (p_jrn)
                //--
+               
$onchange="update_bank();ajax_saldo('first_sold');update_name();";
 
-               $add_js = 
'onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\');update_name();"';
-
                if ($g_parameter->MY_DATE_SUGGEST == 'Y')
-                       $add_js = 
'onchange="update_pj();update_bank();get_last_date();ajax_saldo(\'first_sold\')";';
+                       $onchange .= 'get_last_date();';
+               if ($g_parameter->MY_PJ_SUGGEST=='Y')
+                       $onchange .= 'update_pj();';
 
+               $add_js = 'onchange="'.$onchange.'"';
                $wLedger = $this->select_ledger('FIN', 2);
                if ($wLedger == null)
                        exit('Pas de journal disponible');
@@ -367,6 +369,7 @@
                        $W1 = new ICard();
                        $W1->label = "";
                        $W1->name = "e_other" . $i;
+                       $W1->id = "e_other" . $i;
                        $W1->value = $tiers;
                        $W1->extra = 'deb';  // credits
                        $W1->typecard = 'deb';
@@ -396,6 +399,7 @@
                        }
 
                        $wcard_name = new IText("e_other_name" . $i, 
$card_name);
+                       $wcard_name->id=$wcard_name->name;
                        $wcard_name->readOnly = true;
                        $array[$i]['cname'] = $wcard_name->input();
 
@@ -425,13 +429,13 @@
                ob_start();
                require_once('template/form_ledger_fin.php');
                $r.=ob_get_contents();
-               ob_clean();
+               ob_end_clean();
 
 
                return $r;
        }
 
-       /* !\brief show the summary before inserting into the database, it
+       /**\brief show the summary before inserting into the database, it
         * calls the function for adding a attachment. The function verify
         * should be called before
         * \param $p_array an array usually is $_POST
@@ -440,7 +444,7 @@
 
        public function confirm($p_array, $p_nothing = 0)
        {
-               global $g_parameter;
+               global $g_parameter,$g_user;
                $r = "";
                bcscale(2);
                extract($p_array);
@@ -451,7 +455,11 @@
                }
                else
                {
-                       $pPeriode->find_periode($e_date);
+                       if (isDate($e_date) != null) {
+                               $pPeriode->find_periode($e_date);
+                       } else {
+                               $pPeriode->p_id=$g_user->get_periode();
+                       }
                }
 
                list ($l_date_start, $l_date_end) = $pPeriode->get_date_limit();
@@ -459,7 +467,7 @@
                $r.='';
                $r.='<fieldset><legend>Banque, caisse </legend>';
                $r.= '<div id="jrn_name_div">';
-               $r.='<h2 id="jrn_name" style="display:inline">' . 
$this->get_name() . '</h2>';
+               $r.='<h2 class="title" id="jrn_name" style="display:inline">' . 
$this->get_name() . '</h2>';
                $r.= '</div>';
                $r.='<TABLE  width="100%">';
                //  Date
@@ -502,23 +510,22 @@
 
                $r.='</fieldset>';
 
-               $r.='<fieldset><legend>Opérations financières</legend>';
+               $r.='<div class="myfieldset"><h1 class="legend">Extrait de 
compte</h1>';
                //--------------------------------------------------
                // Saldo begin end
                //-------------------------------------------------
-               $r.='<fieldset><legend>Extrait de compte</legend>';
                $r.='<table>';
                $r.='<tr>';
                // Extrait
                //--
-               $r.='<td> Numéro d\'extrait</td>' . h($e_pj);
-               $r.='<td >Solde début extrait </td>';
-               $r.='<td>' . $first_sold . '</td>';
-               $r.='<td>Solde fin extrait </td>';
-               $r.='<td>' . $last_sold . '</td>';
+               $r.=tr('<td> Numéro d\'extrait</td>' . td(h($e_pj)));
+               $r.='<tr><td >Solde début extrait </td>';
+               $r.='<td style="num">' . nbm($first_sold) . '</td></tr>';
+               $r.='<tr><td>Solde fin extrait </td>';
+               $r.='<td style="num">' . nbm($last_sold) . '</td></tr>';
                $r.='</table>';
-               $r.='</fieldset>';
 
+               $r.='<h1 class="legend">Opérations financières</h1>';
                //--------------------------------------------------
                // financial operation
                //-------------------------------------------------
@@ -582,9 +589,11 @@
                        if (${"e_concerned" . $i} != '')
                        {
                                $jr_internal = $this->db->get_array("select 
jr_internal from jrn where jr_id in (" . ${"e_concerned" . $i} . ")");
+                               $comma="";
                                for ($x = 0; $x < count($jr_internal); $x++)
                                {
-                                       
$r.=HtmlInput::detail_op(${"e_concerned" . $i}, 
$jr_internal[$x]['jr_internal']);
+                                       
$r.=$comma.HtmlInput::detail_op(${"e_concerned" . $i}, 
$jr_internal[$x]['jr_internal']);
+                                       $comma=" , ";
                                }
                        }
                        $r.='</td>';
@@ -618,7 +627,7 @@
                $r.="<br>Ajoutez une pi&egrave;ce justificative ";
                $r.=$file->input("pj", "");
 
-               $r.='</fieldset>';
+               $r.='</div>';
                //--------------------------------------------------
                // Hidden variables
                //--------------------------------------------------
@@ -652,7 +661,7 @@
                return $r;
        }
 
-       /* !\brief save the data into the database, included the attachment,
+       /**\brief save the data into the database, included the attachment,
         * and the reconciliations
         * \param $p_array usually $_POST
         * \return string with HTML code
@@ -718,7 +727,7 @@
                        $get_solde=true;
                        for ($i = 0; $i < $nb_item; $i++)
                        {
-                               // if tiers is set and amount != 0 insert it 
into the database
+                               // insert it into the database
                                // and quit the loop ?
                                if (strlen(trim(${"e_other$i"})) == 0)
                                        continue;
@@ -949,7 +958,7 @@
                return $ret;
        }
 
-       /* !\brief display operation of a FIN ledger
+       /**\brief display operation of a FIN ledger
         * \return html code into a string
         */
 

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-05-03 
22:31:33 UTC (rev 5216)
@@ -342,18 +342,19 @@
             $tot_perso=0;
             $tot_tva_nd=0;
             $tot_tva_ndded=0;
+                       $tva=array();
             /* Save all the items without vat and no deductible vat and 
expense*/
             for ($i=0;$i< $nb_item;$i++)
             {
                                $n_both=0;
                 if ( strlen(trim(${'e_march'.$i})) == 0 ) continue;
-                if ( ${'e_march'.$i.'_price'} == 0 ) continue;
+           /*     if ( ${'e_march'.$i.'_price'} == 0 ) continue;
                 if ( ${'e_quant'.$i} == 0 ) continue;
-
+*/
                 /* First we save all the items without vat */
                 $fiche=new Fiche($this->db);
                 $fiche->get_by_qcode(${"e_march".$i});
-
+                               $tva_both=0;
                 /* tva */
                 if ($g_parameter->MY_TVA_USE=='Y')
                 {
@@ -361,6 +362,7 @@
                     $oTva=new Acc_Tva($this->db);
                     $oTva->set_parameter('id',$idx_tva);
                     $oTva->load();
+                                       
$tva_both=$oTva->get_parameter("both_side");
                 }
 
                 /* We have to compute all the amount thanks Acc_Compute */
@@ -381,7 +383,7 @@
                         $acc_amount->amount_vat= ${'e_march'.$i.'_tva_amount'};
 
                     }
-                    if ($oTva->get_parameter("both_side")==0) 
$tot_tva=bcadd($tot_tva,$acc_amount->amount_vat);
+                    if ($tva_both==0) 
$tot_tva=bcadd($tot_tva,$acc_amount->amount_vat);
                 }
 
                 $acc_operation=new Acc_Operation($this->db);
@@ -414,7 +416,7 @@
                     $tot_perso+=$acc_amount->amount_perso;
                 }
 
-                if ( ! $fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE))
+                if ( ! $fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE) && 
$tva_both==0)
                 {
                     
$acc_amount->nd_vat_rate=$fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE);
                     $acc_amount->compute_nd_vat();
@@ -422,7 +424,7 @@
                     /* save op. */
 
                 }
-                if ( ! 
$fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP))
+                if ( ! 
$fiche->empty_attribute(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP) && $tva_both==0)
                 {
                     
$acc_amount->nd_ded_vat_rate=$fiche->strAttribut(ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP);
                     $acc_amount->compute_ndded_vat();
@@ -449,7 +451,6 @@
                 $acc_operation->amount=$acc_amount->amount;
                 $acc_operation->qcode=${"e_march".$i};
                 if( $acc_amount->amount > 0 ) 
$tot_debit=bcadd($tot_debit,$acc_amount->amount);
-
                 $j_id=$acc_operation->insert_jrnx();
 
                 /* Compute sum vat */
@@ -491,7 +492,7 @@
                 //-----
                 if ( $g_parameter->MY_TVA_USE=='Y')
                 {
-                    if ( $oTva->get_parameter("both_side")==1) 
$n_both=$acc_amount->amount_vat;
+                    if ( $tva_both==1) $n_both=$acc_amount->amount_vat;
 
                     $r=$this->db->exec_sql("select insert_quant_purchase ".
                                            "(null".
@@ -539,7 +540,8 @@
             $acc_operation->type='c';
             $acc_operation->periode=$tperiode;
             $acc_operation->qcode=${"e_client"};
-            if ( $cust_amount < 0 ) 
$tot_debit=bcadd($tot_debit,abs($cust_amount));
+            if ( $cust_amount < 0 )
+                               $tot_debit=bcadd($tot_debit,abs($cust_amount));
             $let_client=$acc_operation->insert_jrnx();
             /*
              * Save all the no deductible
@@ -601,7 +603,7 @@
                 /* save op. */
                 $acc_operation->type='d';
                 $acc_operation->qcode='';
-             if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA_ND))
+             if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA_ND) && 
$tva_both==0)
                {
                  $dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA_ND);
                }
@@ -621,7 +623,7 @@
             {
              $dna_default=new Acc_Parm_Code($this->db,'TVA_DED_IMPOT');
                 /* save op. */
-             if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA))
+             if ( ! $fiche->empty_attribute(ATTR_DEF_ACCOUNT_ND_TVA) && 
$tva_both==0)
                {
                  $dna=$fiche->strAttribut(ATTR_DEF_ACCOUNT_ND_TVA);
                }
@@ -665,7 +667,7 @@
                     $acc_operation->jrn=$p_jrn;
                     $acc_operation->type='d';
                     $acc_operation->periode=$tperiode;
-                    if ( $value > 0 ) $tot_debit=bcadd($tot_debit,$value);
+                    if ( $value > 0 ) $tot_debit=bcadd($tot_debit,abs($value));
                     $acc_operation->insert_jrnx();
                     // if TVA is on both side, we deduce it immediately
                     if ( $oTva->get_parameter("both_side")==1)
@@ -681,6 +683,7 @@
                         $acc_operation->type='c';
                         $acc_operation->periode=$tperiode;
                         $acc_operation->insert_jrnx();
+                                                if ( $value < 0 ) 
$tot_debit=bcadd($tot_debit,abs($value));
                     }
 
                 }
@@ -706,7 +709,7 @@
             $this->db->exec_sql('update quant_purchase set qp_internal = $1 
where j_id in (select j_id from jrnx where j_grpt=$2)',
                                 array($internal,$seq));
 
-            /* if e_suggest != e_pj then do not increment sequence */
+            /**= e_pj then do not increment sequence */
             if ( strcmp($e_pj,$e_pj_suggest) == 0 && strlen(trim($e_pj)) != 0 )
             {
                 $this->inc_seq_pj();
@@ -794,7 +797,7 @@
 
                 /* insert into jrn */
                 $acc_pay->mt=$mt;
-                               $acc_pay->desc=$e_comm;
+                               $acc_pay->desc=(!isset($e_comm_paiement) || 
strlen(trim($e_comm_paiement)) == 0) ?$e_comm:$e_comm_paiement;
                 $mp_jr_id=$acc_pay->insert_jrn();
                 $acjrn->grpt_id=$acseq;
                 $acjrn->update_internal_code($acinternal);
@@ -972,7 +975,10 @@
         {
             $add_js="update_pj();";
         }
-        $add_js.='get_last_date();';
+               if ($g_parameter->MY_DATE_SUGGEST == 'Y')
+               {
+                       $add_js.='get_last_date();';
+               }
                $add_js.='update_name();';
                $add_js.='update_pay_method()';
 
@@ -1083,10 +1089,8 @@
             /* use vat */
             if ( $g_parameter->MY_TVA_USE=='Y')
             {
-                
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:""
-                              ;
-                
$march_tva_amount=(isset(${"e_march$i"."_tva_amount"}))?${"e_march$i"."_tva_amount"}:""
-                                  ;
+                
$march_tva_id=(isset(${"e_march$i"."_tva_id"}))?${"e_march$i"."_tva_id"}:"";
+                
$march_tva_amount=(isset(${"e_march$i"."_tva_amount"}))?${"e_march$i"."_tva_amount"}:"";
             }
 
 
@@ -1210,7 +1214,7 @@
         ob_start();
         require_once('template/form_ledger_detail.php');
         $r.=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
 
         // Set correctly the REQUEST param for jrn_type
         $r.= HtmlInput::hidden('jrn_type','ACH');
@@ -1267,7 +1271,7 @@
         $r.="<fieldset>";
         $r.="<legend>"._('En-tête facture fournisseur')."  </legend>";
                $r.='<div id="jrn_name_div">';
-               $r.='<h2 id="jrn_name">'.$this->get_name().'</h2>';
+               $r.='<h2 class="title"  
id="jrn_name">'.$this->get_name().'</h2>';
                $r.='</div>';
         $r.='<TABLE  width="100%">';
         $r.='<tr>';
@@ -1525,13 +1529,16 @@
         {
             $r.=HtmlInput::hidden('e_mp_qcode_'.$e_mp,${'e_mp_qcode_'.$e_mp});
             $r.=HtmlInput::hidden('acompte',$acompte);
+                       
$r.=HtmlInput::hidden('e_comm_paiement',$e_comm_paiement);
             /* needed for generating a invoice */
             $r.=HtmlInput::hidden('qcode_benef', ${'e_mp_qcode_' . $e_mp});
                        $fname = new Fiche($this->db);
                        $fname->get_by_qcode(${'e_mp_qcode_' . $e_mp});
                        $r.="<div style=\"clear:both\"></div>";
                        $r.='<div style="float:left"><h2 class="info">' . "Payé 
par " . ${'e_mp_qcode_' . $e_mp} .
-                                       " ".$fname->getName() ."</h2> ". 
_('Déduction acompte ').h($acompte).'</div>';
+                                       " ".$fname->getName() ."</h2> ".
+                                       '<p>'._('Déduction acompte 
').h($acompte).'</p>'.
+                                       _('Libellé :' 
).h($e_comm_paiement).'</div>';
             $r.='<br>';
         }
         // check for upload piece

Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php   2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php   2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -1,4 +1,4 @@
-<?php
+ <?php
 /*
  *   This file is part of PhpCompta.
  *
@@ -275,13 +275,12 @@
             $tot_tva=0;
             $tot_debit=0;
             $this->db->start();
+                       $tva=array();
             /* Save all the items without vat */
             for ($i=0;$i< $nb_item;$i++)
             {
                                $n_both=0;
                 if ( strlen(trim(${'e_march'.$i})) == 0 ) continue;
-                if ( ${'e_march'.$i.'_price'} == 0 ) continue;
-                if ( ${'e_quant'.$i} == 0 ) continue;
 
                 /* First we save all the items without vat */
                 $fiche=new Fiche($this->db);
@@ -325,8 +324,8 @@
                     $oTva=new Acc_Tva($this->db);
                     $idx_tva=${'e_march'.$i.'_tva_id'};
                     $tva_item=${'e_march'.$i.'_tva_amount'};
-                   $oTva->set_parameter("id",$idx_tva);
-                   $oTva->load();
+                                       $oTva->set_parameter("id",$idx_tva);
+                                       $oTva->load();
                     /* if empty then we need to compute it */
                     if (trim($tva_item)=='')
                     {
@@ -339,18 +338,19 @@
                         $tva[$idx_tva]+=$tva_item;
                     else
                         $tva[$idx_tva]=$tva_item;
-                    if ($oTva->get_parameter("both_side")==0) 
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
-                    else $n_both=$tva_item;
+                    if ($oTva->get_parameter("both_side")==0) {
+                                               
$tot_tva=round(bcadd($tva_item,$tot_tva),2);
+                                       }else {
+                                                       $n_both=$tva_item;
+                                                       if ( $n_both < 0 ) 
$tot_debit=bcadd($tot_debit,abs($n_both));
+                                       }
                 }
 
                 /* Save the stock */
                 /* if the quantity is < 0 then the stock increase (return of
                  *  material)
                  */
-                $nNeg=($
-                       {"e_quant".$i
-                       }
-                       <0)?-1:1;
+                $nNeg=(${"e_quant".$i}<0)?-1:1;
 
                 // always save quantity but in withStock we can find
                 // what card need a stock management
@@ -478,7 +478,7 @@
 
             $this->pj=$acc_operation->set_pj();
 
-            /* if e_suggest != e_pj then do not increment sequence */
+            /**= e_pj then do not increment sequence */
             /* and e_pj is not null */
             if ( strcmp($e_pj,$e_pj_suggest) == 0 && strlen( trim($e_pj)) != 0 
)
             {
@@ -566,8 +566,9 @@
                 $let_other=$acc_pay->insert_jrnx();
 
                 /* insert into jrn */
-                               $acjrn->desc=$e_comm;
+                               $acc_pay->mt=$mt;
                 $acjrn->grpt_id=$acseq;
+                               $acc_pay->desc=(!isset($e_comm_paiement) || 
strlen(trim($e_comm_paiement)) == 0) ?$e_comm:$e_comm_paiement;
                 $mp_jr_id=$acc_pay->insert_jrn();
                 $acjrn->update_internal_code($acinternal);
 
@@ -664,7 +665,7 @@
         $r.="<fieldset>";
         $r.="<legend>"._('En-tête facture client')."  </legend>";
                $r.='<div id="jrn_name_div">';
-               $r.='<h2 id="jrn_name" style="display:inline">' . 
$this->get_name() . '</h2>';
+               $r.='<h2 class="title"  id="jrn_name" style="display:inline">' 
. $this->get_name() . '</h2>';
                $r.= '</div>';
         $r.='<TABLE  width="100%">';
         $r.='<tr>';
@@ -906,6 +907,7 @@
         {
             $r.=HtmlInput::hidden('e_mp_qcode_'.$e_mp,${'e_mp_qcode_'.$e_mp});
             $r.=HtmlInput::hidden('acompte',$acompte);
+                       
$r.=HtmlInput::hidden('e_comm_paiement',$e_comm_paiement);
             /* needed for generating a invoice */
             $r.=HtmlInput::hidden('qcode_benef',${'e_mp_qcode_'.$e_mp});
 
@@ -913,7 +915,8 @@
                        $fname->get_by_qcode(${'e_mp_qcode_'.$e_mp});
                        $r.="<div style=\"clear:both\"></div>";
                        $r.='<div style="float:left"><h2 class="info">'."Payé 
par ".${'e_mp_qcode_'.$e_mp}.
-                                  " ".$fname->getName().'</H2> '._('Déduction 
acompte ').h($acompte).'</div>';
+                                  " ".$fname->getName().'</H2> 
'.'<p>'._('Déduction acompte ').h($acompte).'</p>'.
+                                       _('Libellé :' 
).h($e_comm_paiement).'</div>';
             $r.='<br>';
         }
 
@@ -1104,7 +1107,10 @@
         {
             $add_js="update_pj();";
         }
-        $add_js.='get_last_date();';
+               if ($g_parameter->MY_DATE_SUGGEST == 'Y')
+               {
+                       $add_js.='get_last_date();';
+               }
                $add_js.='update_name();';
                $add_js.='update_pay_method()';
 
@@ -1336,7 +1342,7 @@
         ob_start();
         require_once('template/form_ledger_detail.php');
         $r.=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
 
 
 

Modified: phpcompta/trunk/include/class_acc_operation.php
===================================================================
--- phpcompta/trunk/include/class_acc_operation.php     2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_acc_operation.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -306,7 +306,7 @@
         $csv="";
         foreach ($show as $l)
         {
-            if ( $l['j_poste'] == $this->poste || $l['j_qcode']==$this->qcode)
+            if ( $l['j_poste'] == $this->poste || ($l['j_qcode']==$this->qcode 
&& trim($this->qcode) != ''))
                 $border=' style="border-bottom:1px solid red;"';
             else
                 $border='';
@@ -468,7 +468,7 @@
     }
     /**
     address@hidden retrieve data from jrnx and jrn
-    address@hidden return an object 
+    address@hidden return an object
     address@hidden
     address@hidden
     @code
@@ -562,7 +562,7 @@
 /**
  address@hidden this class manage data from the JRNX and JRN
  * table
- address@hidden Data member are the column of the table 
+ address@hidden Data member are the column of the table
  */
 class Acc_Misc extends Acc_Detail
 {
@@ -588,7 +588,7 @@
 /**
  address@hidden this class manage data from the QUANT_SOLD
  * table
- address@hidden Data member are the column of the table 
+ address@hidden Data member are the column of the table
  */
 class Acc_Sold extends Acc_Detail
 {
@@ -602,7 +602,7 @@
     {
         parent::get();
         $sql="SELECT qs_id, qs_internal, qs_fiche, qs_quantite, qs_price, 
qs_vat,
-             qs_vat_code, qs_client, qs_valid, j_id,j_text
+             qs_vat_code, qs_client, qs_valid, j_id,j_text,qs_vat_sided
              FROM quant_sold  join jrnx using(j_id) where j_grpt=$1";
         
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
     }
@@ -611,8 +611,8 @@
 /**
  address@hidden this class manage data from the QUANT_PURCHASE
  * table
- address@hidden Data member are the column of the table 
- 
+ address@hidden Data member are the column of the table
+
  */
 class Acc_Purchase extends Acc_Detail
 {
@@ -627,7 +627,7 @@
         parent::get();
         $sql="SELECT qp_id, qp_internal, j_id, qp_fiche, qp_quantite, 
qp_price, qp_vat,
              qp_vat_code, qp_nd_amount, qp_nd_tva, qp_nd_tva_recup, 
qp_supplier,
-             qp_valid, qp_dep_priv,j_text
+             qp_valid, qp_dep_priv,j_text,qp_vat_sided
              FROM quant_purchase  join jrnx using(j_id) where j_grpt=$1";
         
$this->det->array=$this->db->get_array($sql,array($this->det->jr_grpt_id));
     }
@@ -636,7 +636,7 @@
 /**
  address@hidden this class manage data from the QUANT_FIN
  * table
- address@hidden Data member are the column of the table 
+ address@hidden Data member are the column of the table
  */
 class Acc_Fin extends Acc_Detail
 {

Modified: phpcompta/trunk/include/class_acc_payment.php
===================================================================
--- phpcompta/trunk/include/class_acc_payment.php       2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_acc_payment.php       2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -225,50 +225,6 @@
         }
         return $ret;
     }
-    /**
-     address@hidden
-     * @return string
-     */
-    public function row_deprecated()
-    {
-        
//---------------------------------------------------------------------------
-        // Common variable
-        $td='<TD>';
-        $etd='</td>';
-        $tr='<tr>';
-        $etr='</tr>';
-        $th='<th>';
-        $eth='</th>';
-
-        $r='';
-        if ( $this->jrn_def_id != '' )
-        {
-            $name=$this->cn->get_value("select jrn_def_name from jrn_def where 
jrn_def_id=$1",
-                    array($this->jrn_def_id));
-        }
-        $r.=td($this->mp_lib);
-
-        if ( $this->mp_fd_id != NULL && $this->mp_fd_id !=0)
-        {
-            $fiche=new Fiche_Def($this->cn,$this->mp_fd_id);
-            $fiche->Get();
-            $r.=td($fiche->label);
-        }
-        else
-            $r.=$td.$etd;
-        $jrn=new Acc_Ledger($this->cn,$this->mp_jrn_def_id);
-        $r.=$td.$jrn->get_name().$etd;
-        if ( strlen(trim($this->mp_qcode)) != 0 )
-        {
-            $f=new Fiche($this->cn);
-            $f->get_by_qcode($this->mp_qcode);
-            $r.=td($f->strAttribut(ATTR_DEF_NAME));
-
-        }
-        else
-            $r.=$td.$etd;
-        return $r;
-    }
     /*!\brief return a string with a form (into a table)
      *\param none
      *\return a html string
@@ -335,7 +291,16 @@
             $acompte->value=0;
             $r.=_(" Acompte à déduire");
             $r.=$acompte->input();
-        }
+                       $r.='<p>';
+                       $e_comm_paiement=new IText('e_comm_paiement');
+                       $e_comm_paiement->table = 0;
+                       $e_comm_paiement->setReadOnly(false);
+                       $e_comm_paiement->size = 60;
+                       $e_comm_paiement->tabindex = 3;
+                       $r.=_(" Libellé du paiement");
+                       $r.=$e_comm_paiement->input();
+                       $r.='</p>';
+               }
 
         $r.='<ol>';
         $r.='<li ><input type="radio" name="e_mp" value="0" 
checked>'._('Paiement encodé plus tard');
@@ -350,7 +315,7 @@
                 {
                     $a=new ICard();
                     $a->jrn=$row->mp_jrn_def_id;
-                   $a->set_attribute('typecard',$row->mp_fd_id);
+                                       
$a->set_attribute('typecard',$row->mp_fd_id);
                     $a->name='e_mp_qcode_'.$row->mp_id;
                     $a->set_dblclick("fill_ipopcard(this);");
                     $a->set_callback('filter_card');

Modified: phpcompta/trunk/include/class_anticipation.php
===================================================================
--- phpcompta/trunk/include/class_anticipation.php      2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_anticipation.php      2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -112,6 +112,7 @@
      */
     public function display()
     {
+               bcscale(4);
         $forecast=new Forecast($this->cn,$this->f_id);
         $forecast->load();
         $str_name=h($forecast->get_parameter('name'));
@@ -176,7 +177,7 @@
         ob_start();
         require_once('template/forecast_result.php');
         $r.=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
     public static function div()
@@ -246,7 +247,7 @@
         ob_start();
         require_once('template/forecast_cat.php');
         $r.=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
     /**
@@ -309,7 +310,7 @@
         ob_start();
         require_once('template/forecast_cat.php');
         $r.=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
 
     }
@@ -342,7 +343,7 @@
         $cat=new Forecast_Cat($this->cn);
         $array=$cat->make_array($this->f_id);
         $periode=new Periode($this->cn);
-        $aPeriode=$this->cn->make_array("select 
p_id,to_char(p_start,'MM.YYYY') as label from parm_periode 
+        $aPeriode=$this->cn->make_array("select 
p_id,to_char(p_start,'MM.YYYY') as label from parm_periode
                                   where p_start >= (select p_start from 
parm_periode where p_id=$str_start)
                                    and p_end <= (select p_end from 
parm_periode where p_id=$str_end)
                                   order by p_start");
@@ -433,7 +434,7 @@
         ob_start();
         require_once('template/forecast-detail.php');
         $r.=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
     /**

Modified: phpcompta/trunk/include/class_calendar.php
===================================================================
--- phpcompta/trunk/include/class_calendar.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_calendar.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -61,7 +61,7 @@
         for ($i=0;$i<count($array);$i++)
         {
             $ind=$array[$i]['ag_timestamp_day'];
-            $p_array[$ind].="<span class=\"notice\">".$array[$i]['nb']." 
"._("Tâches suivis").'</span>';
+            $p_array[$ind].="<span class=\"notice\">".$array[$i]['nb']." 
"._("Tâches suivies").'</span>';
 
         }
     }
@@ -90,6 +90,8 @@
      */
     function display()
     {
+        global $g_user;
+        $exercice_user=$g_user->get_exercice();
         /* day */
         $cell=array();
         for ($i=0;$i<42;$i++)
@@ -104,7 +106,7 @@
         $this->fill_from_todo($cell);
         $wMonth=new ISelect('per');
         $cn=new Database(dossier::id());
-        $wMonth->value=$cn->make_array("select p_id,to_char(p_start,'MM/YYYY') 
from parm_periode order by p_start");
+        $wMonth->value=$cn->make_array("select p_id,to_char(p_start,'MM/YYYY') 
from parm_periode where p_exercice = '$exercice_user' order by p_start");
         $wMonth->selected=$this->default_periode;
         $wMonth->javascript="onchange=change_month(this)";
         $wMonth->set_attribute('gDossier',dossier::id());

Modified: phpcompta/trunk/include/class_database.php
===================================================================
--- phpcompta/trunk/include/class_database.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_database.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -550,6 +550,39 @@
         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__);
+               exit();
+        }
+        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;
+    }
+    /**
      address@hidden check if the large object exists
      address@hidden $p_oid of the large object
      address@hidden return true if the large obj exist or false if not

Modified: phpcompta/trunk/include/class_document.php
===================================================================
--- phpcompta/trunk/include/class_document.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_document.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -235,13 +235,23 @@
 
                        $to_remove=$pattern;
                        // we remove the < and > from the pattern
-                       $pattern=str_replace($lt,'',$pattern);
-                       $pattern=str_replace($gt,'',$pattern);
+                       $tag=str_replace($lt,'',$pattern);
+                       $tag=str_replace($gt,'',$tag);
 
 
                        // if the pattern if found we replace it
-                       $value=$this->Replace($pattern,$p_array);
+                       $value=$this->Replace($tag,$p_array);
                        if ( strpos($value,'ERROR') != false )            
$value="";
+                        /*
+                         * Change type of cell to numeric
+                         *  allow numeric cel in ODT for the formatting and 
formula 
+                         */
+                       if ( is_numeric($value) && $p_type=='OOo')
+                         {
+                           
$searched='/office:value-type="string"><text:p>'.$pattern.'/';
+                           $replaced='office:value-type="float" 
office:value="'.$value.'"><text:p>'.$pattern;
+                           $buffer=preg_replace($searched, $replaced, 
$buffer,1);
+                         }
                        // replace into the $buffer
                        // take the position in the buffer
                        $pos=strpos($buffer,$to_remove);
@@ -368,7 +378,7 @@
         $r='<A class="mtitle" 
HREF="show_document.php?d_id='.$this->d_id.'&'.dossier::get().'">'.$image.'</A>';
         return $r;
     }
-    /* ! Get
+    /** Get
      * \brief Send the document
      */
     function Send()
@@ -1080,7 +1090,28 @@
                 return $p_array['acompte'];
                        return "0";
             break;
-        }
+               case 'STOCK_NAME':
+                       if ( ! isset ($p_array['repo'])) return "";
+                       $ret=$this->db->get_value('select r_name from 
public.stock_repository where r_id=$1',array($p_array['repo']));
+                       return $ret;
+               case 'STOCK_ADRESS':
+                       if ( ! isset ($p_array['repo'])) return "";
+                       $ret=$this->db->get_value('select r_adress from 
public.stock_repository where r_id=$1',array($p_array['repo']));
+                       return $ret;
+               case 'STOCK_COUNTRY':
+                       if ( ! isset ($p_array['repo'])) return "";
+                       $ret=$this->db->get_value('select r_country from 
public.stock_repository where r_id=$1',array($p_array['repo']));
+                       return $ret;
+               case 'STOCK_CITY':
+                       if ( ! isset ($p_array['repo'])) return "";
+                       $ret=$this->db->get_value('select r_city from 
public.stock_repository where r_id=$1',array($p_array['repo']));
+                       return $ret;
+               case 'STOCK_PHONE':
+                       if ( ! isset ($p_array['repo'])) return "";
+                       $ret=$this->db->get_value('select r_phone from 
public.stock_repository where r_id=$1',array($p_array['repo']));
+                       return $ret;
+
+               }
         /*
          * retrieve the value of ATTR for e_march
          */

Modified: phpcompta/trunk/include/class_document_type.php
===================================================================
--- phpcompta/trunk/include/class_document_type.php     2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_document_type.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -20,17 +20,17 @@
 /* $Revision$ */
 
 // Copyright Author Dany De Bontridder address@hidden
-/* ! \file
+/** \file
  * \brief  class for the table document_type
  */
 
-/* ! \brief class for the table document_type
+/** \brief class for the table document_type
  * < dt_id pk document_type
  * < dt_value value
  */
 class Document_type
 {
-       /* ! document_type
+       /** document_type
         * \brief constructor
         * \param $p_cn database connx
         */
@@ -41,7 +41,7 @@
                $this->dt_id = $p_id;
        }
 
-       /* !
+       /**
         * \brief Get all the data for this dt_id
         */
 

Modified: phpcompta/trunk/include/class_exercice.php
===================================================================
--- phpcompta/trunk/include/class_exercice.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_exercice.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,7 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 /*!\file
- * \brief about the accountant exercice 
+ * \brief about the accountant exercice
  */
 require_once('class_database.php');
 require_once('class_iselect.php');
@@ -56,4 +56,23 @@
      $iselect->javascript=$js;
      return $iselect;
    }
+   /**
+    *Show a ISelect with the different exercices, display start and end date
+    address@hidden $name of the iselect
+    address@hidden $selected the selected year  (default = '')
+    address@hidden $js javascript (default = '')
+    address@hidden ISelect object
+    */
+   function select_date($name,$selected='',$js='')
+   {
+     $iselect=new ISelect($name);
+     $iselect->value=$this->cn->make_array("select distinct p_exercice,to_char 
(min(p_start),'DD.MM.YY')
+                                                                               
                                                         ||' - '
+                                                                               
                                                         ||to_char 
(max(p_end),'DD.MM.YY')
+                                                                               
        from parm_periode
+                                                                               
        group by p_exercice order by 1");
+     $iselect->selected=$selected;
+     $iselect->javascript=$js;
+     return $iselect;
+   }
 }

Modified: phpcompta/trunk/include/class_fiche.php
===================================================================
--- phpcompta/trunk/include/class_fiche.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_fiche.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -178,7 +178,9 @@
         if ( sizeof($this->attribut) != sizeof($e->attribut ) )
         {
 
-            // !!! Missing attribute
+            /*
+                        * !! Missing attribute
+                        */
             foreach ($e->attribut as $f )
             {
                 $flag=0;
@@ -428,7 +430,7 @@
         foreach ($array as $attr)
         {
             $table=0;
-            $msg="";
+            $msg="";$bulle='';
             if ( $attr->ad_id == ATTR_DEF_ACCOUNT)
             {
                 $w=new IPoste("av_text".$attr->ad_id);
@@ -521,8 +523,11 @@
                        $w->table = $table;
                        $w->label = $attr->ad_text;
                        $w->name = "av_text" . $attr->ad_id;
-
-                       $r.="<TR>" . td($w->label, ' class="input_text" ') . 
td($w->input()." $msg")." </TR>";
+                       if ($attr->ad_id == 21 || 
$attr->ad_id==22||$attr->ad_id==20||$attr->ad_id==31)
+                       {
+                               $bulle=HtmlInput::infobulle(21);
+                       }
+                       $r.="<TR>" . td($w->label." $bulle", ' 
class="input_text" ') . td($w->input()." $msg")." </TR>";
                }
                $r.= '</table>';
         return $r;
@@ -690,7 +695,10 @@
                        $w->name = "av_text" . $r->ad_id;
                        $w->readOnly = $p_readonly;
 
-
+                       if ($r->ad_id == 21 || 
$r->ad_id==22||$r->ad_id==20||$r->ad_id==31)
+                       {
+                               $bulle=HtmlInput::infobulle(21);
+                       }
                        $ret.="<TR>" . td($r->ad_text . $bulle) . 
td($w->input()." ". $msg) . " </TR>";
                }
 
@@ -774,6 +782,19 @@
 
                         if ( strlen(trim($v)) != 0)
                         {
+                                                       if( 
strpos($value,',')==0)
+                                                       {
+                                                               
$v=$this->cn->get_value("select format_account($1)",array($value));
+                                                       } else {
+                                                               $ac_array = 
explode(",", $value);
+                                                               if 
(count($ac_array) <> 2)
+                                                                       throw 
new Exception('Désolé, il y a trop de virgule dans le poste comptable ' . 
h($value));
+                                                               $part1 = 
$ac_array[0];
+                                                               $part2 = 
$ac_array[1];
+                                                               $part1 = 
$this->cn->get_value('select format_account($1)', array($part1));
+                                                               $part2 = 
$this->cn->get_value('select format_account($1)', array($part2));
+                                                               $v = $part1 . 
',' . $part2;
+                                                       }
                             $parameter=array($this->id,$v);
                         }
                         else
@@ -895,6 +916,10 @@
                                                        $part2 = 
$this->cn->get_value('select format_account($1)', array($part2));
                                                        $v = $part1 . ',' . 
$part2;
                                                }
+                                               else
+                                               {
+                                                       
$v=$this->cn->get_value('select format_account($1)',array($value));
+                                               }
                                                $sql = sprintf("select 
account_update(%d,'%s')", $this->id, $v);
                                                try
                                                {
@@ -1262,7 +1287,7 @@
             $vw_operation=sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:modifyOperation(\'%s\',\'%s\')" >%s</A>',
                                   $op['jr_id'], dossier::id(), 
$op['jr_internal']);
             $let='';
-            if ( $op['letter'] !=-1) $let=$op['letter'];
+            if ( $op['letter'] !=-1) $let=  
strtoupper(base_convert($op['letter'],10,36));
 
            $tmp_diff=bcsub($op['deb_montant'],$op['cred_montant']);
 
@@ -1483,6 +1508,7 @@
     function Summary($p_search="",$p_action="",$p_sql="",$p_amount=false)
     {
         global $g_user;
+               bcscale(4);
         $str_dossier=dossier::get();
         $p_search=sql_string($p_search);
         $script=$_SERVER['PHP_SELF'];
@@ -1535,7 +1561,7 @@
             return $r;
 
         $i=0;
-
+               $deb=0;$cred=0;
         foreach ($step_tiers as $tiers )
         {
             $i++;
@@ -1559,14 +1585,18 @@
                          " ".$tiers->strAttribut(ATTR_DEF_PAYS)).
                 "</TD>";
 
-            $r.='<TD align="right"> 
'.(($amount['debit']==0)?0:nbm($amount['debit'])).'&euro;</TD>';
-           $r.='<TD align="right"> 
'.(($amount['credit']==0)?0:nbm($amount['credit'])).'&euro;</TD>';
-           $r.='<TD align="right"> '.nbm($amount['solde'])."&euro;</TD>";
+            $r.='<TD align="right"> 
'.(($amount['debit']==0)?0:nbm($amount['debit'])).'</TD>';
+                       $r.='<TD align="right"> 
'.(($amount['credit']==0)?0:nbm($amount['credit'])).'</TD>';
+                       $r.='<TD align="right"> '.nbm($amount['solde'])."</TD>";
+                       $deb=bcadd($deb,$amount['debit']);
+                       $cred=bcadd($cred,$amount['credit']);
 
-
             $r.="</TR>";
 
         }
+               $r.="<tr>";
+               $solde=bcsub($deb,$cred);
+               
$r.=td("").td("").td("Totaux").td(nbm($deb),'class="num"').td(nbm($cred),'class="num"').td(nbm($solde),'class="num"');
         $r.="</TABLE>";
         $r.=$bar;
         return $r;

Modified: phpcompta/trunk/include/class_fiche_def.php
===================================================================
--- phpcompta/trunk/include/class_fiche_def.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_fiche_def.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -206,7 +206,7 @@
                        alert (_('Le nom de la catégorie ne peut pas être 
vide'));
             return 1;
                }
-        // $p_FICHE_REF cannot be null !!! (== fiche_def_ref.frd_id
+        /**!! (== fiche_def_ref.frd_id
         if (! isset ($p_FICHE_REF) || strlen($p_FICHE_REF) == 0 )
         {
             echo alert (_('Vous devez choisir une categorie'));
@@ -254,15 +254,13 @@
                 $sql="select account_add($1,$2)";
                 $Res=$this->cn->exec_sql($sql,array($p_class_base,$p_nom_mod));
             }
+                       // Get the fd_id
+                       $fd_id=$this->cn->get_current_seq('s_fdef');
 
-            // Get the fd_id
-            $fd_id=$this->cn->get_current_seq('s_fdef');
-
-            // update jnt_fic_attr
-            $sql=sprintf("insert into jnt_fic_attr(fd_id,ad_id,jnt_order)
-                         values (%d,%d,10)",$fd_id,ATTR_DEF_ACCOUNT);
-            $Res=$this->cn->exec_sql($sql);
-
+                       // update jnt_fic_attr
+                       $sql=sprintf("insert into 
jnt_fic_attr(fd_id,ad_id,jnt_order)
+                                        values 
(%d,%d,10)",$fd_id,ATTR_DEF_ACCOUNT);
+                       $Res=$this->cn->exec_sql($sql);
         }
         else
         {
@@ -291,11 +289,15 @@
                                $order=$jnt_order;
                 if ( $v['ad_id'] == ATTR_DEF_NAME )
                     $order=0;
-                $sql=sprintf("insert into jnt_fic_Attr(fd_id,ad_id,jnt_order)
+                               $count=$this->cn->get_value("select count(*) 
from jnt_fic_attr where fd_id=$1 and ad_id=$2",array($fd_id,$v['ad_id']));
+                               if ($count == 0)
+                               {
+                                       $sql=sprintf("insert into 
jnt_fic_Attr(fd_id,ad_id,jnt_order)
                              values (%d,%s,%d)",
                              $fd_id,$v['ad_id'],$order);
-                $this->cn->exec_sql($sql);
-                               $jnt_order+=10;
+                                       $this->cn->exec_sql($sql);
+                                       $jnt_order+=10;
+                               }
             }
         }
         $this->id=$fd_id;

Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_follow_up.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -38,7 +38,8 @@
 require_once 'class_sort_table.php';
 require_once 'class_irelated_action.php';
 
-/* !\file
+/**
+ * \file
  * \brief class_action for manipulating actions
  * action can be :
  * <ul>
@@ -49,7 +50,7 @@
  * </ul>
  * The table document_type are the possible actions
  */
-/* !
+/**
  * \brief class_action for manipulating actions
  * action can be :
  * <ul>
@@ -62,24 +63,25 @@
 
 class Follow_Up
 {
+    
 
-       var $db; /* !<  $db  database connexion    */
-       var $ag_timestamp;  /* !<   $ag_timestamp document date 
(ag_gestion.ag_timestamp) */
-       var $dt_id;   /* !<   $dt_id type of the document (document_type.dt_id) 
*/
-       var $ag_state; /* !<   $ag_state stage of the document (printed, send 
to client...) */
-       var $d_number;   /* !<   $d_number number of the document */
-       var $d_filename; /* !<   $d_filename filename's document      */
-       var $d_mimetype; /* !<   $d_mimetype document's filename      */
-       var $ag_title;   /* !<   $ag_title title document             */
-       var $f_id; /* !<   $f_id_dest fiche id (From field )  */
-       var $ag_ref;  /* !< $ag_ref is the ref  */
-       var $ag_hour;  /* !< $ag_hour is the hour of the meeting, action */
-       var $ag_priority; /* !< $ag_priority is the priority 1 High, 2 medium, 
3 low */
-       var $ag_dest;  /* !< $ag_dest person who is in charged */
-       var $ag_contact;  /* !< $ag_contact contact */
-       var $ag_remind_date;  /* !< $ag_contact contact */
+       var $db; /*!<  $db  database connexion    */
+       var $ag_timestamp;  /*!<   $ag_timestamp document date 
(ag_gestion.ag_timestamp) */
+       var $dt_id;   /*!<   $dt_id type of the document (document_type.dt_id) 
*/
+       var $ag_state; /*!<   $ag_state stage of the document (printed, send to 
client...) */
+       var $d_number;   /*!<   $d_number number of the document */
+       var $d_filename; /*!<   $d_filename filename's document      */
+       var $d_mimetype; /*!<   $d_mimetype document's filename      */
+       var $ag_title;   /*!<   $ag_title title document              */
+       var $f_id; /*!<   $f_id_dest fiche id (From field )  */
+       var $ag_ref;  /*!< $ag_ref is the ref  */
+       var $ag_hour;  /*!< $ag_hour is the hour of the meeting, action */
+       var $ag_priority; /*!< $ag_priority is the priority 1 High, 2 medium, 3 
low */
+       var $ag_dest;  /*!< $ag_dest person who is in charged */
+       var $ag_contact;  /*!< $ag_contact contact */
+       var $ag_remind_date;  /*!< $ag_contact contact */
 
-       /* !  constructor
+       /**  constructor
         * \brief constructor
         * \param p_cn database connection
         */
@@ -106,7 +108,7 @@
                return $sql;
        }
        //----------------------------------------------------------------------
-       /* !
+       /**
         * \brief Display the object, the tags for the FORM
         *        are in the caller. It will be used for adding and updating
         *        action
@@ -114,7 +116,7 @@
         *        it is a new document
         *
         * \param $p_view if set to true the form will be in readonly mode 
(value: true or false)
-        * \param $p_gen true we show the tag for generating a doc (value : 
true or false)
+        * \param $p_gen true we show the tag for generating a doc (value : 
true or false) and adding files
         * \param $p_base is the ac parameter
         * \param $retour is the html code for the return button
         * \note  update the reference number or the document type is not 
allowed
@@ -177,7 +179,7 @@
                        $desc->width = 120;
                        $desc->heigh = 40;
                }
-               $acomment = $this->db->get_array("SELECT agc_id, ag_id, 
to_char(agc_date,'DD.MM.YYYY') as str_agc_date, agc_comment, tech_user
+               $acomment = $this->db->get_array("SELECT agc_id, ag_id, 
to_char(agc_date,'DD.MM.YYYY HH24:MI') as str_agc_date, agc_comment, tech_user
                                 FROM action_gestion_comment where ag_id=$1 
order by agc_id;", array($this->ag_id)
                );
 
@@ -414,7 +416,7 @@
                /* TVA */
                $itva = new ITva_Popup($this->db);
                $itva->in_table = true;
-
+               $aCard=array();
                /* create aArticle for the detail section */
                for ($i = 0; $i < MAX_ARTICLE; $i++)
                {
@@ -428,6 +430,7 @@
                        $tmp_ad = (isset($this->aAction_detail[$i])) ? 
$this->aAction_detail[$i] : false;
                        $icard->readOnly=$readonly;
                        $icard->value = '';
+                       $aCard[$i]=0;
                        if ($tmp_ad)
                        {
                                $march = new Fiche($this->db);
@@ -436,6 +439,7 @@
                                {
                                        $march->id = $f;
                                        $icard->value = 
$march->get_quick_code();
+                                       $aCard[$i]=$f;
                                }
                        }
                        $icard->set_dblclick("fill_ipopcard(this);");
@@ -451,6 +455,7 @@
 
                        $text->javascript = ' onchange="clean_tva(' . $i . 
');compute_ledger(' . $i . ')"';
                        $text->name = "e_march" . $i . "_label";
+                       $text->id = "e_march" . $i . "_label";
                        $text->size = 40;
                        $text->value = ($tmp_ad) ? 
$tmp_ad->get_parameter('text') : "";
                        $text->readOnly=$readonly;
@@ -458,17 +463,20 @@
 
                        $num->javascript = ' 
onchange="format_number(this);clean_tva(' . $i . ');compute_ledger(' . $i . 
')"';
                        $num->name = "e_march" . $i . "_price";
+                       $num->id = "e_march" . $i . "_price";
                        $num->size = 8;
                        $num->readOnly=$readonly;
                        $num->value = ($tmp_ad) ? 
$tmp_ad->get_parameter('price_unit') : 0;
                        $aArticle[$i]['pu'] = $num->input();
 
                        $num->name = "e_quant" . $i;
+                       $num->id = "e_quant" . $i;
                        $num->size = 8;
                        $num->value = ($tmp_ad) ? 
$tmp_ad->get_parameter('quantity') : 0;
                        $aArticle[$i]['quant'] = $num->input();
 
                        $itva->name = 'e_march' . $i . '_tva_id';
+                       $itva->id = 'e_march' . $i . '_tva_id';
                        $itva->value = ($tmp_ad) ? 
$tmp_ad->get_parameter('tva_id') : 0;
                        $itva->readOnly=$readonly;
                        $itva->js = ' onchange="format_number(this);clean_tva(' 
. $i . ');compute_ledger(' . $i . ')"';
@@ -477,12 +485,14 @@
                        $aArticle[$i]['tvaid'] = $itva->input();
 
                        $num->name = "e_march" . $i . "_tva_amount";
+                       $num->id = "e_march" . $i . "_tva_amount";
                        $num->value = ($tmp_ad) ? 
$tmp_ad->get_parameter('tva_amount') : 0;
                        $num->javascript = " onchange=\"compute_ledger(' . $i . 
')\"";
                        $num->size = 8;
                        $aArticle[$i]['tva'] = $num->input();
 
                        $num->name = "tvac_march" . $i;
+                       $num->id = "tvac_march" . $i;
                        $num->value = ($tmp_ad) ? 
$tmp_ad->get_parameter('total') : 0;
                        $num->size = 8;
                        $aArticle[$i]['tvac'] = $num->input();
@@ -498,7 +508,7 @@
                /* add the number of item */
                $Hid = new IHidden();
                $r.=$Hid->input("nb_item", MAX_ARTICLE);
-               
$r.=HtmlInput::request_to_hidden(array("remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate"));
+               
$r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate"));
                /* get template */
                ob_start();
                require_once 'template/detail-action.php';
@@ -518,7 +528,7 @@
        }
 
        //----------------------------------------------------------------------
-       /* !\brief This function shows the detail of an action thanks the ag_id
+       /**\brief This function shows the detail of an action thanks the ag_id
         */
        function get()
        {
@@ -565,7 +575,7 @@
                $this->qcode_dest = $aexp->strAttribut(ATTR_DEF_QUICKCODE);
        }
 
-       /* !
+       /**
         * \brief Save the document and propose to save the generated document 
or
         *  to upload one, the data are included except the file. Temporary the 
generated
         * document is save
@@ -656,7 +666,7 @@
                $this->insert_action();
        }
 
-       /* ! myList($p_filter="")
+       /** myList($p_filter="")
         * \brief Show list of action by default if sorted on date
         * \param $p_base base url with ac...
         * \param $p_filter filters on the document_type
@@ -667,7 +677,7 @@
        function myList($p_base, $p_filter = "", $p_search = "")
        {
                // for the sort
-               $url = 
HtmlInput::get_to_string(array("remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate")) . '&' 
. $p_base;
+               $url = 
HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate")) . '&' 
. $p_base;
 
                $table = new Sort_Table();
                $table->add('Date', $url, 'order by ag_timestamp asc', 'order 
by ag_timestamp desc', 'da', 'dd');
@@ -741,7 +751,7 @@
                //show the sub_action
                foreach ($a_row as $row)
                {
-                       $href = '<A class="document" HREF="do.php?'  . $p_base 
.HtmlInput::get_to_string(array("remind_date_end","remind_date","sag_ref","only_internal","state","gDossier",
 "qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", 
"hsstate", "ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
+                       $href = '<A class="document" HREF="do.php?'  . $p_base 
.HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier",
 "qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", 
"hsstate", "ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
                        $i++;
                        $tr = ($i % 2 == 0) ? 'even' : 'odd';
                        if ($row['ag_priority'] < 2)
@@ -751,9 +761,9 @@
                                $st = ' style="font-weight:bold; border:2px 
solid orange;"';
                        $date_remind = format_date($row['my_remind'], 
'DD.MM.YYYY', 'YYYYMMDD');
                        $date_today = date('Ymd');
-                       if ($date_remind != "" && $date_remind == $date_today)
+                       if ($date_remind != "" && $date_remind == $date_today 
&& $row['ag_state']!=1 && $row['ag_state']!=3)
                                $st = ' 
style="font-weight:bold;background:orange"';
-                       if ($date_remind != "" && $date_remind < $date_today)
+                       if ($date_remind != "" && $date_remind < $date_today && 
$row['ag_state']!=1 && $row['ag_state']!=3)
                                $st = ' 
style="font-weight:bold;background:#FF0000"';
                        $r.="<tr class=\"$tr\" $st>";
                        $r.="<td>" . $href . smaller_date($row['my_date']) . 
'</a>' . "</td>";
@@ -817,7 +827,7 @@
        }
 
        //----------------------------------------------------------------------
-       /* !\brief Update the data into the database
+       /**\brief Update the data into the database
         *
         * \return true on success otherwise false
         */
@@ -847,7 +857,23 @@
                if ($contact->get_by_qcode($this->ag_contact) == -1)
                        $contact->id = 0;
 
+               // reload the old one
+               $old=new Follow_Up($this->db);
+               $old->ag_id=$this->ag_id;
+               $old->get();
 
+               // If ag_ref changed then check if unique
+               if ($old->ag_ref != $this->ag_ref)
+               {
+                       $nAg_ref=$this->db->get_value("select count(*) from 
action_gestion where ag_ref=$1",array($this->ag_ref));
+                       if ($nAg_ref != 0 )
+                       {
+                               echo h2("Référence en double, référence non 
sauvée",'class="error"');
+                               $this->ag_ref=$old->ag_ref;
+                       }
+               }
+
+
                if ($this->ag_remind_date != null)
                {
                        $this->db->exec_sql("update action_gestion set " .
@@ -930,7 +956,7 @@
                return true;
        }
 
-       /* !\brief generate the document and add it to the action
+       /**\brief generate the document and add it to the action
         * \param md_id is the id of the document_modele
         * \param $p_array contains normally the $_POST
         */
@@ -946,7 +972,7 @@
                $doc->Generate($p_array);
        }
 
-       /* !\brief put an array in the variable member, the indice
+       /**\brief put an array in the variable member, the indice
         * is the member name
         * \param $p_array to parse
         * \return nothing
@@ -976,7 +1002,7 @@
                $this->action = (isset($p_array['action'])) ? 
$p_array['action'] : null;
        }
 
-       /* !\brief remove the action
+       /**\brief remove the action
         *
         */
 
@@ -1000,7 +1026,7 @@
                }
        }
 
-       /* !\brief return the last p_limit operation into an array
+       /**\brief return the last p_limit operation into an array
         * \param $p_limit is the max of operation to return
         * \return $p_array of Follow_Up object
         */
@@ -1019,10 +1045,10 @@
          */
        function get_today()
        {
-               $sql = "select coalesce(vw_name,'Interne') as 
vw_name,ag_id,ag_title,ag_ref, dt_value,to_char(ag_timestamp,'DD.MM.YYYY') as 
ag_timestamp_fmt,ag_timestamp " .
+               $sql = "select ag_ref,coalesce(vw_name,'Interne') as 
vw_name,ag_id,ag_title,ag_ref, dt_value,to_char(ag_remind_date,'DD.MM.YYYY') as 
ag_timestamp_fmt,ag_timestamp " .
                                " from action_gestion join document_type " .
                                " on (ag_type=dt_id) left join vw_fiche_attr on 
(f_id=f_id_dest) where ag_state not in (1,4)
-                               and 
to_char(ag_remind_date,'DDMMYYYY')=to_char(now(),'DDMMYYYY') ";
+                                       and 
to_char(ag_remind_date,'DDMMYYYY')=to_char(now(),'DDMMYYYY') ";
                $array = $this->db->get_array($sql);
                return $array;
        }
@@ -1032,10 +1058,10 @@
          */
        function get_late()
        {
-               $sql = "select coalesce(vw_name,'Interne') as 
vw_name,ag_id,ag_title,ag_ref, dt_value,to_char(ag_timestamp,'DD.MM.YYYY') as 
ag_timestamp_fmt,ag_timestamp " .
+               $sql = "select ag_ref,coalesce(vw_name,'Interne') as 
vw_name,ag_id,ag_title,ag_ref, dt_value,to_char(ag_remind_date,'DD.MM.YYYY') as 
ag_timestamp_fmt,ag_timestamp " .
                                " from action_gestion join document_type " .
                                " on (ag_type=dt_id) left join vw_fiche_attr on 
(f_id=f_id_dest) where ag_state not in  (1,4)
-                               and ag_remind_date > trunc (now()) ";
+                               and ag_remind_date < now() ";
                $array = $this->db->get_array($sql);
                return $array;
        }
@@ -1141,6 +1167,11 @@
                $end = new IDate('date_end');
                $end->value = (isset($_GET['date_end'])) ? $_GET['date_end'] : 
"";
 
+               // Closed action
+               $closed_action=new ICheckBox('closed_action');
+               
$closed_action->selected=(isset($_GET['closed_action']))?true:false;
+
+               // Internal
                $only_internal= new ICheckBox('only_internal');
                $only_internal->selected = (isset($_GET['only_internal'])) ? 
true : false;
                // select profile
@@ -1173,7 +1204,7 @@
                Follow_Up::display_search($cn);
 
                $act = new Follow_Up($cn);
-               /* ! \brief
+               /** \brief
                 *  \note The field 'recherche' is   about a part of the title 
or a ref. number
                 */
                $query = Follow_Up::create_query($cn);
@@ -1199,7 +1230,7 @@
                $query = "";
 
 
-                if (isset($_REQUEST['query']))
+        if (isset($_REQUEST['query']))
                {
                        // if a query is request build the sql stmt
                        $query = "and (ag_title ~* '" . 
sql_string($_REQUEST['query']) . "' " .
@@ -1254,12 +1285,13 @@
                }
                if (isset($ag_dest_query) && $ag_dest_query != -2 )
                {
-                    $query.= " and ag_dest = " . sql_string($ag_dest_query);
+                    $query.= " and ((ag_dest = " . 
sql_string($ag_dest_query)." and ".self::sql_security_filter($cn, "R").") or ".
+                               " ag_owner='" . $_SESSION['g_user'] . "')";
                }
-                else
-                {
-                    $query .=" and (ag_owner='" . $_SESSION['g_user'] . "' or 
".self::sql_security_filter($cn, "R")." or ag_dest=-1 )";
-                }
+               else
+               {
+                       $query .=" and (ag_owner='" . $_SESSION['g_user'] . "' 
or ".self::sql_security_filter($cn, "R")." or ag_dest=-1 )";
+               }
 
 
                if (isNumber($ag_id) == 1 && $ag_id != 0)
@@ -1274,6 +1306,9 @@
                {
                        $query .= " and 
to_date('".sql_string($remind_date_end)."','DD.MM.YYYY')>= ag_remind_date";
                }
+               if ( ! isset ($closed_action)) {
+                       $query.=" and s_status is null ";
+               }
                return $query . $str;
        }
 
@@ -1292,6 +1327,7 @@
                                (select ad_value from fiche_Detail where 
f_id=action_gestion.f_id_dest and ad_id=1) as name
              from action_gestion
              join document_type on (ag_type=dt_id)
+                        join document_state on (s_id=ag_state)
              where $p_sql";
                $max_line = $cn->count_sql($sql);
 
@@ -1342,6 +1378,7 @@
                        coalesce((select p_name from profile where 
p_id=ag_dest),'Aucun groupe') as dest
              from action_gestion
              join document_type on (ag_type=dt_id)
+                        join document_state on(ag_state=s_id)
              where  true  $p_search order by ag_timestamp,ag_id";
                $ret=$this->db->exec_sql($sql);
 
@@ -1360,5 +1397,16 @@
                                )
                        );
        }
-
+       static function get_all_operation($p_jr_id)
+       {
+               global $cn;
+               $array=$cn->get_array("
+                       select ag_id,ag_ref,
+                               ag_title
+                               from action_gestion
+                               join action_gestion_operation using(ag_id)
+                               where
+                               jr_id=$1",array($p_jr_id));
+               return $array;
+       }
 }

Modified: phpcompta/trunk/include/class_html_input.php
===================================================================
--- phpcompta/trunk/include/class_html_input.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_html_input.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -70,7 +70,7 @@
     var $ctrl;                                         /*!<$ctrl is the 
control to update (see js_search_card_control) */
 
     var $tabindex;
-    function __construct($p_name="",$p_value="")
+    function __construct($p_name="",$p_value="",$p_id="")
     {
         $this->name=$p_name;
         $this->readOnly=false;
@@ -84,6 +84,7 @@
         $this->javascript="";
         $this->extra2="all";
         $this->attribute=array();
+        $this->id=$p_id;
 
     }
     function setReadOnly($p_read)
@@ -177,7 +178,7 @@
     static   function submit ($p_name,$p_value,$p_javascript="")
     {
 
-        return '<INPUT TYPE="SUBMIT" class="button" NAME="'.$p_name.'" 
VALUE="'.$p_value.'" '.$p_javascript.'>';
+        return '<INPUT TYPE="SUBMIT" class="button" NAME="'.$p_name.'" 
ID="'.$p_name.'_submit_id"  VALUE="'.$p_value.'" '.$p_javascript.'>';
     }
     static   function button ($p_name,$p_value,$p_javascript="")
     {
@@ -189,9 +190,10 @@
     {
         return '<INPUT TYPE="RESET" class="button" VALUE="'.$p_value.'">';
     }
-    static function hidden($p_name,$p_value)
+    static function hidden($p_name,$p_value,$p_id="")
     {
-        return '<INPUT TYPE="hidden" id="'.$p_name.'" NAME="'.$p_name.'" 
VALUE="'.$p_value.'">';
+               if ($p_id=="") $p_id=$p_name;
+        return '<INPUT TYPE="hidden" id="'.$p_id.'" NAME="'.$p_name.'" 
VALUE="'.$p_value.'">';
     }
 
     static function extension()
@@ -233,6 +235,18 @@
         return sprintf('<A class="detail" 
style="text-decoration:underline;display:inline" 
HREF="javascript:modifyOperation(%d,%d)">%s</A>',
                        $p_jr_id,dossier::id(),$p_mesg);
     }
+       /**
+        * @brief return an anchor to view the detail of an action
+        * @param $ag_id
+        * @param $p_mesg
+        * @param $p_modify let you modify an operation
+        *
+        */
+        static function detail_action($ag_id,$p_mesg,$p_modify=1)
+    {
+        return sprintf('<A class="detail" 
style="text-decoration:underline;display:inline" 
HREF="javascript:view_action(%d,%d,%d)">%s</A>',
+                       $ag_id,dossier::id(),$p_modify,$p_mesg);
+    }
     /**
      * return a string containing the html code for calling the 
modifyModeleDocument
      */
@@ -324,7 +338,7 @@
 
         echo '</div>';
         $ret=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $ret;
     }
     /**
@@ -365,7 +379,7 @@
 
         echo '</div>';
         $r=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
     static function display_periode($p_id)
@@ -575,7 +589,7 @@
       return $r;
     }
     /**
-     * return default if the value if the array doesn't exist
+     * return default if the value if the value doesn't exist in the array
      address@hidden $ind the index to check
      address@hidden $default the value to return
      address@hidden $array the array
@@ -588,6 +602,48 @@
        }
       return $array[$ind];
     }
+       /**
+        *  return default if the value if the value doesn't exist in $_GET
+        * @param  $ind name of the variable
+        * @param type $default
+        * @return type
+        */
+       static function default_value_get($ind, $default)
+       {
+               if (!isset($_GET[$ind]))
+               {
+                       return $default;
+               }
+               return $_GET[$ind];
+       }
+       /**
+        *  return default if the value if the value doesn't exist in $_POST
+        * @param  $ind name of the variable
+        * @param type $default
+        * @return type
+        */
+       static function default_value_post($ind, $default)
+       {
+               if (!isset($_POST[$ind]))
+               {
+                       return $default;
+               }
+               return $_POST[$ind];
+       }
+       /**
+        *  return default if the value if the value doesn't exist in $_REQUEST
+        * @param  $ind name of the variable
+        * @param type $default
+        * @return type
+        */
+       static function default_value_request($ind, $default)
+       {
+               if (!isset($_REQUEST[$ind]))
+               {
+                       return $default;
+               }
+               return $_REQUEST[$ind];
+       }
        static function title_box($name,$div,$mod="close")
        {
                if ($mod=='close')              
$r=HtmlInput::anchor_close($div);

Modified: phpcompta/trunk/include/class_iaction.php
===================================================================
--- phpcompta/trunk/include/class_iaction.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_iaction.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -33,17 +33,18 @@
     {
         $this->name=($p_name=="")?$this->name:$p_name;
         $this->value=($p_value=="")?$this->value:$p_value;
+        $this->id=($this->id=="")?$this->name:$this->id;
         if ( $this->readOnly==true) return $this->display();
         $this->javascript= (!isset ($this->javascript))?"":$this->javascript;
         if ( $this->value !="")
             $r=sprintf('<span id="%s" class="action"> <A class="action" 
HREF="%s" %s>%s</A></span>',
-                       $this->name,
+                       $this->id,
                        $this->value,
                        $this->javascript,
                        $this->label);
         else
             $r=sprintf('<span id="%s" class="action"> <A class="action" 
href="javascript: %s">%s</A></span>',
-                       $this->name,
+                       $this->id,
                        $this->javascript,
                        $this->label);
 

Modified: phpcompta/trunk/include/class_ianccard.php
===================================================================
--- phpcompta/trunk/include/class_ianccard.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_ianccard.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -26,16 +26,16 @@
  */
 
 /*!
- * \brief 
+ * \brief
 */
 require_once('class_html_input.php');
 require_once('function_javascript.php');
 
 class IAncCard extends HtmlInput
 {
-    function __construct($name="",$value="")
+    function __construct($name="",$value="",$p_id="")
     {
-        parent::__construct($name,$value);
+        parent::__construct($name,$value,$p_id);
         $this->fct='update_value';
         $this->dblclick='';
         $this->callback='null';
@@ -63,7 +63,7 @@
     {
         $this->fct=$p_name;
     }
-   
+
     /*!\brief set the extra javascript property for a double click on
      *  INPUT field
      *\param $p_action action when a double click happens
@@ -82,9 +82,10 @@
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
 
+        $this->id=($this->id=="")?$this->name:$this->id;
 
-       
 
+
         $label='';
         if ( $this->dblclick != '')
         {
@@ -106,7 +107,7 @@
         $div=sprintf('<div id="%s_choices"  class="autocomplete"></div>',
                      $this->name);
         $query="op=autoanc&".dossier::get();
-        
+
         // add parameter to search into a plan (pa_id) or get the value from
         // a HtmlObject
         if ($this->plan <> 0)
@@ -138,7 +139,7 @@
     /*!\brief print in html the readonly value of the widget*/
     public function display()
     {
-        $r=sprintf('         
+        $r=sprintf('
                     <INPUT TYPE="hidden" NAME="%s" VALUE="%s" SIZE="8">',
                    $this->name,
                    $this->value
@@ -195,6 +196,6 @@
 
     static public function test_me()
     {
-      
+
     }
 }

Modified: phpcompta/trunk/include/class_ibutton.php
===================================================================
--- phpcompta/trunk/include/class_ibutton.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_ibutton.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,7 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 /*!\file
- * \brief Html Input 
+ * \brief Html Input
  */
 require_once('class_html_input.php');
 class IButton extends HtmlInput
@@ -32,12 +32,13 @@
     {
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
+               $this->label=(trim($this->label) != 
'')?$this->label:$this->value;
         if ( $this->readOnly==true) return $this->display();
         $extra= ( isset($this->extra))?$this->extra:"";
-
+        $this->id=($this->id=="")?$this->name:$this->id;
         $r='<input type="BUTTON" name="'.$this->name.'"'.
            ' class="button" '.
-           ' id="'.$this->name.'"'.
+           ' id="'.$this->id.'"'.
            ' value="'.$this->label.'"'.
            ' onClick="'.$this->javascript.'"'.$extra.'>';
         $attr=$this->get_js_attr();

Modified: phpcompta/trunk/include/class_icard.php
===================================================================
--- phpcompta/trunk/include/class_icard.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_icard.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -120,7 +120,7 @@
 
 class ICard extends HtmlInput
 {
-    function __construct($name="",$value="")
+    function __construct($name="",$value="",$p_id="")
     {
         parent::__construct($name,$value);
         $this->fct='update_value';
@@ -128,6 +128,7 @@
         $this->callback='null';
         $this->javascript='';
                $this->autocomplete=1;
+               $this->id=($p_id != "")?$p_id:$name;
     }
     /*!\brief set the javascript callback function
      * by default it is update_value called BEFORE the querystring is send
@@ -191,7 +192,7 @@
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
 
-               if ( ! isset($this->id )) $this->id=$this->name;
+                $this->id=($this->id=="")?$this->name:$this->id;
 
         $attr=$this->get_js_attr();
 
@@ -293,8 +294,10 @@
             if (isset($this->$att) )
                 $a.="this.".$att."='".$this->$att."';";
         }
-        if (isset($this->id))
+        if (isset($this->id) && $this->id != "")
             $a.="this.inp='".$this->id."';";
+               else
+            $a.="this.inp='".$this->name."';";
         $a.="this.popup='ipop_card';";
 
         $button->javascript=$a.' search_card(this)';

Modified: phpcompta/trunk/include/class_icheckbox.php
===================================================================
--- phpcompta/trunk/include/class_icheckbox.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_icheckbox.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,7 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 /*!\file
- * \brief Html Input 
+ * \brief Html Input
  */
 require_once('class_html_input.php');
 class ICheckBox extends HtmlInput
@@ -32,9 +32,10 @@
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
+                $this->id=($this->id=="")?$this->name:$this->id;
 
         $check=( $this->selected==true )?"checked":"unchecked";
-        $r='<input type="CHECKBOX" id="'.$this->name.'" 
name="'.$this->name.'"'.' value="'.$this->value.'"';
+        $r='<input type="CHECKBOX" id="'.$this->id.'" 
name="'.$this->name.'"'.' value="'.$this->value.'"';
         $r.="  $check";
         $r.=' '.$this->disabled."  ".$this->javascript.'>';
 

Modified: phpcompta/trunk/include/class_iconcerned.php
===================================================================
--- phpcompta/trunk/include/class_iconcerned.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_iconcerned.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -30,12 +30,13 @@
 class IConcerned extends HtmlInput
 {
 
-       public function __construct($p_name='',$p_value='')
+       public function __construct($p_name='',$p_value='',$p_id="")
        {
                $this->name=$p_name;
                $this->value=$p_value;
                $this->amount_id=null;
                $this->paid='';
+               $this->id=$p_id;
        }
     /*!\brief show the html  input of the widget*/
     public function input($p_name=null,$p_value=null)
@@ -44,6 +45,7 @@
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
 
+           $this->id=($this->id=="")?$this->name:$this->id;
 
 
         $r=sprintf("
@@ -56,9 +58,9 @@
                    $this->amount_id,
                    $this->paid,
                    $this->name,
-                   $this->name,
+                   $this->id,
                    $this->value,
-                   $this->name
+                   $this->id
                   );
         return $r;
     }

Modified: phpcompta/trunk/include/class_idate.php
===================================================================
--- phpcompta/trunk/include/class_idate.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_idate.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -32,7 +32,7 @@
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
-       if( ! isset ($this->id))
+       if( $this->id=="")
          $this->id=self::generate_id($this->name);
         $r='<input type="text" name="'.$this->name.'" id="'.$this->id.'"'.
            'style="border:solid 1px blue;"'.

Modified: phpcompta/trunk/include/class_ihidden.php
===================================================================
--- phpcompta/trunk/include/class_ihidden.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_ihidden.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,7 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 /*!\file
- * \brief Html Input 
+ * \brief Html Input
  */
 require_once('class_html_input.php');
 class IHidden extends HtmlInput
@@ -31,7 +31,9 @@
     {
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
-        $r='<INPUT TYPE="HIDDEN" id="'.$this->name.'" name="'.$this->name.'" 
value="'.$this->value.'">';
+               $this->id=($this->id=="")?$this->name:$this->id;
+
+        $r='<INPUT TYPE="HIDDEN" id="'.$this->id.'" name="'.$this->name.'" 
value="'.$this->value.'">';
         return $r;
 
     }

Modified: phpcompta/trunk/include/class_impress.php
===================================================================
--- phpcompta/trunk/include/class_impress.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_impress.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,6 @@
 // $Revision$
 /*!\file
  * \brief contains function for the printing
- * \todo the functions of class_impress.php should be replaced in a OO way
 */
 require_once('class_periode.php');
 
@@ -208,8 +207,9 @@
         $p_string=str_replace("<=","+",$p_string);
         $p_string=str_replace(">","+",$p_string);
         $p_string=str_replace("<","+",$p_string);
-        // eat Space
+        // eat Space + comma
         $p_string=str_replace(" ","",$p_string);
+        $p_string=str_replace(",","",$p_string);
         // Remove D/C/S
         $p_string=str_replace("c","",$p_string);
         $p_string=str_replace("d","",$p_string);
@@ -219,11 +219,18 @@
 
                // remove date
                $p_string=  preg_replace("/FROM*=*[0-9]+/", "", $p_string);
+               // remove comment
+               $p_string=  preg_replace("/#.*/", "", $p_string);
+               // remove $C=
+               $p_string=  preg_replace('/\$[a-z]*[A-Z]*[0-9]*[A-Z]*[a-z]*/', 
"", $p_string);
+               $p_string=  preg_replace('/=/', "", $p_string);
 
                // remove account
                $p_string=  preg_replace("/\[[0-9]*[A-Z]*%*\]/", "", $p_string);
 
-               $p_string=  preg_replace("/\+|-|\/\*/", "", $p_string);
+               $p_string=  preg_replace("/\+|-|\/|\*/", "", $p_string);
+               $p_string=  preg_replace("/[0-9]*\.*[0-9]/", "", $p_string);
+
                
//********************************************************************************************************************
                // If the string is empty then formula should be good
                //

Modified: phpcompta/trunk/include/class_inum.php
===================================================================
--- phpcompta/trunk/include/class_inum.php      2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_inum.php      2013-05-03 22:31:33 UTC (rev 
5216)
@@ -27,7 +27,15 @@
 /*!\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)
+ * to change comma to period  and will round it (2 decimal), the precision is 
given by
+ * the attribute prec
+ * attribute
+ *  extra = extra code (free)
+ *  size = size of the field
+ *  prec = precision default = 2
+ *  name = name of the html object
+ *  javascript = javascript to execute (default = 
onchange="format_number(this,2);)
+ *  value = value of the widget
  *
  */
 class INum extends IText
@@ -45,10 +53,12 @@
     {
 
         $readonly=" readonly ";
+               $this->id=($this->id=="")?$this->name:$this->id;
+
         $style='style="border:solid 1px 
blue;color:black;background:#EDEDED;text-align:right"';
         $this->value=str_replace('"','',$this->value);
         $r='<INPUT '.$style.' TYPE="TEXT" id="'.
-           $this->name.'"'.
+           $this->id.'"'.
            'NAME="'.$this->name.'" VALUE="'.$this->value.'"  '.
            'SIZE="'.$this->size.'" '.$this->javascript." $readonly 
$this->extra >";
 
@@ -66,6 +76,8 @@
                }
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
+               $this->id=($this->id=="")?$this->name:$this->id;
+
         if ( $this->readOnly==true) return $this->display();
 
         $t= ((isset($this->title)))?'title="'.$this->title.'"   ':' ';
@@ -76,13 +88,13 @@
         if ( ! isset ($this->css_size))
         {
         $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
-           $this->name.'"'.$t.
+           $this->id.'"'.$t.
            'NAME="'.$this->name.'" VALUE="'.$this->value.'"  '.
            'SIZE="'.$this->size.'" '.$this->javascript."  $this->extra >";
         /* add tag for column if inside a table */
         } else {
            $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
-           $this->name.'"'.$t.
+           $this->id.'"'.$t.
            'NAME="'.$this->name.'" VALUE="'.$this->value.'"  '.
            ' style="width:'.$this->css_size.';" '.$this->javascript."  
$this->extra >";
 

Modified: phpcompta/trunk/include/class_iperiod.php
===================================================================
--- phpcompta/trunk/include/class_iperiod.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_iperiod.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,11 +21,11 @@
 // Copyright Author Dany De Bontridder address@hidden
 
 /*!\file
- * \brief Html Input 
+ * \brief Html Input
  */
 /*! \brief          Generate the form for the periode
 * Data Members
- *   - $cn connexion to the current folder 
+ *   - $cn connexion to the current folder
  *   - $type the type of the periode OPEN CLOSE NOTCENTRALIZED or ALL, IT MUST 
BE SET
  *   - $filter_year make a filter on the default exercice by default true
  *   - $user if a filter_year is required then we need who is the user (object 
User)
@@ -56,7 +56,7 @@
         $this->extra2="all";
         $this->show_start_date=true;
         $this->show_end_date=true;
-       $this->exercice=$p_exercice;
+               $this->exercice=$p_exercice;
     }
     /*!
      * \brief show the input html for a periode
@@ -64,8 +64,8 @@
      *\param $p_value is the default value
      *\param $p_exercice is the exercice, if not set then the user preference 
is used
      * \return string containing html code for the HTML
-     *       
      *
+     *
      */
     public function input($p_name=null,$p_value=null)
     {

Modified: phpcompta/trunk/include/class_iposte.php
===================================================================
--- phpcompta/trunk/include/class_iposte.php    2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_iposte.php    2013-05-03 22:31:33 UTC (rev 
5216)
@@ -80,7 +80,7 @@
 class IPoste extends HtmlInput
 {
 
-    function __construct($p_name="",$p_value="")
+    function __construct($p_name="",$p_value="",$p_id="")
     {
         $this->name=$p_name;
         $this->readOnly=false;
@@ -92,6 +92,7 @@
         $this->javascript="";
         $this->extra2="all";
         $this->attribute=array();
+               $this->id=$p_id;
 
     }
 
@@ -116,7 +117,7 @@
         {
             list($name,$value)=$this->attribute[$i];
             $tmp1=sprintf("$('%s_bt').%s='%s';",
-                          $this->name,
+                          $this->id,
                           $name,
                           $value);
             $attr.=$tmp1;
@@ -127,7 +128,8 @@
 
     public function dsp_button()
     {
-        $ib=new IButton($this->name.'_bt');
+               $this->id=($this->id=="")?$this->name:$this->id;
+        $ib=new IButton($this->id.'_bt');
         $ib->javascript='search_poste(this)';
 
         /*  add the property */
@@ -144,9 +146,10 @@
         if ( ! isset($this->ctrl) ) $this->ctrl='none';
 
         if ( ! isset($this->javascript)) $this->javascript="";
+               $this->id=($this->id=="")?$this->name:$this->id;
 
         /* create the text  */
-        $itext=new IText($this->name,$this->value);
+        $itext=new IText($this->name,$this->value,$this->id);
 
        if ( isset ($this->css_size))
             $itext->css_size=$this->css_size;

Modified: phpcompta/trunk/include/class_iradio.php
===================================================================
--- phpcompta/trunk/include/class_iradio.php    2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_iradio.php    2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,14 +21,14 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief Html Input 
  */
 require_once('class_html_input.php');
 
 class IRadio extends HtmlInput
     {
-    /* !\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)
         {
@@ -45,7 +45,7 @@
         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()
         {

Modified: phpcompta/trunk/include/class_irelated_action.php
===================================================================
--- phpcompta/trunk/include/class_irelated_action.php   2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_irelated_action.php   2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -33,6 +33,7 @@
                $this->value=$p_value;
                $this->amount_id=null;
                $this->paid='';
+               $this->id=$p_name;
        }
     /*!\brief show the html  input of the widget*/
     public function input($p_name=null,$p_value=null)
@@ -41,6 +42,7 @@
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
 
+               $this->id=($this->id=="")?$this->name:$this->id;
 
 
         $r=sprintf("
@@ -49,11 +51,11 @@
                                   <INPUT TYPE=\"button\" 
onClick=\"$('%s').value=''\" value=\"X\">
 
                    ",
+                   $this->id,
                    $this->name,
-                   $this->name,
-                   $this->name,
+                   $this->id,
                    $this->value,
-                   $this->name
+                   $this->id
                   );
         return $r;
     }

Modified: phpcompta/trunk/include/class_iselect.php
===================================================================
--- phpcompta/trunk/include/class_iselect.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_iselect.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -33,12 +33,13 @@
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
         $style=(isset($this->style))?$this->style:"";
+               $this->id=($this->id=="")?$this->name:$this->id;
 
         $disabled=($this->disabled==true)?"disabled":"";
 
         $r="";
 
-        $a="<SELECT  id=\"$this->name\" NAME=\"$this->name\" $style 
$this->javascript $disabled>";
+        $a="<SELECT  id=\"$this->id\" NAME=\"$this->name\" $style 
$this->javascript $disabled>";
 
         if (empty($this->value)) return '';
         for ( $i=0;$i<sizeof($this->value);$i++)

Modified: phpcompta/trunk/include/class_itext.php
===================================================================
--- phpcompta/trunk/include/class_itext.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_itext.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -26,9 +26,9 @@
 require_once('class_html_input.php');
 class IText extends HtmlInput
 {
-    function __construct($name='',$value='')
+    function __construct($name='',$value='',$p_id="")
     {
-        parent::__construct($name,$value);
+        parent::__construct($name,$value,$p_id);
         $this->style=' class="input_text" ';
     }
     /*!\brief show the html  input of the widget*/
@@ -37,6 +37,7 @@
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
         if ( $this->readOnly==true) return $this->display();
+               $this->id=($this->id=="")?$this->name:$this->id;
 
         $t= ((isset($this->title)))?'title="'.$this->title.'"   ':' ';
 
@@ -46,13 +47,13 @@
         if ( ! isset ($this->css_size))
         {
         $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
-           $this->name.'"'.$t.
+           $this->id.'"'.$t.
            'NAME="'.$this->name.'" VALUE="'.$this->value.'"  '.
            'SIZE="'.$this->size.'" '.$this->javascript."  $this->extra >";
         /* add tag for column if inside a table */
         } else {
            $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
-           $this->name.'"'.$t.
+           $this->id.'"'.$t.
            'NAME="'.$this->name.'" VALUE="'.$this->value.'"  '.
            ' style="width:'.$this->css_size.';" '.$this->javascript."  
$this->extra >";
 
@@ -76,12 +77,12 @@
          if ( ! isset ($this->css_size))
         {
         $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
-           $this->name.'"'.$t.
+           $this->id.'"'.$t.
            'NAME="'.$this->name.'" VALUE="'.$this->value.'"  '.
            'SIZE="'.$this->size.'" '.$this->javascript." $readonly 
$this->extra >";
         } else {
                $r='<INPUT '.$this->style.' TYPE="TEXT" id="'.
-           $this->name.'"'.$t.
+           $this->id.'"'.$t.
            'NAME="'.$this->name.'" VALUE="'.$this->value.'"  '.
            ' style="width:'.$this->css_size.'" '.$this->javascript." $readonly 
 $this->extra >";
         }

Modified: phpcompta/trunk/include/class_itextarea.php
===================================================================
--- phpcompta/trunk/include/class_itextarea.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_itextarea.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -32,10 +32,12 @@
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
                if ( !isset ($this->style )) $this->style=' style="border:solid 
blue 1px" ';
+               $this->id=($this->id=="")?$this->name:$this->id;
+
         if ( $this->readOnly==true) return $this->display();
 
         $r="";
-        $r.='<TEXTAREA '.$this->style.'  name="'.$this->name.'" 
id="'.$this->name.'"';
+        $r.='<TEXTAREA '.$this->style.'  name="'.$this->name.'" 
id="'.$this->id.'"';
         $r.=" rows=\"$this->heigh\" ";
         $r.=" cols=\"$this->width\" ";
         $r.='>';

Modified: phpcompta/trunk/include/class_itva_popup.php
===================================================================
--- phpcompta/trunk/include/class_itva_popup.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_itva_popup.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -55,11 +55,13 @@
      * to have its own javascript for the button you can use 
this->but_javascript)
      * by default it is 'popup_select_tva(this)';
      */
-    public function __construct($p_name=null)
+    public function __construct($p_name=null,$p_value="",$p_id="")
     {
         $this->name=$p_name;
         $this->button=true;
         $this->in_table=false;
+               $this->value=$p_value;
+               $this->id=$p_id;
     }
     function with_button($p)
     {
@@ -74,10 +76,12 @@
         $this->name=($p_name==null)?$this->name:$p_name;
         $this->value=($p_value==null)?$this->value:$p_value;
         
$this->js=(isset($this->js))?$this->js:'onchange="format_number(this);"';
+               $this->id=($this->id=="")?$this->name:$this->id;
+
         if ( $this->readOnly==true) return $this->display();
 
         $str='<input type="TEXT" class="input_text" name="%s" value="%s" 
id="%s" size="3" %s>';
-        $r=sprintf($str,$this->name,$this->value,$this->name,$this->js);
+        $r=sprintf($str,$this->name,$this->value,$this->id,$this->js);
 
         if ($this->in_table)
             $table='<table>'.'<tr>'.td($r);
@@ -120,11 +124,13 @@
     function dbutton()
     {
         if( trim($this->name)=='') throw new Exception (_('Le nom ne peut être 
vide'));
+               $this->id=($this->id=="")?$this->name:$this->id;
+
         // button
-        $bt=new IButton('bt_'.$this->name);
+        $bt=new IButton('bt_'.$this->id);
         $bt->label=_(' TVA ');
         $bt->set_attribute('gDossier',dossier::id());
-        $bt->set_attribute('ctl',$this->name);
+        $bt->set_attribute('ctl',$this->id);
         $bt->set_attribute('popup','popup_tva');
         if ( isset($this->code))
             $bt->set_attribute('jcode',$this->code->name);

Modified: phpcompta/trunk/include/class_lettering.php
===================================================================
--- phpcompta/trunk/include/class_lettering.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_lettering.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -261,7 +261,7 @@
         ob_start();
         include('template/letter_all.php');
         $r=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
        function get_linked($p_jlid)
@@ -289,7 +289,7 @@
         ob_start();
         include('template/letter_all.php');
         $r=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
        /**
@@ -303,7 +303,7 @@
         ob_start();
         include('template/letter_all.php');
         $r=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
 
@@ -319,7 +319,7 @@
         ob_start();
         include('template/letter_all.php');
         $r=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         return $r;
     }
     /**
@@ -369,7 +369,7 @@
         ob_start();
         require_once('template/letter_prop.php');
         $r=ob_get_contents();
-        ob_clean();
+        ob_end_clean();
         $r.=HtmlInput::hidden('j_id',$p_jid);
         $r.=HtmlInput::hidden('jnt_id',$jnt_id);
 

Modified: phpcompta/trunk/include/class_periode.php
===================================================================
--- phpcompta/trunk/include/class_periode.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_periode.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -352,7 +352,7 @@
                 isDate($p_date_end) == null ||
                 strlen (trim($p_exercice)) == 0 ||
                 (string) $p_exercice != (string)(int) $p_exercice
-         ||$p_exercice < 2000 || $p_exercice > 2099 )
+         ||$p_exercice < COMPTA_MIN_YEAR || $p_exercice > COMPTA_MAX_YEAR)
 
         {
          throw new Exception ("Paramètre invalide");

Modified: phpcompta/trunk/include/class_phpcompta_sql.php
===================================================================
--- phpcompta/trunk/include/class_phpcompta_sql.php     2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_phpcompta_sql.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -239,13 +239,16 @@
                        {
                                $this->$value=$p_array[$value];
                        }
+                       else
+                       {
+                               $this->$value=null;
+                       }
                }
                return $this;
        }
         function seek($cond='', $p_array=null)
        {
                $sql = "select * from ".$this->table."  $cond";
-               $aobj = array();
                $ret = $this->cn->exec_sql($sql, $p_array);
                return $ret;
        }

Modified: phpcompta/trunk/include/class_print_ledger_fin.php
===================================================================
--- phpcompta/trunk/include/class_print_ledger_fin.php  2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_print_ledger_fin.php  2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -22,7 +22,6 @@
 
 /*!\file
  * \brief print a listing of financial
- *\todo Must add the third part
  */
 require_once('class_pdf.php');
 class Print_Ledger_Financial extends PDF
@@ -65,11 +64,7 @@
 
     }
     /**
-     address@hidden print the pdf
-     address@hidden
-     address@hidden
-     address@hidden
-     address@hidden
+     address@hidden print the pdf for a financial ledger
      */
     function export()
     {

Modified: phpcompta/trunk/include/class_print_ledger_simple.php
===================================================================
--- phpcompta/trunk/include/class_print_ledger_simple.php       2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/class_print_ledger_simple.php       2013-05-03 
22:31:33 UTC (rev 5216)
@@ -23,7 +23,6 @@
 /*!\file
  * \brief this class extends PDF and let you export the detailled printing
  *  of any ledgers
- *\todo Must add the third part
  */
 require_once('class_pdf.php');
 

Modified: phpcompta/trunk/include/class_print_ledger_simple_without_vat.php
===================================================================
--- phpcompta/trunk/include/class_print_ledger_simple_without_vat.php   
2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/class_print_ledger_simple_without_vat.php   
2013-05-03 22:31:33 UTC (rev 5216)
@@ -23,7 +23,6 @@
 /*!\file
  * \brief this class extends PDF and let you export the detailled printing
  *  of any ledgers
- * *\todo Must add the third part
  */
 require_once('class_pdf.php');
 
@@ -78,11 +77,11 @@
         else
             $this->Cell(60,6,'Fournisseur');
         $this->Cell(105,6,'Commentaire');
-        $this->Cell(15,6,'Prix',0,0,'R');
         if ( $this->jrn_type=='ACH')
         {
             $this->Cell(15,6,'Privé',0,0,'R');
         }
+        $this->Cell(15,6,'Prix',0,0,'R');
 
         $this->Ln(5);
 

Modified: phpcompta/trunk/include/class_profile_menu.php
===================================================================
--- phpcompta/trunk/include/class_profile_menu.php      2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/class_profile_menu.php      2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -17,7 +17,11 @@
        {
                $this->cn = $p_cn;
        }
-
+       /**
+        * Display the content of a profile
+        * @param type $resource
+        * @param type $p_id
+        */
        function sub_menu($resource, $p_id)
        {
                if (Database::num_row($resource) != 0)
@@ -35,13 +39,15 @@
 
                                $me_menu = $menu['me_menu'];
                                $me_desc = $menu['me_description'];
+                               $me_def=($menu['pm_default']=='1')?'<span 
class="notice" style="display:inline">Défaut</span>':'';
                                $js = sprintf(
                                                '<a class="line" 
href="javascript:void(0)" onclick="mod_menu(\'%s\',\'%s\')">%s</A>', $gDossier, 
$menu['pm_id'], $me_code);
                                ?>
                                <li>
+
                                        <?= $me_menu?>
                                        ( <?= $js?> )
-                                       <?= $me_desc?>
+                                       <?= $me_desc?>  <?=$me_def?>
                                        <?
                                        $ret2 = $this->cn->exec_sql("
                                                                        SELECT 
pm_id,
@@ -145,9 +151,10 @@
                                $gDossier = Dossier::id();
                                for ($i = 0; $i < count($array); $i++)
                                {
+                                       
$me_def=($array[$i]['pm_default']=='1')?'<span class="notice" 
style="display:inline">Défaut</span>':'';
                                        $js = sprintf('<a class="line" 
style="display:inline;text-decoration:underline"
                                                href="javascript:void(0)" 
onclick="mod_menu(\'%s\',\'%s\')">%s</A>', $gDossier, $array[$i]['pm_id'], 
$array[$i]['me_code']);
-                                       echo "<li>" . $array[$i]['me_menu'] . " 
(" . $js . ")" . $array[$i]['me_description'];
+                                       echo "<li>" . $array[$i]['me_menu'] . " 
(" . $js . ")" . $array[$i]['me_description']." ".$me_def;
 
                                        $ret = $this->cn->execute("menu", 
array($p_id, $array[$i]['me_code']));
                                        $this->sub_menu($ret, $p_id);

Modified: phpcompta/trunk/include/class_tool_uos.php
===================================================================
--- phpcompta/trunk/include/class_tool_uos.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_tool_uos.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -19,13 +19,19 @@
 /* $Revision: $Revision $ */
 /**
  * @file
- * Objec to check a double insert into the database, this duplicate occurs 
after
+ * @brief Objec to check a double insert into the database, this duplicate 
occurs after
  * a refresh of the web page
  */
 // Copyright Author Dany De Bontridder address@hidden
 
 require_once 'class_database.php';
 define ('CODE_EXCP_DUPLICATE',901);
+/**
+ * @brief Objec to check a double insert into the database, this duplicate 
occurs after
+ * a refresh of the web page
+ * in
+ */
+
 class Tool_Uos
 {
     /**
@@ -54,15 +60,17 @@
      * @global $cn Database connx
      * @throws Exception if the value $p_id is not unique
      */
-    function save()
+    function save($p_array=null)
     {
         global $cn;
+               if ( $p_array == null ) $p_array=$_POST;
+               $this->id=$_POST[$this->name];
         $sql="insert into tool_uos(uos_value) values ($1)";
         try {
             $cn->exec_sql($sql,array($this->id));
         } catch (Exception $e)
         {
-            throw new Exception('Duplicate value','CODE_EXCP_DUPLICATE',$e);
+            throw new Exception('Duplicate value');
         }
     }
     /**
@@ -89,7 +97,7 @@
         try
         {
             $count=$cn->get_value('select count(*) from tool_uos where 
uos_value=$1',
-                    array($p_id));
+                    array($this->id));
             if ($count != 0 ) throw new Exception 
('DUPLICATE',CODE_EXCP_DUPLICATE);
         }catch (Exception $e)
         {

Modified: phpcompta/trunk/include/class_user.php
===================================================================
--- phpcompta/trunk/include/class_user.php      2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/class_user.php      2013-05-03 22:31:33 UTC (rev 
5216)
@@ -19,11 +19,11 @@
  */
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
-/* ! \file
+/** \file
  * \brief
  *   Data & function about connected users
  */
-/* !
+/**
  * \brief
  *   Data & function about connected users
  */
@@ -79,7 +79,7 @@
                }
        }
 
-       /* !\brief load data from database.
+       /**\brief load data from database.
         * if this->id == -1, it is unknown so we have to retrieve it
          from the database by the login
         * return -1 if nothing is found
@@ -130,7 +130,7 @@
                $Res = $cn->exec_sql($Sql, array($this->first_name, 
$this->last_name, $this->active, $this->admin, $this->pass, $this->id));
        }
 
-       /* !
+       /**
         * \brief Check if user is active and exists in therepository
         * Automatically redirect, it doesn't check if a user can access a 
folder
         * \param $silent false, echo an error message and exit, true : exit 
without warning
@@ -190,7 +190,7 @@
                return $ret;
        }
 
-       /* !\brief return  the access to a folder,
+       /**\brief return  the access to a folder,
         * \param $p_dossier id if it is == 0 then we take the value from 
$_SESSION
         * \return the priv_priv
         *          - X no access
@@ -204,7 +204,7 @@
 
                if ($p_dossier == 0)
                        $p_dossier = dossier::id();
-               if ($this->is_local_admin($p_dossier) == 1)
+               if ($this->is_local_admin($p_dossier) == 1 || $this->admin == 1)
                        return 'L';
                $cn = new Database();
 
@@ -238,7 +238,7 @@
                $Res = $cn->exec_sql("update priv_user set priv_priv=$1 where 
priv_jnt=$2", array($priv, $jnt));
        }
 
-       /* !\brief check that a user is valid and the access to the folder
+       /**\brief check that a user is valid and the access to the folder
         * \param $p_ledger the ledger to check
         * \return the priv_priv
         * - O only predefined operation
@@ -264,7 +264,7 @@
                return $res;
        }
 
-       /* !
+       /**
         * \brief get all the available ledgers for the current user
         * \param $p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS)
         * \param $p_access =3 for Read or WRITE, 2  write, 1 for readonly
@@ -326,7 +326,7 @@
                return $array;
        }
 
-       /* !\brief return an sql condition for filtering the permitted ledger
+       /**\brief return an sql condition for filtering the permitted ledger
         * \param $p_type = ALL or the type of the ledger (ACH,VEN,FIN,ODS)
         * \param $p_access =3 for READ or WRITE, 2 READ and write, 1 for 
readonly
         *
@@ -347,7 +347,7 @@
                return $sql;
        }
 
-       /* !
+       /**
         * \brief  Check if an user is an admin
         *
         * \return 1 for yes 0 for no
@@ -373,7 +373,7 @@
                return $this->admin;
        }
 
-       /* !
+       /**
         * \brief  Set the selected periode in the user's preferences
         *
         * \param $p_periode periode
@@ -415,7 +415,7 @@
                $Res = $this->db->exec_sql($sql);
        }
 
-       /* !
+       /**
         * \brief  Get the default periode from the user's preferences
         *
         * \return the default periode
@@ -435,7 +435,7 @@
                return $array['PERIODE'];
        }
 
-       /* !\brief return the mini rapport to display on the welcome page
+       /**\brief return the mini rapport to display on the welcome page
         * \return 0 if nothing if found or the report to display 
(formdef.fr_id)
         */
 
@@ -446,7 +446,7 @@
                return $fr_id;
        }
 
-       /* !\brief set the mini rapport to display on the welcome page
+       /**\brief set the mini rapport to display on the welcome page
         */
 
        function set_mini_report($p_id)
@@ -485,7 +485,7 @@
                }
        }
 
-       /* !
+       /**
         * \brief  Get the default user's preferences
         * \return array of (parameter_type => parameter_value)
         */
@@ -524,7 +524,7 @@
                return 1;
        }
 
-       /* !
+       /**
         * \brief  Check if an user is allowed to do an action
         * \param p_action_id
         * \return
@@ -561,7 +561,7 @@
                exit();
        }
 
-       /* !
+       /**
         * \brief  Get the global preferences from user_global_pref
         *        in the account_repository db
         *
@@ -605,7 +605,7 @@
                }
        }
 
-       /* !
+       /**
         * \brief  insert default pref
         *        if no parameter are given insert all the existing
         *        parameter otherwise only the requested
@@ -640,7 +640,7 @@
                }
        }
 
-       /* !
+       /**
         * \brief  update default pref
         *           if value is not given then use the default value
         *
@@ -663,7 +663,7 @@
        }
 
 //end function
-       /* !\brief Return the year of current Periode
+       /**\brief Return the year of current Periode
         *        it is the parm_periode.p_exercice col
         *        if an error occurs return 0
         */
@@ -681,7 +681,7 @@
                        return 0;
        }
 
-       /* !\brief Check if the user can access
+       /**\brief Check if the user can access
         * otherwise warn and exit
         * \param $p_action requested action
         * \param $p_js = 1 javascript, or 0 just a text
@@ -729,7 +729,7 @@
                return $res;
        }
 
-       /* !\brief Check if the user can print (in menu_ref p_type_display=p)
+       /**\brief Check if the user can print (in menu_ref p_type_display=p)
         * otherwise warn and exit
         * \param $p_action requested action
         * \return nothing the program exits automatically
@@ -756,7 +756,7 @@
                }
        }
 
-       /* !
+       /**
         * \brief  Check if an user is an local administrator
         *
         *
@@ -822,7 +822,7 @@
                }
                return $r;
        }
-       /* !
+       /**
         * \brief return an array with all the users who can access $p_dossier 
including the global admin. The user
         * must be activated
         *
@@ -853,7 +853,7 @@
                return $array;
        }
 
-       /* !
+       /**
         * \brief check the access of an user on a ledger
         *
         * \param $p_jrn the ledger id
@@ -870,7 +870,7 @@
                return $this->get_ledger_access($p_jrn);
        }
 
-       /* !\brief check if an user can access a folder, if he cannot display a 
dialog box
+       /**\brief check if an user can access a folder, if he cannot display a 
dialog box
         * and exit
         * \param the folder if
         * \param $silent false, echo an error message and exit, true : exit 
without warning
@@ -916,7 +916,7 @@
                return array($start, $end);
        }
 
-       /* !
+       /**
         * \brief   Show all the available folder  for the users
         *          at the login page. For the special case 'E'
         *          go directly to extension and bypasse the dashboard
@@ -973,7 +973,7 @@
                return $result;
        }
 
-       /* !
+       /**
         * \brief   Get all the available folders
         *          for the users, checked with the security
         *
@@ -1032,7 +1032,7 @@
                        }
                        $cn = new Database();
                        if (isset($_REQUEST['gDossier']))
-                               $p_module.= "dossier : " . 
$_REQUEST['gDossier'];
+                               $p_module.= " dossier : " . 
$_REQUEST['gDossier'];
                        $sql = "insert into audit_connect 
(ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)";
 
                        $cn->exec_sql($sql, array(

Modified: phpcompta/trunk/include/client.inc.php
===================================================================
--- phpcompta/trunk/include/client.inc.php      2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/client.inc.php      2013-05-03 22:31:33 UTC (rev 
5216)
@@ -18,7 +18,7 @@
  */
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
-/* !\brief include from client.inc.php and concerned only the customer card and
+/**\brief include from client.inc.php and concerned only the customer card and
  * the customer category
  */
 require_once("class_iselect.php");
@@ -30,7 +30,7 @@
 
 
 $low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
-/* ! \file
+/** \file
  * \brief Called from the module "Gestion" to manage the customer
  */
 $href=basename($_SERVER['PHP_SELF']);

Modified: phpcompta/trunk/include/compta_ach.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ach.inc.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/compta_ach.inc.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief file included to manage all the sold operation
  */
 require_once("class_icheckbox.php");
@@ -29,7 +29,7 @@
 require_once ('class_pre_op_ach.php');
 require_once('class_ipopup.php');
 $gDossier = dossier::id();
-
+global $g_parameter;
 $cn = new Database(dossier::id());
 //menu = show a list of ledger
 $str_dossier = dossier::get();
@@ -62,7 +62,7 @@
                echo '<div class="content">';
                echo h2info('Confirmation');
 
-               echo '<form enctype="multipart/form-data" method="post">';
+               echo '<form enctype="multipart/form-data" method="post" 
class="print">';
                echo dossier::hidden();
 
                echo $Ledger->confirm($_POST);
@@ -232,7 +232,7 @@
 echo '</div>';
 echo "</FORM>";
 
-if (!isset($_POST['e_date']))
+if (!isset($_POST['e_date']) && $g_parameter->MY_DATE_SUGGEST=='Y')
        echo create_script(" get_last_date()");
 
 echo '</div>';

Modified: phpcompta/trunk/include/compta_fin.inc.php
===================================================================
--- phpcompta/trunk/include/compta_fin.inc.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/compta_fin.inc.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -25,7 +25,7 @@
  */
 require_once ('class_acc_ledger_fin.php');
 require_once('class_ipopup.php');
-global $g_user;
+global $g_user,$g_parameter;
 
 $gDossier=dossier::id();
 
@@ -76,7 +76,7 @@
        {
                echo '<div class="content">';
                echo '<h2 class="info">'._('Confirmation').' </h2>';
-               echo '<form name="form_detail" class="print" 
enctype="multipart/form-data"  METHOD="POST">';
+               echo '<form name="form_detail" class="print" 
enctype="multipart/form-data" class="print" METHOD="POST">';
                echo HtmlInput::hidden('ac',$_REQUEST['ac']);
                echo $Ledger->confirm($_POST);
                echo HtmlInput::submit('confirm',_('Confirmer'));
@@ -131,7 +131,7 @@
 echo '<div class="content">';
 
 
-echo '<form class="print" name="form_detail" enctype="multipart/form-data" 
METHOD="POST">';
+echo '<form class="print" name="form_detail" enctype="multipart/form-data" 
class="print" METHOD="POST">';
 echo HtmlInput::hidden('ledger_type','fin');
 echo HtmlInput::hidden('ac',$_REQUEST['ac']);
 $array=( isset($correct))?$_POST:null;
@@ -142,9 +142,11 @@
 echo HtmlInput::submit('save',_('Sauve'));
 echo HtmlInput::reset(_('Effacer'));
 
-if ( ! isset ($_POST['e_date']) )
+if ( ! isset ($_POST['e_date'])&& $g_parameter->MY_DATE_SUGGEST=='Y')
 {
        echo create_script(" get_last_date();ajax_saldo('first_sold');");
+}else {
+       echo create_script(" ajax_saldo('first_sold');");
 }
 
 exit();
\ No newline at end of file

Modified: phpcompta/trunk/include/compta_fin_rec.inc.php
===================================================================
--- phpcompta/trunk/include/compta_fin_rec.inc.php      2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/compta_fin_rec.inc.php      2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  *
  *
  * \brief reconcile operation
@@ -74,7 +74,7 @@
                  {
                    echo '<div class="content">'.$g_succeed.' Mise à jour 
extrait '.$_POST['ext'].'</div>';
                  }
-               
+
                $cn->commit();
        }
 }
@@ -101,7 +101,11 @@
 echo dossier::hidden();
 echo HtmlInput::get_to_hidden(array('sa', 'p_action', 'p_jrn'));
 
-$operation = $cn->get_array("select 
jr_id,jr_internal,jr_comment,to_char(jr_date,'DD.MM.YYYY') as 
fmt_date,jr_montant
+$operation = $cn->get_array("select jr_id,jr_internal,
+                                                               jr_comment,
+                                                               
to_char(jr_date,'DD.MM.YYYY') as fmt_date,
+                                                               jr_montant,
+                                                               
to_char(jr_date,'YYYYMMDD') as raw_date
                               from jrn where jr_def_id=$1 and (jr_pj_number is 
null or jr_pj_number='') order by jr_date", array($Ledger->id));
 echo '<span id="bkname">' . hb(h($Ledger->get_bank_name())) . '</span>';
 echo '<p>';
@@ -118,8 +122,8 @@
 echo IButton::tooggle_checkbox('rec1');
 echo '</p>';
 echo HtmlInput::submit('save', 'Mettre à jour le n° de relevé bancaire');
-echo '<table class="result" style="width:80%;margin-left:10%">';
-$r = th('Date');
+echo '<table class="sortable" style="width:80%;margin-left:10%">';
+$r ='<th class=" sorttable_sorted_reverse">'.'Date 
'.HtmlInput::infobulle(17).'<span 
id="sorttable_sortrevind">&nbsp;&blacktriangle;</span>'.'</th>';
 $r.=th('Libellé');
 $r.=th('N° interne');
 $r.=th('Montant', ' style="text-align:right"');
@@ -133,11 +137,11 @@
        $row = $operation[$i];
        $r = '';
        $js = HtmlInput::detail_op($row['jr_id'], $row['jr_internal']);
-       $r.=td($row['fmt_date']);
+       $r.='<td 
sorttable_customkey="'.$row['raw_date'].'">'.$row['fmt_date'].'</td>';
        $r.=td($row['jr_comment']);
        $r.=td($js);
        $amount=$cn->get_value('select qf_amount from quant_fin where 
jr_id=$1', array($row['jr_id']));
-       $r.=td(nbm ($amount), ' class="num" ');
+       $r.='<td class="num" class="sorttable_numeric" 
sortable_customekey="'.$amount.'" style="text-align:right">'.nbm 
($amount).'</td>';
 
        $diff=bcadd($diff,$amount);
        $tot_not_reconcilied+=$row['jr_montant'];
@@ -154,11 +158,11 @@
                        }
                }
        }
-       $r.=td(HtmlInput::hidden('jrid[]', $row['jr_id']) . $iradio->input(), ' 
style="text-align:center" ');
+       $r.=td(HtmlInput::hidden('jrid['.$i.']', $row['jr_id']) . 
$iradio->input(), ' style="text-align:center" ');
        if ($i % 2 == 0)
                echo tr($r, ' class="odd" ');
        else
-               echo tr($r);
+               echo tr($r,' class="even" ');
 }
 echo '</table>';
 $bk_card = new Fiche($cn);

Modified: phpcompta/trunk/include/compta_fin_saldo.inc.php
===================================================================
--- phpcompta/trunk/include/compta_fin_saldo.inc.php    2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/compta_fin_saldo.inc.php    2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  *
  *
  * \brief show bank saldo

Modified: phpcompta/trunk/include/compta_ods.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ods.inc.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/compta_ods.inc.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -20,7 +20,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  *
  *
  * \brief to write directly into the ledgers,the stock and the tables
@@ -49,7 +49,7 @@
 }
 $ledger->id = ($ledger->id == -1) ? $first_ledger['jrn_def_id'] : $id;
 
-/* !\brief show a form for quick_writing */
+/**\brief show a form for quick_writing */
 $def = -1;
 $ledger->with_concerned = true;
 
@@ -96,7 +96,7 @@
                printf('<a class="detail" style="display:inline" 
href="javascript:modifyOperation(%d,%d)">%s</a><hr>', $jr_id, dossier::id(), 
$ledger->internal);
 
                // show feedback
-               echo '<div id="jrn_name_div">'; echo '<h2 id="jrn_name" 
style="display:inline">' . $ledger->get_name() . '</h2>'; echo '</div>';
+               echo '<div id="jrn_name_div">'; echo '<h2 id="jrn_name" 
class="title"  style="display:inline">' . $ledger->get_name() . '</h2>'; echo 
'</div>';
                echo $ledger->confirm($_POST, true);
        }
        catch (Exception $e)

Modified: phpcompta/trunk/include/compta_ven.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ven.inc.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/compta_ven.inc.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -251,8 +251,12 @@
     /* if we suggest the pj n# the run the script */
     if ( $g_parameter->MY_PJ_SUGGEST=='Y')
     {
-               if ( ! isset($_POST['e_date'])) echo '<script> 
update_pj();get_last_date()</script>';
+               echo '<script> update_pj()</script>';
     }
+       if (!isset($_POST['e_date']) && $g_parameter->MY_DATE_SUGGEST=='Y')
+       {
+               echo create_script(" get_last_date()");
+       }
     exit();
 
 

Modified: phpcompta/trunk/include/config_file.php
===================================================================
--- phpcompta/trunk/include/config_file.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/config_file.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -147,7 +147,7 @@
     fputs($hFile, 'define ("phpcompta_psql_host","127.0.0.1");');
     fputs($hFile,"\r\n");
 
-    fputs($hFile, 'define ("locale",'.$clocale.');');
+    fputs($hFile, 'define ("LOCALE",'.$clocale.');');
     fputs($hFile,"\r\n");
 
     fputs($hFile, 'define ("domaine","");');

Modified: phpcompta/trunk/include/constant.php
===================================================================
--- phpcompta/trunk/include/constant.php        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/constant.php        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -47,7 +47,7 @@
 define 
("SITE_UPDATE_PLUGIN",'http://www.phpcompta.eu/plugin_last_version.txt');
 
 
-define ("DBVERSION",103);
+define ("DBVERSION",106);
 
 define ("DBVERSIONREPO",14);
 define ('NOTFOUND','--not found--');
@@ -55,9 +55,13 @@
 define ("MAX_COMPTE",4);
 define ('MAX_ARTICLE',12);
 define ('MAX_CAT',15);
+define ('MAX_CARD_SEARCH',50);
 define ('MAX_FORECAST_ITEM',10);
 define ('MAX_PREDEFINED_OPERATION',30);
 define ('MAX_COMPTE_CARD',4);
+define ('COMPTA_MAX_YEAR',2100);
+define ('COMPTA_MIN_YEAR',1990);
+define ('MAX_RECONCILE',25);
 
 if ( DEBUG ) error_reporting(2147483647);  else error_reporting(0);
 // Erreur

Modified: phpcompta/trunk/include/contact.inc.php
===================================================================
--- phpcompta/trunk/include/contact.inc.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/contact.inc.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -18,7 +18,7 @@
  */
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
-/* !\brief include from client.inc.php and concerned only the contact card and
+/**\brief include from client.inc.php and concerned only the contact card and
  * the contact category
  */
 require_once("class_iselect.php");
@@ -30,7 +30,7 @@
 
 
 $low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
-/* ! \file
+/** \file
  * \brief Called from the module "Gestion" to manage the contact
  */
 $href=basename($_SERVER['PHP_SELF']);

Modified: phpcompta/trunk/include/doc_state.inc.php
===================================================================
--- phpcompta/trunk/include/doc_state.inc.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/doc_state.inc.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -32,10 +32,17 @@
 {
        if (trim ($_POST['s_value'])!="")
        {
-               $cn->exec_sql('insert into document_state(s_value) values 
($1)',array($_POST['s_value']));
+               if ( isset($_POST['s_state']))
+               {
+                       $cn->exec_sql('insert into 
document_state(s_value,s_status) values ($1,$2)',array($_POST['s_value'],'C'));
+               }
+               else
+               {
+                       $cn->exec_sql('insert into document_state(s_value) 
values ($1)',array($_POST['s_value']));
+               }
        }
 }
-$a_stat=$cn->get_array("select s_value   from document_state order by 1");
+$a_stat=$cn->get_array("select s_value,s_status from document_state order by 
1");
 ?>
 
 <table>
@@ -45,10 +52,20 @@
                <td>
                        <?=h($a_stat[$i]['s_value'])?>
                </td>
+
+               <td>
+                       <? if ($a_stat[$i]['s_status']=='C') { echo _("Ferme 
l'action"); } ?>
+               </td>
        </tr>
        <?      endfor;?>
 </table>
+<h2>Ajout d'un état</h2>
 <form method="post" onsubmit="return confirm ('Vous confirmez ?'); ">
-       <? $value=new IText("s_value",""); echo $value->input()?>
-       <?=HtmlInput::submit("add", "Ajouter")?>
+       <p>
+               Nom de l'état <? $value=new IText("s_value",""); echo 
$value->input()?>
+       </p>
+       <p>
+               Cochez la case si cet état ferme une action <? $state=new 
ICheckBox("s_state",""); echo $state->input()?>
+               <?=HtmlInput::submit("add", "Ajouter")?>
+       </p>
 </form>
\ No newline at end of file

Modified: phpcompta/trunk/include/dossier.inc.php
===================================================================
--- phpcompta/trunk/include/dossier.inc.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/dossier.inc.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -195,22 +195,32 @@
             echo "<TR $cl><TD style=\"vertical-align:top\"> ".
              $Dossier['dos_id']."</td><td> <B>".h($Dossier['dos_name'])."</B> 
</TD>";
            $str_name=domaine.'dossier'.$Dossier['dos_id'];
-           $size=$repocn->get_value("select 
pg_database_size($1)/(1024*1024)::float",
-                                array($str_name));
+
            echo "<TD><I>  ".h($Dossier['dos_description'])."</I></td>";
-           echo td(nbm($size)."MB",' style="text-align:right"');
 
+            $database_exist=$repocn->exist_database($str_name);
+
+            if ($database_exist > 0 )
+            {
+                $size=$repocn->get_value("select 
pg_database_size($1)/(1024*1024)::float",
+                                     array($str_name));
+                echo td(nbm($size)."MB",' style="text-align:right"');
+            } else {
+                echo td(_("Dossier inexistant"),'style="color:red"');
+            }
            echo td($str_name);
             echo "<TD>";
-            echo 
td(HtmlInput::button_anchor(_('Effacer'),'?action=dossier_mgt&sa=del&d='.$Dossier['dos_id']));
+            if ( $database_exist > 0)
+            {
+                echo 
td(HtmlInput::button_anchor(_('Effacer'),'?action=dossier_mgt&sa=del&d='.$Dossier['dos_id']));
 
-           echo 
td(HtmlInput::button_anchor(_('Modifier'),'?action=dossier_mgt&sa=mod&d='
-                                            .$Dossier['dos_id']));
+                echo 
td(HtmlInput::button_anchor(_('Modifier'),'?action=dossier_mgt&sa=mod&d='
+                                                 .$Dossier['dos_id']));
 
-           echo 
td(HtmlInput::button_anchor(_('Backup'),'backup.php?action=backup&sa=b&t=d&d='
-                                         .$Dossier['dos_id']));
-           echo '</td>';
-
+                echo 
td(HtmlInput::button_anchor(_('Backup'),'backup.php?action=backup&sa=b&t=d&d='
+                                              .$Dossier['dos_id']));
+                echo '</td>';
+            }
             echo '<tr>';
             $compteur++;
 

Modified: phpcompta/trunk/include/export_balance_pdf.php
===================================================================
--- phpcompta/trunk/include/export_balance_pdf.php      2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/export_balance_pdf.php      2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -215,7 +215,7 @@
     $pdf->Cell(20,6,nbm($tp_sold),'T',0,'R',0);
     $pdf->Cell(20,6,nbm($tp_solc),'T',0,'R',0);
     $pdf->Ln();
-  } // if ! empty
+  } /** empty */
 
 $fDate=date('dmy-Hi');
 $pdf->Output('balance-'.$fDate.'.pdf','D');

Modified: phpcompta/trunk/include/export_fiche_balance_csv.php
===================================================================
--- phpcompta/trunk/include/export_fiche_balance_csv.php        2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/export_fiche_balance_csv.php        2013-05-03 
22:31:33 UTC (rev 5216)
@@ -133,7 +133,7 @@
                        /* skip if nothing to display */
                        if (count($letter->content) == 0)
                                continue;
-                       
printf('"%s"'."\n",$row->strAttribut(ATTR_DEF_QUICKCODE), 
$row->strAttribut(ATTR_DEF_NAME));
+                       
printf('"%s";"%s"'."\n",$row->strAttribut(ATTR_DEF_QUICKCODE), 
$row->strAttribut(ATTR_DEF_NAME));
 
                        printf('"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s";"%s"',
                                        _('Date'),
@@ -175,7 +175,7 @@
                                printf 
("%s;\"%s\";",abs(nb($prog)),$fic->get_amount_side($prog));
                                if ($row['letter'] != -1)
                                {
-                                       printf('"%s";',$row['letter']);
+                                       printf('"%s";',  
strtoupper(base_convert($row['letter'],10,36)));
                                        printf("%s",nb($row['letter_diff']));
                                }
                                else

Modified: phpcompta/trunk/include/export_fiche_balance_pdf.php
===================================================================
--- phpcompta/trunk/include/export_fiche_balance_pdf.php        2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/export_fiche_balance_pdf.php        2013-05-03 
22:31:33 UTC (rev 5216)
@@ -120,11 +120,11 @@
        $side='';
        if(bcsub($solde['credit'],$solde['debit']) < 0) $side='Deb.';
        if(bcsub($solde['credit'],$solde['debit']) > 0) $side='Cred.';
-        
+
         $sum_cred=bcadd($sum_cred,$solde['credit']);
         $sum_deb=bcadd($sum_deb,$solde['debit']);
         $sum_solde=bcsub($sum_deb,$sum_cred);
-        
+
         $pdf->Cell(30,7,$oCard->strAttribut(ATTR_DEF_QUICKCODE),0,0,'L',$fill);
         $pdf->Cell(80,7,$oCard->strAttribut(ATTR_DEF_NAME),0,0,'L',$fill);
         $pdf->Cell(20,7,nbm($solde['debit']),0,0,'R',$fill);
@@ -140,7 +140,7 @@
         $pdf->Cell(20,7,nbm($sum_cred),0,0,'R',$fill);
         $pdf->Cell(20,7,nbm(abs($sum_solde)),0,0,'R',$fill);
         $side=" = ";
-        if ( $sum_solde > 0 ) 
+        if ( $sum_solde > 0 )
         {
             $side='Deb.';
         }
@@ -148,7 +148,7 @@
         {
             $side='Cred.';
         }
-        
+
         $pdf->Cell(20,7,$side,0,0,'C',$fill);
         $pdf->Ln();
        }
@@ -210,7 +210,7 @@
                                continue;
                        $pdf->SetFont('DejaVuCond', '', 10);
                        $fiche = new Fiche($cn, $row_fiche['f_id']);
-                       $pdf->Cell(0, 7, $fiche->strAttribut(ATTR_DEF_NAME), 1, 
1, 'C');
+                       $pdf->Cell(0, 7, $fiche->strAttribut(ATTR_DEF_NAME)." 
[".$fiche->strAttribut(ATTR_DEF_QUICKCODE)."]", 1, 1, 'C');
 
                        $pdf->SetFont('DejaVuCond', '', 7);
 
@@ -265,7 +265,7 @@
                                }
                                if ($row['letter'] != -1)
                                {
-                                       $pdf->Cell($tab[6], 4, $row['letter'], 
0, 0, $align[6], $fill);
+                                       $pdf->Cell($tab[6], 4, 
strtoupper(base_convert($row['letter'],10,36)), 0, 0, $align[6], $fill);
                                        // get sum for this lettering
 
                                        $pdf->Cell($tab[7], 4, sprintf('%s', 
nbm($row['letter_diff'])), '0', '0', $align[7], $fill);

Modified: phpcompta/trunk/include/export_fiche_detail_csv.php
===================================================================
--- phpcompta/trunk/include/export_fiche_detail_csv.php 2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/export_fiche_detail_csv.php 2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -74,7 +74,7 @@
          nb($op['deb_montant']).";".
          nb($op['cred_montant']).";".
          nb(abs($progress)).';'.
-         '"'.(($op['letter']==-1)?'':$op['letter']).'"';
+         
'"'.(($op['letter']==-1)?'':strtoupper(base_convert($op['letter'],10,36))).'"';
         printf("\n");
 
     }

Modified: phpcompta/trunk/include/export_fiche_detail_pdf.php
===================================================================
--- phpcompta/trunk/include/export_fiche_detail_pdf.php 2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/export_fiche_detail_pdf.php 2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -107,7 +107,7 @@
     
$pdf->LongLine($size[$l],6,($row['description'].'('.$row['jr_internal'].")"),0,$align[$l]);
 
     $l++;
-    
$pdf->Cell($size[$l],6,(($row['letter']!=-1)?$row['letter']:''),0,0,$align[$l]);
+    
$pdf->Cell($size[$l],6,(($row['letter']!=-1)?strtoupper(base_convert($row['letter'],10,36)):''),0,0,$align[$l]);
     $l++;
     $pdf->Cell($size[$l],6,(sprintf('% 
12.2f',$row['deb_montant'])),0,0,$align[$l]);
     $l++;

Modified: phpcompta/trunk/include/export_fiche_pdf.php
===================================================================
--- phpcompta/trunk/include/export_fiche_pdf.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/export_fiche_pdf.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -197,7 +197,7 @@
             }
             if ($row['letter'] != -1 )
             {
-                $pdf->Cell($tab[5],4,$row['letter'],0,0,$align[5],$fill);
+                
$pdf->Cell($tab[5],4,strtoupper(base_convert($row['letter'],10,36)),0,0,$align[5],$fill);
                 // get sum for this lettering
                 $sql="select sum(j_montant) from jrnx where j_debit=$1 and 
j_id in ".
                      " (select j_id from jnt_letter join letter_deb using 
(jl_id) where jl_id=$2 union ".

Modified: phpcompta/trunk/include/export_histo_csv.php
===================================================================
--- phpcompta/trunk/include/export_histo_csv.php        2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/export_histo_csv.php        2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -43,7 +43,7 @@
 printf('"%s";',"Tiers");
 printf('"%s";',"Description");
 printf('"%s";',"Note");
-printf('"%s"',"Montant");
+printf('"%s"',"Montant opération");
 printf("\r\n");
 
 for ($i=0;$i<count($res);$i++)
@@ -60,12 +60,13 @@
 
     $amount=$res[$i]['jr_montant'];
 
+       if ( $res[$i]['total_invoice']!=null && 
$res[$i]['jr_montant']!=$res[$i]['total_invoice'])
+               $amount=$res[$i]['total_invoice'];
     if ( $res[$i]['jrn_def_type'] == 'FIN')
       {
-       $positive = $cn->get_value("select qf_amount from quant_fin where 
jr_id=$1",array($res[$i]['jr_id']));
-       if ( $positive !='' ) $amount=$positive;
+               $positive = $cn->get_value("select qf_amount from quant_fin 
where jr_id=$1",array($res[$i]['jr_id']));
+               if ( $positive !='' ) $amount=$positive;
       }
-
     printf('%s',nb($amount));
 
     printf("\r\n");

Modified: phpcompta/trunk/include/export_poste_detail_csv.php
===================================================================
--- phpcompta/trunk/include/export_poste_detail_csv.php 2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/export_poste_detail_csv.php 2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -25,10 +25,10 @@
 require_once('class_database.php');
 require_once("class_acc_account_ledger.php");
 require_once ('class_acc_operation.php');
-
+$fDate=date('dmy-Hi');
 header('Pragma: public');
 header('Content-type: application/csv');
-header('Content-Disposition: attachment;filename="poste.csv"',FALSE);
+header('Content-Disposition: 
attachment;filename="poste-'.$fDate.'-'.$_REQUEST['poste_id'].'.csv"',FALSE);
 require_once('class_dossier.php');
 $gDossier=dossier::id();
 
@@ -68,7 +68,8 @@
         "\"Description\";".
         "\"Débit\";".
         "\"Crédit\";".
-        "\"Prog.\"";
+        "\"Prog.\";".
+               "\"Let.\"";
         printf("\n");
 
         $prog=0;
@@ -84,7 +85,8 @@
             '"'.$op['description'].'";'.
             nb($op['deb_montant']).";".
             nb($op['cred_montant']).";".
-            nb(abs($prog));
+            nb(abs($prog)).";".
+                       
(($op['letter']!=-1)?strtoupper(base_convert($op['letter'],10,36)):"");
             printf("\n");
 
 
@@ -109,7 +111,8 @@
         $Poste=new Acc_Account_Ledger($cn,$pos['pcm_val']);
         $Poste->get_name();
         list($array,$tot_deb,$tot_cred)=$Poste->get_row_date( 
$_REQUEST['from_periode'],
-                                        $_REQUEST['to_periode']
+                                        $_REQUEST['to_periode'],
+                                                                             
$_GET['ople']
                                                             );
         if ( count($Poste->row ) == 0 )
             continue;

Modified: phpcompta/trunk/include/export_poste_detail_pdf.php
===================================================================
--- phpcompta/trunk/include/export_poste_detail_pdf.php 2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/export_poste_detail_pdf.php 2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -198,5 +198,5 @@
 
 }
 $fDate=date('dmy-Hi');
-$pdf->Output('poste-'.$fDate.'.pdf','D');
+$pdf->Output('poste-'.$fDate.'-'.$poste_id.'.pdf','D');
 ?>

Modified: phpcompta/trunk/include/fiche.inc.php
===================================================================
--- phpcompta/trunk/include/fiche.inc.php       2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/fiche.inc.php       2013-05-03 22:31:33 UTC (rev 
5216)
@@ -19,7 +19,7 @@
  */
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
-/* !\file
+/**\file
  * \brief printing of category of card  : balance, historic
  */
 include_once('class_database.php');
@@ -82,6 +82,16 @@
 require_once('template/impress_cat_card.php');
 echo HtmlInput::submit('cat_display', _('Recherche'));
 echo '</FORM>';
+$search_card=new IText('card_search');
+$search_card_js=sprintf('onclick="boxsearch_card(\'%d\')"',dossier::id());
+?>
+<div style="position:absolute;right:230px;top:110px">
+
+               <?=_('Recherche de fiche')?> <?=HtmlInput::infobulle(18)?> 
:<?=$search_card->input()?>
+               
<?=HtmlInput::button_anchor("Chercher","javascript:void(0)","",$search_card_js)?>
+</div>
+<?
+echo '</div>';
 $str = "if (g('histo').value==3 || g('histo').value== -1 ) {
      
g('trstart').style.display='none';g('trend').style.display='none';g('allcard').style.display='none';}
      else  
{g('trstart').style.display='';g('trend').style.display='';g('allcard').style.display='';}
@@ -155,8 +165,8 @@
                                }
                                if ($msg != "")
                                {
-                                       echo h2("Fiche non effacées", ' 
class="error"  ');
-                                       echo '<p class="error">'." Ces fiches 
n'ont pas été effacées  ".$msg;
+                                       echo h2(_("Fiche non effacées"), ' 
class="error"  ');
+                                       echo '<p class="error">'._(" Ces fiches 
n'ont pas été effacées  ").$msg;
                                }
                        }
                }
@@ -172,10 +182,10 @@
        }
        else
        {
-               $cond = " where fd_id = " . sql_string($_GET['cat']);
+               $cond = " where f.fd_id = " . sql_string($_GET['cat']);
        }
        // Create nav bar
-       $max = $cn->get_value("select count(*) from fiche " . $cond);
+       $max = $cn->get_value("select count(*) from fiche as f " . $cond);
 
        $step = $_SESSION['g_pagesize'];
        $page = (isset($_GET['offset'])) ? $_GET['page'] : 1;
@@ -185,13 +195,15 @@
        $res = $cn->exec_sql("
                select f_id,
                        (select ad_value from fiche_detail as fd1 where ad_id=1 
and fd1.f_id=f.f_id) as name,
-                       (select ad_value from fiche_detail as fd1 where 
ad_id=23 and fd1.f_id=f.f_id) as qcode
-               from fiche as f
-               $cond   order by 1 offset $offset $limit
+                       (select ad_value from fiche_detail as fd1 where 
ad_id=23 and fd1.f_id=f.f_id) as qcode,
+                       fd_label
+               from fiche as f join fiche_def as fd on (fd.fd_id=f.fd_id)
+               $cond   order by 2 offset $offset $limit
        ");
        $nb_line = Database::num_row($res);
+       if ($write != 1 || $allcard != 0 )  $str_add_card="";
        require_once 'template/fiche_list.php';
-       if ($write == 1 && $allcard == 0 ) echo $str_add_card;
+       echo '<hr>'.$bar;
        exit();
 }
 /* * 
*********************************************************************************************************************************
@@ -281,7 +293,7 @@
                {
                        if ($allcard == 0)
                        {
-                               echo "Aucune fiche trouvée";
+                               echo _("Aucune fiche trouvée");
                                exit;
                        } else
                                continue;
@@ -324,9 +336,9 @@
                                        td(nbm(abs($solde['solde'])), 
'style="text-align:right"') .
                                        td((($solde['debit'] < 
$solde['credit']) ? 'CRED' : 'DEB'), 'style="text-align:right"'), $class
                        );
-                      
-                                
-                                
+
+
+
                }
                 echo tr(
                                 td('').
@@ -452,7 +464,7 @@
                                $span_error = "";
                                if ($row['letter_diff'] != 0)
                                        $span_error = $g_failed;
-                               echo td($row['letter'] . $span_error);
+                               echo 
td(strtoupper(base_convert($row['letter'],10,36)) . $span_error);
                        }
                        else
                                echo td('');

Modified: phpcompta/trunk/include/forecast.inc.php
===================================================================
--- phpcompta/trunk/include/forecast.inc.php    2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/forecast.inc.php    2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief display, add, delete and modify forecast
  */
 

Modified: phpcompta/trunk/include/function_javascript.php
===================================================================
--- phpcompta/trunk/include/function_javascript.php     2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/function_javascript.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -2755,6 +2755,8 @@
     echo js_include('gestion.js');
     echo js_include('todo_list.js');
     echo js_include('anc_script.js');
+    echo js_include('sorttable.js');
+    echo js_include('nicEdit.js');
 
 
 }

Modified: phpcompta/trunk/include/history_operation.inc.php
===================================================================
--- phpcompta/trunk/include/history_operation.inc.php   2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/history_operation.inc.php   2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  *
  *
  * \brief

Modified: phpcompta/trunk/include/impress_gl_comptes.inc.php
===================================================================
--- phpcompta/trunk/include/impress_gl_comptes.inc.php  2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/impress_gl_comptes.inc.php  2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -168,7 +168,8 @@
             continue;
         }
 
-        echo '<tr>
+
+        echo '<tr >
         <td colspan="8" style="width:auto">
         <h2 class="info">'. $poste_id['pcm_val'].' '.h($Poste->label).'</h2>
         </td>
@@ -189,6 +190,7 @@
         $solde_d = 0.0;
         $solde_c = 0.0;
        bcscale(2);
+       $i=0;
         foreach ($Poste->row as $detail)
         {
          if ($a==0) {var_dump($detail);$a=1;}
@@ -216,8 +218,10 @@
              $solde_d = bcadd($solde_d,$detail['deb_montant']);
             }
                        $side="&nbsp;".$Poste->get_amount_side($solde);
-           $letter=($detail['letter']!=-1)?hi($detail['letter']):'';
-            echo '<tr>
+           
$letter=($detail['letter']!=-1)?hi(strtoupper(base_convert($detail['letter'],10,36))):'';
+               $i++;
+               if (($i % 2 ) == 0) $class="odd"; else $class="even";
+            echo '<tr class="'.$class.'">
             <td>'.$detail['j_date_fmt'].'</td>
             
<td>'.HtmlInput::detail_op($detail['jr_id'],$detail['jr_internal']).'</td>
             <td>'.$detail['description'].'</td>
@@ -228,7 +232,7 @@
             <td  style="text-align:right;color:red">'.$letter.'</td>
             </tr>';
         }
-        echo '<tr>
+        echo '<tr >
         <td>'.''.'</td>
         <td>'.''.'</td>
         <td>'.'<b>'.'Total du compte '.$poste_id['pcm_val'].'</b>'.'</td>

Modified: phpcompta/trunk/include/impress_jrn.inc.php
===================================================================
--- phpcompta/trunk/include/impress_jrn.inc.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/impress_jrn.inc.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -1,4 +1,5 @@
 <?php
+
 /*
  *   This file is part of PhpCompta.
  *
@@ -15,10 +16,10 @@
  *   You should have received a copy of the GNU General Public License
  *   along with PhpCompta; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+ */
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
-/*! \file
+/** \file
  * \brief ask for Printing the ledger (pdf,html)
  */
 
@@ -28,32 +29,34 @@
 require_once('class_exercice.php');
 require_once('class_dossier.php');
 load_all_script();
-$gDossier=dossier::id();
+$gDossier = dossier::id();
 global $g_user;
 //-----------------------------------------------------
 // Show the jrn and date
 //-----------------------------------------------------
 require_once('class_database.php');
 
-if ( $g_user->Admin() == 0 && $g_user->is_local_admin()==0)
+if ($g_user->Admin() == 0 && $g_user->is_local_admin() == 0)
 {
-    $sql="select jrn_def_id,jrn_def_name
+       $sql = "select jrn_def_id,jrn_def_name
          from jrn_def join jrn_type on jrn_def_type=jrn_type_id
          join user_sec_jrn on uj_jrn_id=jrn_def_id
          where
          uj_login='$g_user->login'
          and uj_priv in ('R','W')
+                order by jrn_def_name
          ";
-    $ret=$cn->make_array($sql);
+       $ret = $cn->make_array($sql);
 }
 else
 {
-    $ret=$cn->make_array("select jrn_def_id,jrn_def_name
-                         from jrn_def join jrn_type on 
jrn_def_type=jrn_type_id");
-
+       $ret = $cn->make_array("select jrn_def_id,jrn_def_name
+                         from jrn_def join jrn_type on jrn_def_type=jrn_type_id
+                                                order by jrn_def_name
+                                                ");
 }
 // Count the forbidden journaux
-$NoPriv=$cn->count_sql("select 
jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
+$NoPriv = $cn->count_sql("select 
jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
                        jrn_deb_max_line,jrn_cred_max_line
                        from jrn_def join jrn_type on jrn_def_type=jrn_type_id
                        join  user_sec_jrn on uj_jrn_id=jrn_def_id
@@ -62,15 +65,15 @@
                        and uj_priv ='X'
                        ");
 // Pour voir tout les journal ?
-if ( $NoPriv == 0 && $ret != null )
+if ($NoPriv == 0 && $ret != null)
 {
-    $a=count($ret);
-    $all=array('value'=>0,'label'=>'Tous les journaux');
-    $ret[$a]=$all;
+       $a = count($ret);
+       $all = array('value' => 0, 'label' => 'Tous les journaux');
+       $ret[$a] = $all;
 }
-if ( count($ret) < 1 )
-    NoAccess();
-$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice();
+if (count($ret) < 1)
+       NoAccess();
+$exercice = (isset($_GET['exercice'])) ? $_GET['exercice'] : 
$g_user->get_exercice();
 
 //-----------------------------------------------------
 // Form
@@ -79,56 +82,58 @@
 /*
  * Let you change the exercice
  */
-echo '<fieldset><legend>'._('Choississez un autre exercice').'</legend>';;
 echo '<form method="GET">';
+echo '<fieldset><legend>' . _('Choississez un autre exercice') . '</legend>';
+;
 echo 'Choississez un autre exercice :';
-$ex=new Exercice($cn);
-$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"');
+$ex = new Exercice($cn);
+$wex = $ex->select('exercice', $exercice, ' onchange="submit(this)"');
 echo $wex->input();
 echo dossier::hidden();
-echo HtmlInput::get_to_hidden(array('ac','type'));
+echo HtmlInput::get_to_hidden(array('ac', 'type'));
+echo '</fieldset>';
 echo '</form>';
-echo '</fieldset>';
 
 
 
-echo '<FORM METHOD="GET">'.dossier::hidden();
-echo HtmlInput::get_to_hidden(array('ac','type'));
-echo HtmlInput::hidden('type','jrn');
+echo '<FORM METHOD="GET">' . dossier::hidden();
+echo HtmlInput::get_to_hidden(array('ac', 'type'));
+echo HtmlInput::hidden('type', 'jrn');
 echo HtmlInput::get_to_hidden(array('exercice'));
 echo '<TABLE  ><TR>';
-$w=new ISelect();
-$w->table=1;
-$label="Choississez le journal";
-$w->selected=(isset($_GET['jrn_id']))?$_GET['jrn_id']:'';
-print td($label).$w->input("jrn_id",$ret);
+$w = new ISelect();
+$w->table = 1;
+$label = "Choississez le journal";
+$w->selected = (isset($_GET['jrn_id'])) ? $_GET['jrn_id'] : '';
+print td($label) . $w->input("jrn_id", $ret);
 print '</TR>';
 print '<TR>';
 // filter on the current year
-$filter_year=" where p_exercice='".sql_string($exercice)."'";
+$filter_year = " where p_exercice='" . sql_string($exercice) . "'";
 
-$periode_start=$cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') from 
parm_periode $filter_year order by p_start,p_end");
-$w->selected=(isset($_GET['from_periode']))?$_GET['from_periode']:'';
-print td('Depuis').$w->input('from_periode',$periode_start);
+$periode_start = $cn->make_array("select p_id,to_char(p_start,'DD-MM-YYYY') 
from parm_periode $filter_year order by p_start,p_end");
+$w->selected = (isset($_GET['from_periode'])) ? $_GET['from_periode'] : '';
+print td('Depuis') . $w->input('from_periode', $periode_start);
 print '</TR>';
 print '<TR>';
 
-$periode_end=$cn->make_array("select p_id,to_char(p_end,'DD-MM-YYYY') from 
parm_periode $filter_year order by p_start,p_end");
-$w->selected=(isset($_GET['to_periode']))?$_GET['to_periode']:'';
-print td('Jusque ').$w->input('to_periode',$periode_end);
+$periode_end = $cn->make_array("select p_id,to_char(p_end,'DD-MM-YYYY') from 
parm_periode $filter_year order by p_start,p_end");
+$w->selected = (isset($_GET['to_periode'])) ? $_GET['to_periode'] : '';
+print td('Jusque ') . $w->input('to_periode', $periode_end);
 print "</TR><TR>";
-$a=array(
-       array('value'=>0,'label'=>'Detaillé'),
-       array('value'=>1,'label'=>'Simple')
-   );
-$w->selected=1;
+$a = array(
+       array('value' => 0, 'label' => 'Ecriture comptable'),
+       array('value' => 1, 'label' => 'Liste opérations'),
+       array('value' => 2, 'label' => 'Avec Détails opérations ')
+);
+$w->selected = 1;
 print '</TR>';
 print '<TR>';
-$w->selected=(isset($_GET['p_simple']))?$_GET['p_simple']:'';
-echo td('Style d\'impression').$w->input('p_simple',$a);
+$w->selected = (isset($_GET['p_simple'])) ? $_GET['p_simple'] : '';
+echo td('Style d\'impression') . $w->input('p_simple', $a);
 print "</TR>";
 echo '</TABLE>';
-print HtmlInput::submit('bt_html','Visualisation');
+print HtmlInput::submit('bt_html', 'Visualisation');
 
 echo '</FORM>';
 
@@ -139,162 +144,239 @@
 // First time in html
 // after in pdf or cvs
 //-----------------------------------------------------
-if ( isset( $_REQUEST['bt_html'] ) )
+if (isset($_REQUEST['bt_html']))
 {
-    require_once("class_acc_ledger.php");
+       require_once("class_acc_ledger.php");
 
-    $d=var_export($_GET,true);
-    $Jrn=new Acc_Ledger($cn,$_GET['jrn_id']);
-    $Jrn->get_name();
-    if ( $_GET['p_simple']==0 )
-    {
-        $Row=$Jrn->get_row( $_GET['from_periode'],
-                            $_GET['to_periode']
-                          );
-    }
-    else
-    {
-        $Row=$Jrn->get_rowSimple($_GET['from_periode'],
-                                 $_GET['to_periode']
-                                );
-    }
-    $rep="";
-    $hid=new IHidden();
-    echo '<div class="content">';
-    echo '<h2 class="info">'.h($Jrn->name).'</h2>';
-    echo "<table>";
-    echo '<TR>';
-    echo '<TD><form method="GET" ACTION="?">'.dossier::hidden().
-    $hid->input("type","jrn").$hid->input('p_action','impress')."</form></TD>";
+       $d = var_export($_GET, true);
+       $Jrn = new Acc_Ledger($cn, $_GET['jrn_id']);
+       $Jrn->get_name();
+       switch ($_GET['p_simple'])
+       {
+               case "0":
+                       $Row = $Jrn->get_row($_GET['from_periode'], 
$_GET['to_periode']);
+                       break;
+               case "1":
+                       $Row = $Jrn->get_rowSimple($_GET['from_periode'], 
$_GET['to_periode']);
+                       break;
+               case "2":
+                       $Row = $Jrn->get_rowSimple($_GET['from_periode'], 
$_GET['to_periode']);
+                       break;
+               default:
+                       var_dump($_GET['p_simple']);
+                       die(__FILE__ . ":" . __LINE__ . " error unknown style 
");
+       }
+       $rep = "";
+       $hid = new IHidden();
+       echo '<div class="content">';
+       echo '<h2 class="info">' . h($Jrn->name) . '</h2>';
+       echo "<table>";
+       echo '<TR>';
+       if ($_GET['p_simple'] == 0 || $_GET['p_simple'] == 1)
+       {
+               echo '<TD><form method="GET" ACTION="?">' . dossier::hidden() .
+               $hid->input("type", "jrn") . $hid->input('p_action', 'impress') 
. "</form></TD>";
 
-    echo '<TD><form method="GET" ACTION="export.php">'.dossier::hidden().
-    HtmlInput::submit('bt_pdf',"Export PDF").
-      HtmlInput::hidden('act','PDF:ledger').
-    $hid->input("type","jrn").
-    $hid->input("jrn_id",$Jrn->id).
-    $hid->input("from_periode",$_GET['from_periode']).
-    $hid->input("to_periode",$_GET['to_periode']);
-    echo $hid->input("p_simple",$_GET['p_simple']);
-    echo HtmlInput::get_to_hidden(array('ac','type'));
-    echo "</form></TD>";
+               echo '<TD><form method="GET" ACTION="export.php">' . 
dossier::hidden() .
+               HtmlInput::submit('bt_pdf', "Export PDF") .
+               HtmlInput::hidden('act', 'PDF:ledger') .
+               $hid->input("type", "jrn") .
+               $hid->input("jrn_id", $Jrn->id) .
+               $hid->input("from_periode", $_GET['from_periode']) .
+               $hid->input("to_periode", $_GET['to_periode']);
+               echo $hid->input("p_simple", $_GET['p_simple']);
+               echo HtmlInput::get_to_hidden(array('ac', 'type'));
+               echo "</form></TD>";
 
-    echo '<TD><form method="GET" ACTION="export.php">'.dossier::hidden().
-    HtmlInput::submit('bt_csv',"Export CSV").
-      HtmlInput::hidden('act','CSV:ledger').
-    $hid->input("type","jrn").
-    $hid->input("jrn_id",$Jrn->id).
-    $hid->input("from_periode",$_GET['from_periode']).
-    $hid->input("to_periode",$_GET['to_periode']);
-    echo $hid->input("p_simple",$_GET['p_simple']);
-    echo HtmlInput::get_to_hidden(array('ac','type'));
-    echo "</form></TD>";
+               echo '<TD><form method="GET" ACTION="export.php">' . 
dossier::hidden() .
+               HtmlInput::submit('bt_csv', "Export CSV") .
+               HtmlInput::hidden('act', 'CSV:ledger') .
+               $hid->input("type", "jrn") .
+               $hid->input("jrn_id", $Jrn->id) .
+               $hid->input("from_periode", $_GET['from_periode']) .
+               $hid->input("to_periode", $_GET['to_periode']);
+               echo $hid->input("p_simple", $_GET['p_simple']);
+               echo HtmlInput::get_to_hidden(array('ac', 'type'));
+               echo "</form></TD>";
+       }
        echo '<td style="vertical-align:top">';
        echo HtmlInput::print_window();
        echo '</td>';
-    echo "</TR>";
+       echo "</TR>";
 
-    echo "</table>";
-    if ( count($Jrn->row ) == 0
-            && $Row==null)
-        exit;
+       echo "</table>";
+       if (count($Jrn->row) == 0
+                       && $Row == null)
+               exit;
 
-    echo '<TABLE class="result">';
 
-    if ( $_GET['p_simple'] == 0 )
-    {
-        // detailled printing
-        //---
-        foreach ( $Jrn->row as $op )
-        {
-           $class="";
-           if ( $op['j_date'] != '' )
-             {
-               $class="odd";
-             }
+       
/////////////////////////////////////////////////////////////////////////////////////
+       // Ecriture comptable
+       
/////////////////////////////////////////////////////////////////////////////////////
+       if ($_GET['p_simple'] == 0)
+       {
+               echo '<TABLE class="result">';
+               // detailled printing
+               //---
+               foreach ($Jrn->row as $op)
+               {
+                       $class = "";
+                       if ($op['j_date'] != '')
+                       {
+                               $class = "odd";
+                       }
 
-            echo "<TR  class=\"$class\">";
+                       echo "<TR  class=\"$class\">";
 
-            echo "<TD>".$op['j_date']."</TD>";
-            echo "<TD >".$op['jr_pj_number']."</TD>";
+                       echo "<TD>" . $op['j_date'] . "</TD>";
+                       echo "<TD >" . $op['jr_pj_number'] . "</TD>";
 
 
-            if ( $op['internal']!='')
-                echo 
"<TD>".HtmlInput::detail_op($op['jr_id'],$op['internal'])."</TD>";
-            else
-                echo td();
+                       if ($op['internal'] != '')
+                               echo "<TD>" . 
HtmlInput::detail_op($op['jr_id'], $op['internal']) . "</TD>";
+                       else
+                               echo td();
 
-            echo "<TD >".$op['poste']."</TD>".
-            "<TD  >".$op['description']."</TD>".
-             "<TD   
style=\"text-align:right\">".nbm($op['deb_montant'])."</TD>".
-             "<TD 
style=\"text-align:right\">".nbm($op['cred_montant'])."</TD>".
-            "</TR>";
-        }// end loop
-    } // if
-    else
-    {
-        // Simple printing
-        //---
+                       echo "<TD >" . $op['poste'] . "</TD>" .
+                       "<TD  >" . $op['description'] . "</TD>" .
+                       "<TD   style=\"text-align:right\">" . 
nbm($op['deb_montant']) . "</TD>" .
+                       "<TD style=\"text-align:right\">" . 
nbm($op['cred_montant']) . "</TD>" .
+                       "</TR>";
+               }// end loop
+               echo "</table>";
+               // show the saldo
 
-        echo "<TR>".
-        "<th> operation </td>".
-        "<th>Date</th>".
-        "<th> n° de pièce </th>".
-        "<th>internal</th>".
-         th('Tiers').
-        "<th>Commentaire</th>".
-        "<th> montant</th>".
-        "</TR>";
-        // set a filter for the FIN
+               $solde = $Jrn->get_solde($_GET['from_periode'], 
$_GET['to_periode']);
+               echo "solde d&eacute;biteur:" . $solde[0] . "<br>";
+               echo "solde cr&eacute;diteur:" . $solde[1];
+       } // if
+       
/////////////////////////////////////////////////////////////////////////////////////
+       // Liste opérations
+       
/////////////////////////////////////////////////////////////////////////////////////
+       elseif ($_GET['p_simple'] == 1)
+       {
+               // Simple printing
+               //---
+               echo '<TABLE class="result">';
+               echo "<TR>" .
+               "<th> operation </td>" .
+               "<th>Date</th>" .
+               "<th> n° de pièce </th>" .
+               "<th>internal</th>" .
+               th('Tiers') .
+               "<th>Commentaire</th>" .
+               "<th>Total opération</th>" .
+               "</TR>";
+               // set a filter for the FIN
+               $i = 0;
+               foreach ($Row as $line)
+               {
+                       $i++;
+                       $class = ($i % 2 == 0) ? ' class="even" ' : ' 
class="odd" ';
+                       echo "<tr $class>";
+                       echo "<TD>" . $line['num'] . "</TD>";
+                       echo "<TD>" . $line['date'] . "</TD>";
+                       echo "<TD>" . h($line['jr_pj_number']) . "</TD>";
+                       echo "<TD>" . HtmlInput::detail_op($line['jr_id'], 
$line['jr_internal']) . "</TD>";
+                       $tiers = $Jrn->get_tiers($line['jrn_def_type'], 
$line['jr_id']);
+                       echo td($tiers);
+                       echo "<TD>" . h($line['comment']) . "</TD>";
 
-        foreach ($Row as $line)
-        {
-            echo "<tr>";
-            echo "<TD>".$line['num']."</TD>";
-            echo "<TD>".$line['date']."</TD>";
-            echo "<TD>".h($line['jr_pj_number'])."</TD>";
-           echo 
"<TD>".HtmlInput::detail_op($line['jr_id'],$line['jr_internal'])."</TD>";
-           $tiers=$Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']);
-           echo td($tiers);
-            echo "<TD>".h($line['comment'])."</TD>";
 
+                       //        echo "<TD>".$line['pj']."</TD>";
+                       // If the ledger is financial :
+                       // the credit must be negative and written in red
+                       // Get the jrn type
+                       if ($line['jrn_def_type'] == 'FIN')
+                       {
+                               $positive = $cn->get_value("select qf_amount 
from quant_fin where jr_id=$1", array($line['jr_id']));
+                               if ($cn->count() == 0)
+                                       $positive = 1;
+                               else
+                                       $positive = ($positive > 0) ? 1 : 0;
 
-            //   echo "<TD>".$line['pj']."</TD>";
-            // If the ledger is financial :
-            // the credit must be negative and written in red
-            // Get the jrn type
-            if ( $line['jrn_def_type'] == 'FIN' )
-            {
-             $positive = $cn->get_value("select qf_amount from quant_fin where 
jr_id=$1",
-                                              array($line['jr_id']));
-             if ($cn->count() != 0)
-               $positive = 1;
-             else
-                $positive = ($positive > 0)?1:0;
+                               echo "<TD align=\"right\">";
+                               echo ( $positive == 0 ) ? "<font color=\"red\"> 
 - " . nbm($line['montant']) . "</font>" : nbm($line['montant']);
+                               echo "</TD>";
+                       }
+                       else
+                       {
+                               echo "<TD align=\"right\">" . 
nbm($line['montant']) . "</TD>";
+                       }
 
-                echo "<TD align=\"right\">";
-                echo ( $positive != 0 )?"<font color=\"red\">  - 
".nbm($line['montant'])."</font>":nbm($line['montant']);
-                echo "</TD>";
-            }
-            else
-            {
-             echo "<TD align=\"right\">".nbm($line['montant'])."</TD>";
-            }
+                       echo "</tr>";
+               }
+               echo "</table>";
+       }
+       
/////////////////////////////////////////////////////////////////////////////////////
+       // Détaillé
+       
/////////////////////////////////////////////////////////////////////////////////////
+       elseif ($_GET['p_simple'] == 2)
+       {
+               foreach ($Row as $line)
+               {
+                       echo '<div 
style="margin-top:2px;margin-bottom:10px;border:solid 1px black">';
+                       $class = ' class="odd" style="font-stretch: 
expanded;font-size:12px;"';
+                       echo '<table class="result" style="font-weight: 
bolder;font-variant: small-caps;width:100%;">';
+                       echo "<tr $class>";
+                       echo '<TD style="width:5%">' . $line['date'] . "</TD>";
+                       echo '<TD style="width:10%">' . 
h($line['jr_pj_number']) . "</TD>";
+                       echo '<TD style="width:5%">' . 
HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>";
+                       $tiers = $Jrn->get_tiers($line['jrn_def_type'], 
$line['jr_id']);
+                       $ledger_name = $cn->get_value("select jrn_def_name from 
jrn_def where jrn_def_id=$1", array($line['jr_def_id']));
+                       echo '<TD style="width:20%">' . h($ledger_name) . ' 
</td>';
+                       echo '<TD style="width:20%">' . h($tiers) . ' </td>';
+                       echo '<TD style="width:30%">' . h($line['comment']) . 
"</TD>";
+                       echo '<TD style="text-align:right">';
+                       if ($line['jrn_def_type'] == 'FIN')
+                       {
+                               $positive = $cn->get_value("select qf_amount 
from quant_fin where jr_id=$1", array($line['jr_id']));
+                               if ($cn->count() == 0)
+                                       $positive = 1;
+                               else
+                                       $positive = ($positive > 0) ? 1 : 0;
 
-            echo "</tr>";
-        }
+                               echo ( $positive == 0 ) ? "<font color=\"red\"> 
 - " . nbm($line['montant']) . "</font>" : nbm($line['montant']);
+                       }
+                       else
+                       {
+                               echo  nbm($line['montant']) ;
+                       }
+                       echo  "</TD>";
+                       echo "</tr>";
+                       echo '</table>';
+                       
//////////////////////////////////////////////////////////////////////////////////////////////////////
+                       // Add detail for each operation
+                       
//////////////////////////////////////////////////////////////////////////////////////////////////////
+                       $op = new Acc_Operation($cn);
+                       $op->jr_id = $line['jr_id'];
+                       $op->get();
+                       $obj = $op->get_quant();
+                       switch ($obj->signature)
+                       {
+                               case 'FIN':
+                                       require 
'template/operation_detail_fin.php';
+                                       break;
+                               case 'ACH':
+                                       require 
'template/operation_detail_ach.php';
+                                       break;
+                               case 'VEN':
+                                       require 
'template/operation_detail_ven.php';
+                                       break;
+                               case 'ODS':
+                                       require 
'template/operation_detail_misc.php';
+                                       break;
+                               default:
+                                       die("unknown type of ledger");
+                                       break;
+                       }
+                       echo '</div>';
+                       //echo '<div style="display:block;height:15px"></div>';
+               } // end loop
+       }
 
-    } //else
-    echo "</table>";
-    // show the saldo
-
-    $solde=$Jrn->get_solde( $_GET['from_periode'],
-                            $_GET['to_periode']
-                          );
-    echo "solde d&eacute;biteur:".$solde[0]."<br>";
-    echo "solde cr&eacute;diteur:".$solde[1];
-
-    echo "</div>";
-    exit;
+       echo "</div>";
+       exit;
 }
 
 echo '</div>';

Modified: phpcompta/trunk/include/impress_poste.inc.php
===================================================================
--- phpcompta/trunk/include/impress_poste.inc.php       2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/impress_poste.inc.php       2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -280,7 +280,7 @@
             {
                 $Poste=new Acc_Account_Ledger ($cn,$poste_id['pcm_val']);
                 $Poste->load();
-                $Poste->get_row_date( $_GET['from_periode'], 
$_GET['to_periode']);
+                $Poste->get_row_date( $_GET['from_periode'], 
$_GET['to_periode'],$_GET['ople']);
                 if ( empty($Poste->row)) continue;
                 echo '<tr><td  class="mtitle" style="width:auto" 
colspan="6"><h2 class="info">'. $poste_id['pcm_val'].' 
'.h($Poste->label).'</h2></td></tr>';
 

Modified: phpcompta/trunk/include/lettering.account.inc.php
===================================================================
--- phpcompta/trunk/include/lettering.account.inc.php   2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/lettering.account.inc.php   2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -54,12 +54,25 @@
 list($first_per,$last_per)=$periode->get_limit($exercice);
 
 $start=new IDate('start');
+if ( isset ($_GET['start']) && isDate($_GET['start']) == null )
+{
+    echo alert(_('Date malformée, désolé'));
+       $_GET['start']=$first_per->first_day();
+
+}
 $start->value=(isset($_GET['start']))?$_GET['start']:$first_per->first_day();
+
 $r=td(_('Date début'));
 $r.=td($start->input());
 echo tr($r);
 
 $end=new IDate('end');
+if ( isset($_GET['end']) && isDate($_GET['end']) == null )
+{
+    echo alert(_('Date malformée, désolé'));
+       $_GET['end']=$last_per->last_day();
+
+}
 $end->value=(isset($_GET['end']))?$_GET['end']:$last_per->last_day();
 $r=td(_('Date fin'));
 $r.=td($end->input());

Modified: phpcompta/trunk/include/lettering.card.inc.php
===================================================================
--- phpcompta/trunk/include/lettering.card.inc.php      2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/lettering.card.inc.php      2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -57,13 +57,28 @@
 list($first_per,$last_per)=$periode->get_limit($exercice);
 
 $start=new IDate('start');
+if ( isset ($_GET['start']) && isDate($_GET['start']) == null )
+{
+    echo alert(_('Date malformée, désolé'));
+       $_GET['start']=$first_per->first_day();
+
+}
 $start->value=(isset($_GET['start']))?$_GET['start']:$first_per->first_day();
+
+
 $r=td(_('Date début'));
 $r.=td($start->input());
 echo tr($r);
 
 $end=new IDate('end');
+if ( isset($_GET['end']) && isDate($_GET['end']) == null )
+{
+    echo alert(_('Date malformée, désolé'));
+       $_GET['end']=$last_per->last_day();
+
+}
 $end->value=(isset($_GET['end']))?$_GET['end']:$last_per->last_day();
+
 $r=td(_('Date fin'));
 $r.=td($end->input());
 echo tr($r);
@@ -101,12 +116,8 @@
 // Show the result
 
//--------------------------------------------------------------------------------
 echo '<div id="list">';
-if ( isDate($_GET['start']) == null || isDate($_GET['end']) == null )
-{
-    echo alert(_('Date malformée, désolé'));
-    exit();
-}
 
+
 $letter=new Lettering_Card($cn);
 $quick_code=strtoupper(trim($_GET['acc']));
 $letter->set_parameter('quick_code',$quick_code);

Modified: phpcompta/trunk/include/menu.inc.php
===================================================================
--- phpcompta/trunk/include/menu.inc.php        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/menu.inc.php        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  *
  *
  * \brief Show the table menu and let you add your own

Modified: phpcompta/trunk/include/modele.inc.php
===================================================================
--- phpcompta/trunk/include/modele.inc.php      2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/modele.inc.php      2013-05-03 22:31:33 UTC (rev 
5216)
@@ -20,7 +20,8 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**
+ * \file
  *
  *
  * \brief concerne only the template

Modified: phpcompta/trunk/include/opening.inc.php
===================================================================
--- phpcompta/trunk/include/opening.inc.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/opening.inc.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -20,7 +20,7 @@
 /* $Revision$ */
 
 // Copyright Author Dany De Bontridder address@hidden
-/* !\file
+/**\file
  * \brief The opening of the exercices. it takes the saldo of the
  * choosen foolder / exercice and import it as a misc operation in the
  * current folder

Modified: phpcompta/trunk/include/operation_ods_confirm.inc.php
===================================================================
--- phpcompta/trunk/include/operation_ods_confirm.inc.php       2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/operation_ods_confirm.inc.php       2013-05-03 
22:31:33 UTC (rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  *
  *
  * \brief confirm ODS operation
@@ -34,7 +34,7 @@
 echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . 
'</h2>';
 echo '</div>';
 
-echo '<FORM METHOD="POST">';
+echo '<FORM METHOD="POST" class="print">';
 echo HtmlInput::request_to_hidden(array('ac'));
 echo $ledger->confirm($_POST,false);
 

Modified: phpcompta/trunk/include/operation_ods_new.inc.php
===================================================================
--- phpcompta/trunk/include/operation_ods_new.inc.php   2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/operation_ods_new.inc.php   2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -28,7 +28,7 @@
 require_once 'class_pre_op_ods.php';
 require_once 'class_iconcerned.php';
 
-global $g_user;
+global $g_user,$g_parameter;
 $cn=new Database(dossier::id());
 
 $id = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : -1;
@@ -59,7 +59,7 @@
 echo '</form>';
 echo '</div>';
 echo '<div id="jrn_name_div">';
-echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . 
'</h2>';
+echo '<h2 class="title" id="jrn_name" style="display:inline">' . 
$ledger->get_name() . '</h2>';
 echo '</div>';
 
 // Show the predef operation
@@ -107,8 +107,10 @@
 
 echo "<script>checkTotalDirect();</script>";
 
-echo create_script(" get_last_date()");
-
+if ($g_parameter->MY_DATE_SUGGEST=='Y')
+{
+       echo create_script(" get_last_date()");
+}
 echo '</div>';
 
 ?>

Modified: phpcompta/trunk/include/param_pcmn.inc.php
===================================================================
--- phpcompta/trunk/include/param_pcmn.inc.php  2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/param_pcmn.inc.php  2013-05-03 22:31:33 UTC (rev 
5216)
@@ -38,7 +38,8 @@
 
 include_once ("user_menu.php");
 
-echo '<div id="acc_update" style="border:1px solid 
blue;width:40%;display:none;background-color:lightgrey;padding:3;position:absolute;text-align:left;line-height:3em;z-index:1">';
+echo '<div id="acc_update" style="border:1px solid 
blue;width:40%;display:none;background-color:lightgrey;padding:0;position:absolute;text-align:left;z-index:1">';
+echo HtmlInput::title_box("Poste comptable", "acc_update", "hide");
 echo '<form method="post">';
 $val=new IText('p_valu');
 $parent=new IText('p_parentu');
@@ -249,11 +250,11 @@
 //echo HtmlInput::hidden('sa','detail');
 echo dossier::hidden();
 ?>
-<TABLE ALIGN="center" BORDER=0 CELLPADDING=0 CELLSPACING=0>
+<TABLE class="result">
                              <TR>
-                             <TH> Classe </TH>
+                             <TH> Poste comptable </TH>
                              <TH> Libellé </TH>
-                             <TH> Parent </TH>
+                             <TH> Poste comptable Parent </TH>
                              <TH> Type </TH>
                              </TR>
                              <?php
@@ -273,19 +274,21 @@
     if ( $i%2 == 0 )
     {
         $td ='<TD class="odd">';
+        $tr ='<TR class="odd">';
     }
     else
     {
         $td='<TD class="even">';
+        $tr='<TR class="even">';
     }
-    echo "<TR> ";
+    echo $tr;
     echo "$td";
     echo $A['pcm_val'];
     echo '</td>';
     echo "$td";
-    printf ("<A HREF=\"javascript:PcmnUpdate('%s','%s','%s','%s',%d)\">",
+    printf ("<A HREF=\"javascript:void(0)\" 
onclick=\"PcmnUpdate('%s','%s','%s','%s',%d)\">",
             $A['pcm_val'],
-            sql_string($A['pcm_lib']),
+                       str_replace("'","\'",$A['pcm_lib']),
             $A['pcm_val_parent'],
             $A['pcm_type'],
             dossier::id());

Modified: phpcompta/trunk/include/param_sec.inc.php
===================================================================
--- phpcompta/trunk/include/param_sec.inc.php   2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/param_sec.inc.php   2013-05-03 22:31:33 UTC (rev 
5216)
@@ -82,7 +82,7 @@
        echo '<th>'.$header->get_header(0).'</th>';
        echo '<th>'.$header->get_header(1).'</th>';
        echo th('prénom');
-       echo th('profile');
+       echo th('profil');
        echo '<th>'.$header->get_header(2).'</th>';
     for ($i = 0;$i < $MaxUser;$i++)
     {
@@ -269,7 +269,7 @@
        $i_profile->selected=$sec_User->get_profile();
 
        echo "<p>";
-       echo " Profile ".$i_profile->input();
+       echo _("Profil")." ".$i_profile->input();
        echo "</p>";
     echo '<Fieldset><legend>Journaux </legend>';
     echo '<table>';

Modified: phpcompta/trunk/include/pref.inc.php
===================================================================
--- phpcompta/trunk/include/pref.inc.php        2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/pref.inc.php        2013-05-03 22:31:33 UTC (rev 
5216)
@@ -18,7 +18,7 @@
  */
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
-/* !\file
+/**\file
  * \brief this file is always included and then executed
  *        it permits to change the user preferences
  * \see user_pref.php

Modified: phpcompta/trunk/include/profile.inc.php
===================================================================
--- phpcompta/trunk/include/profile.inc.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/profile.inc.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -218,7 +218,11 @@
                                $p_type = 'P';
                                $me_code_dep = -1;
                        }
-
+                       /**
+                        * Check if we don't add a menu depending on itself
+                        */
+                       if ( $me_code == $me_code_dep )
+                                throw new Exception("Un menu ne peut pas 
dépendre de lui-même");
                        $cn->start();
                        $me_code_dep = ($me_code_dep == -1) ? null : 
$me_code_dep;
                        $pm_default = (isset($pm_default)) ? 1 : 0;
@@ -244,7 +248,7 @@
 //****************************************************
 // Add a menu, module, submenu,plugin...
 //****************************************************
-if (isset($_POST['add_menu']))
+if (isset($_POST['add_menu']) || isset($_POST['add_impress']))
 {
        extract($_POST);
        try
@@ -276,6 +280,13 @@
                if ($inf > 0)
                        throw new Exception("Boucle infinie");
                /**
+                * Check if we don't add a menu depending on itself
+                */
+               if ( $me_code == $me_code_dep )
+                        throw new Exception("Un menu ne peut pas dépendre de 
lui-même");
+
+
+               /**
                 * if me_code_dep == -1, it means it is null
                 */
                $me_code_dep = ($me_code_dep == -1) ? null : $me_code_dep;

Modified: phpcompta/trunk/include/search.inc.php
===================================================================
--- phpcompta/trunk/include/search.inc.php      2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/search.inc.php      2013-05-03 22:31:33 UTC (rev 
5216)
@@ -90,7 +90,7 @@
 {
 
     // Navigation bar
-    $step=25;
+    $step=MAX_RECONCILE;
     $page=(isset($_GET['offset']))?$_GET['page']:1;
     $offset=(isset($_GET['offset']))?$_GET['offset']:0;
     if (count ($_GET) == 0)

Modified: phpcompta/trunk/include/template/action_search.php
===================================================================
--- phpcompta/trunk/include/template/action_search.php  2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/action_search.php  2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -59,6 +59,10 @@
                                        <?=$remind_date_end->input();?>
                                </td>
                        <tr>
+                       <tr>
+                               <td style="width:180px;text-align:right"> 
Affiche aussi les actions fermées</td>
+                               <td><?=$closed_action->input();?></td>
+                       </tr>
                        <td style="width:180px;text-align:right"> Référence</td>
                                <td>
                                        <?=$osag_ref->input();?>
@@ -75,7 +79,7 @@
                                <td ><?= $w->input() . $w->search()?><span 
id="<?=$label?>"></span></td>
                        <tr>
                        <tr>
-                               <td style="text-align:right" ><?= 
_("Profile")?></td>
+                               <td style="text-align:right" ><?= 
_("Profil")?></td>
                                <td><?= $str_ag_dest?></td>
                        </tr>
                        <tr>

Modified: phpcompta/trunk/include/template/dashboard.php
===================================================================
--- phpcompta/trunk/include/template/dashboard.php      2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/dashboard.php      2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -1,4 +1,4 @@
-<div style="float:left;width: 45%">
+<div style="float:left;width: 49%">
 <fieldset >
 <legend><?=_('Calendrier')?>
 </legend>
@@ -24,7 +24,7 @@
 $array=$todo->load_all();
 ?>
 
-<div style="float:right;width: 45%">
+<div style="float:right;width: 49%">
 <fieldset> <legend><?=_('Pense-Bête')?></legend>
 
 <?php
@@ -58,7 +58,7 @@
 </fieldset>
 </div>
 <div style="float:left;clear:both"></div>
-<div style="float:right;width: 45%">
+<div style="float:right;width: 49%">
 <? if (count($last_operation)> 0) : ?>
        <fieldset>
        <legend><?=_('Action pour aujourd\'hui')?>
@@ -68,6 +68,7 @@
        for($i=0;$i<count($last_operation);$i++):
        ?>
        <li>
+               
<?=HtmlInput::detail_action($last_operation[$i]['ag_id'],h($last_operation[$i]['ag_ref']))?>
        <span>
        <?=smaller_date($last_operation[$i]['ag_timestamp_fmt'])?>
        </span>
@@ -75,7 +76,7 @@
                        <?=h($last_operation[$i]['vw_name'])?>
                </span>
        <span>
-       <?=h(mb_substr($last_operation[$i]['ag_title'],0,60,'UTF-8'))?>
+       <?=h(mb_substr($last_operation[$i]['ag_title'],0,50,'UTF-8'))?>
        </span>
        <span style="font-style: italic">
        <?=$last_operation[$i]['dt_value']?>
@@ -95,6 +96,7 @@
        for($i=0;$i<count($late_operation);$i++):
        ?>
        <li>
+               
<?=HtmlInput::detail_action($late_operation[$i]['ag_id'],h($late_operation[$i]['ag_ref']))?>
        <span>
        <?=smaller_date($late_operation[$i]['ag_timestamp_fmt'])?>
        </span>
@@ -102,7 +104,7 @@
                        <?=h($late_operation[$i]['vw_name'])?>
                </span>
        <span>
-       <?=h(mb_substr($late_operation[$i]['ag_title'],0,60,'UTF-8'))?>
+       <?=h(mb_substr($late_operation[$i]['ag_title'],0,50,'UTF-8'))?>
        </span>
        <span style="font-style: italic">
        <?=$late_operation[$i]['dt_value']?>
@@ -113,7 +115,7 @@
        </fieldset>
 <? endif; ?>
 </div>
-       <div style="float:left;width: 45%">
+       <div style="float:left;width: 49%">
 <?php
 /*
  * Mini Report
@@ -161,7 +163,7 @@
 ?>
 </div>
 
-<div style="float:right;width: 45%">
+<div style="float:right;width: 49%">
 <fieldset>
 <legend><?=_('Dernières opérations')?>
 </legend>

Modified: phpcompta/trunk/include/template/detail-action.php
===================================================================
--- phpcompta/trunk/include/template/detail-action.php  2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/detail-action.php  2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -132,7 +132,7 @@
 </div>
 <div style="float:right;clear:both"></div>
        <div style="float:left;width:45%">
-               <h4 style="display:inline">Opérations</h4>
+               <h4 style="display:inline">Opérations concernées</h4>
                <ol>
 
                <?
@@ -156,7 +156,7 @@
 
                ?>
                </ol>
-               <? if ($p_view != 'READ') echo $iconcerned->input()?>
+               <? if ($p_view != 'READ')   echo '<span 
class="noprint">'.$iconcerned->input().'</span>';?>
        </div>
 
        <div style="float:left;width:45%">
@@ -187,13 +187,13 @@
 
                ?>
                </ol>
-               <? if ( $p_view != 'READ') echo $iaction->input()?>
+               <? if ( $p_view != 'READ') echo '<span 
class="noprint">'.$iaction->input().'</span>';?>
        </div>
 </fieldset>
-<fieldset>
-  <legend>
+<div style="margin-left:15px;margin-right: 15px">
+  <h1 class="legend">
            <?=_('Description')?>
-  </legend>
+  </h1>
   <p>
 <script language="javascript">
    function enlarge(p_id_textarea){
@@ -228,39 +228,64 @@
                                                dossier::id(),
                                                $acomment[$c]['agc_id']);
                                $js= '<a class="mtitle" style="color:orange" 
id="accom'.$acomment[$c]['agc_id'].'" href="'.$rmComment.'">Effacer</a>';
-               echo 
'n°'.$acomment[$c]['agc_id'].'('.h($acomment[$c]['tech_user'])." 
".smaller_date($acomment[$c]['str_agc_date']).')'.$js.
+               echo 
'n°'.$acomment[$c]['agc_id'].'('.h($acomment[$c]['tech_user'])." 
".$acomment[$c]['str_agc_date'].')'.$js.
                                '<pre style="white-space: 
-moz-pre-wrap;white-space: pre-wrap;border:1px solid blue;width:70%;" 
id="com'.$acomment[$c]['agc_id'].'"> '.
                                " ".h($acomment[$c]['agc_comment']).'</pre>'
                                ;
        }
        else
        {
-               echo 
'n°'.$acomment[$c]['agc_id'].'('.h($acomment[$c]['tech_user'])." 
".smaller_date($acomment[$c]['str_agc_date']).')'.
+               echo 
'n°'.$acomment[$c]['agc_id'].'('.h($acomment[$c]['tech_user'])." 
".$acomment[$c]['str_agc_date'].')'.
                                '<pre style="white-space: 
-moz-pre-wrap;white-space: pre-wrap;border:1px solid blue;width:70%;" 
id="com'.$acomment[$c]['agc_id'].'"> '.
                                " ".h($acomment[$c]['agc_comment']).'</pre>'
                                ;
 
        }
 }
+echo '<span class="noprint">';
 echo $desc->input();
+echo '</span>';
 ?>
 <? if ($p_view != "READ" ): ?>
+<p class="noprint">
 <input type="button" id="bt_enlarge" <?=$style_enl?> value="+" 
onclick="enlarge('ag_comment');return false;">
 <input type="button" id="bt_small"  <?=$style_small?> value="-" 
style="display:none" onclick="small('ag_comment');return false;">
+</p>
 <? endif; ?>
   </div>
-</fieldset>
-<input type='button' class="button" value='Montrer articles' id="toggleButton" 
onclick='toggleShowDetail()'>
+</div>
+<? if ( $p_base != 'ajax' ) :?>
+<input type='button' class="button" class="noprint" value='Montrer articles' 
id="toggleButton" onclick='toggleShowDetail()'>
+<? endif; ?>
+<?
+/**
+ * check if there card to show,
+ */
+$show_row=0;
+for ($i=0;$i<count($aArticle);$i++) :
+       if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ 
$show_row=1;break;}
+endfor;
+?>
+<?
+/*
+ * display detail if there card or if we are in UPDATE or NEW mode
+ */
+if ($show_row !=0 ) :
+
+       ?>
 <fieldset id="fldDetail" style='display:block'>
    <LEGEND> <?=_('Détail des articles')?>
 </LEGEND>
 <?php // hidden fields
+$show_row=0;
 for ($i=0;$i<count($aArticle);$i++) :
        echo $aArticle[$i]['ad_id'];
        echo $aArticle[$i]['hidden_tva'];
        echo $aArticle[$i]['hidden_htva'];
+       if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'){ 
$show_row=1;}
 endfor;
 ?>
+
 <table id="art" >
 <tr>
   <th><?=_('Fiche')?></th>
@@ -272,8 +297,11 @@
 <th><?=_('Montant TVAC')?></th>
 
 </tr>
-
 <?for ($i=0;$i<count($aArticle);$i++): ?>
+<?
+if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 'READ'):
+       $show_row++;
+       ?>
 <TR>
 <TD><?php echo $aArticle[$i]['fid'] ?></TD>
 <TD><?php echo $aArticle[$i]['desc'] ?></TD>
@@ -282,10 +310,11 @@
 <TD class="num"><?php echo $aArticle[$i]['tvaid'] ?></TD>
 <TD class="num"><?php echo $aArticle[$i]['tva'] ?></TD>
 <TD class="num"><?php echo $aArticle[$i]['tvac'] ?></TD>
-
 </TR>
+<? endif; ?>
 <?php endfor; ?>
 </table>
+
 <script language="JavaScript">
 if ( $('e_march0') && $('e_march0').value =='') { toggleShowDetail();}
 function toggleShowDetail() {
@@ -297,6 +326,7 @@
        }
 
 </script>
+<? if ( $show_row != 0 ): ?>
 <div style="float: left; text-align: right; padding-right: 5px; font-size: 
1.2em; font-weight: bold; color: blue;">
   <input name="act" id="act" class="button" value="<?=_('Actualiser')?>" 
onclick="compute_all_ledger();" type="button">
 
@@ -312,11 +342,12 @@
     <br>Total TVAC
  </div>
 </div>
-
+<? endif; ?>
 </fieldset>
+<?endif; ?>
 
 <? if ($p_view != 'READ' && $str_select_doc != '') : ?>
-<fieldset >
+<fieldset class="noprint" >
   <legend>
      <?=_('Document à générer')?>
   </legend>
@@ -331,11 +362,13 @@
   <legend>
      <?=_('Pièces attachées')?>
   </legend>
+  <div class="print">
+  <ol>
   <?php
 for ($i=0;$i<sizeof($aAttachedFile);$i++) :
   ?>
-  <p>
-    <A class="mtitle" id="<?php echo "doc".$aAttachedFile[$i]['d_id'];?>" 
href="<?php echo $aAttachedFile[$i]['link']?>"><?php echo 
$aAttachedFile[$i]['d_filename'];?>
+
+         <li> <A class="print" style="display:inline" id="<?php echo 
"doc".$aAttachedFile[$i]['d_id'];?>" href="<?php echo 
$aAttachedFile[$i]['link']?>"><?php echo $aAttachedFile[$i]['d_filename'];?>
     </A>
 <?php $rmDoc=sprintf("javascript:if ( confirm('"._('Voulez-vous effacer le 
document')." %s')==true ) {remove_document('%s','%s');}",
        $aAttachedFile[$i]['d_filename'],
@@ -343,10 +376,12 @@
        $aAttachedFile[$i]['d_id']);
     ?>
   <? if ($p_view != 'READ') : ?>  <a class="mtitle" style="color:orange" 
id="<?php echo "ac".$aAttachedFile[$i]['d_id'];?>" href="<?php echo 
$rmDoc;?>">Effacer</a><? endif;?>
-  </p>
+  </li>
   <?php
 endfor;
   ?>
+  </ol>
+  </div>
   <script language="javascript">
 function addFiles() {
 try {
@@ -358,17 +393,19 @@
 catch(exception) { alert('<?=j(_('Je ne peux pas ajouter de fichier'))?>'); 
alert(exception.message);}
 }
 </script>
-  <p >
-     <h3>Fichiers à ajouter: </h3>
-    <ol id='add_file' >
+<? if ($p_view != 'READ') : ?>
+  <div class="noprint">
+     <h3 >Fichiers à ajouter: </h3>
+    <ol id='add_file'  >
       <li>
         <?php echo $upload->input();
         ?>
       </li>
     </ol>
-  <span >
-<? if ($p_view != 'READ') : ?> <input type="button" class="button" 
onclick="addFiles();" value="Ajouter un fichier"> <? endif;?>
+  <span   >
+ <input type="button" class="button" onclick="addFiles();" value="Ajouter un 
fichier">
   </span>
-  </p>
+  </div>
+ <? endif;?>
 </fieldset>
 <script>compute_all_ledger()</script>
\ No newline at end of file

Modified: phpcompta/trunk/include/template/document_mod_change.php
===================================================================
--- phpcompta/trunk/include/template/document_mod_change.php    2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/document_mod_change.php    2013-05-03 
22:31:33 UTC (rev 5216)
@@ -18,7 +18,7 @@
  */
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  * \brief this file respond to an ajax request to modify a type of document
  */
 require_once 'class_document_type.php';

Modified: phpcompta/trunk/include/template/fiche_list.php
===================================================================
--- phpcompta/trunk/include/template/fiche_list.php     2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/fiche_list.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -28,7 +28,7 @@
 ?>
 <?= $bar?>
 <form method="POST" class="print" style="display:inline" onsubmit="return 
confirm('Vous confirmez ?')">
-       <table>
+       <table class="result">
                <tr>
                        <th>
                                Quick Code
@@ -37,13 +37,19 @@
                                Nom
 
                        </th>
+                       <? if ($allcard == 1 ) : ?>
                        <th>
+                               Catégorie
+                       </th>
+                       <? endif; ?>
+                       <th>
                                Selection
                        </th>
                </tr>
                <? for ($i = 0; $i < $nb_line; $i++) :?>
                        <? $row = Database::fetch_array($res, $i);?>
-                       <tr>
+                       <? $class=($i%2 == 0)?' class="even" ':' class="odd" 
';?>
+                       <tr <?=$class?> >
                                <td>
                                        <?= 
HtmlInput::card_detail($row['qcode'], "", ' class="line" ')?>
 
@@ -51,7 +57,12 @@
                                <td>
                                        <?= h($row['name'])?>
                                </td>
+                               <? if ($allcard == 1 ) : ?>
                                <td>
+                                       <?= h($row['fd_label'])?>
+                               </td>
+                               <? endif; ?>
+                               <td>
                                        <?
                                        if ($write == 1)
                                        {
@@ -65,6 +76,7 @@
 
 
        </table>
+       <?=$str_add_card?>
 <?=HtmlInput::hidden('action',"1");?>
 <?=HtmlInput::submit('delete','Effacer la sélection ')?>
 <? if ( $allcard ==  0  ): ?>
@@ -74,7 +86,6 @@
 $iselect->value=$cn->make_array("select fd_id,fd_label from fiche_def order by 
2");
 echo $iselect->input();
 ?>
-    
+
 <? endif ; ?>
-</form>
-<?= $bar?>
\ No newline at end of file
+</form>
\ No newline at end of file

Modified: phpcompta/trunk/include/template/form_ledger_detail.php
===================================================================
--- phpcompta/trunk/include/template/form_ledger_detail.php     2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/form_ledger_detail.php     2013-05-03 
22:31:33 UTC (rev 5216)
@@ -5,7 +5,7 @@
 <legend><?=$f_legend ?>
 </legend>
        <div id="jrn_name_div">
-       <h2 id="jrn_name"> <?=$this->get_name()?></h2>
+       <h2 class="title" id="jrn_name"> <?=$this->get_name()?></h2>
 </div>
       <?=_('Date').':'?> <?=$f_date ?> <?=_('Echeance')?> : <?=$f_echeance?>
 <?=$f_periode?><br>
@@ -22,13 +22,17 @@
 <tr>
 <th style="width:auto"colspan="2">Code <?=HtmlInput::infobulle(0)?></th>
       <th><?=_('Dénomination')?></th>
+<? if ($flag_tva =='Y') : ?>
       <th><?=_('prix/unité htva')?><?=HtmlInput::infobulle(6)?></th>
       <th><?=_('quantité')?></th>
       <th><?=_('Total HTVA')?></th>
-<? if ($flag_tva =='Y') : ?>
- <th><?=_('tva')?></th>
- <th><?=_('tot.tva')?></th>
-<th><?=_('tvac')?></th>
+         <th><?=_('tva')?></th>
+      <th><?=_('tot.tva')?></th>
+      <th><?=_('tvac')?></th>
+<? else: ?>
+         <th><?=_('prix/unité ')?><?=HtmlInput::infobulle(6)?></th>
+      <th><?=_('quantité')?></th>
+      <th><?=_('Total ')?></th>
 <? endif;?>
 
 

Modified: phpcompta/trunk/include/template/form_ledger_fin.php
===================================================================
--- phpcompta/trunk/include/template/form_ledger_fin.php        2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/form_ledger_fin.php        2013-05-03 
22:31:33 UTC (rev 5216)
@@ -1,6 +1,6 @@
 <fieldset>
        <div id="jrn_name_div">
-       <h2 id="jrn_name"> <?=$this->get_name()?></h2>
+       <h2 class="title" id="jrn_name"> <?=$this->get_name()?></h2>
 </div>
 <legend><?=$f_legend ?> </legend>
 <?

Modified: phpcompta/trunk/include/template/history_top.php
===================================================================
--- phpcompta/trunk/include/template/history_top.php    2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/history_top.php    2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -4,7 +4,7 @@
    {
      $callback=$_SERVER['PHP_SELF'];
      $str=$_SERVER['QUERY_STRING']."&act=de&ajax=$callback";
-     echo '<A id="close_div" HREF="javascript:void(0)" onclick="var 
a=window.open(\'popup.php?'.$str.'\',\'\',\'toolbar=0,width=600,height=400,scrollbars=yes,resizable=yes,status=0,location=0\');
 a.focus();removeDiv(\''.$div.'\')">
+     echo '<A id="close_div" HREF="javascript:void(0)" onclick="var 
a=window.open(\'popup.php?'.$str.'\',\'\',\'fullscreen=yes,location=no,toolbar=no,scrollbars=yes,resizable=yes,status=no,location=no\');
 a.focus();removeDiv(\''.$div.'\')">
 !pop me out ! </A>';
 echo '<A id="close_div" HREF="javascript:void(0)" 
onclick="removeDiv(\''.$div.'\');">Fermer</A>';
 }

Modified: phpcompta/trunk/include/template/ledger_detail_ach.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_ach.php      2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/ledger_detail_ach.php      2013-05-03 
22:31:33 UTC (rev 5216)
@@ -97,8 +97,8 @@
                                </tr>
 
 </table>
-
-<fieldset><legend><?=_('Détail')?></legend>
+<div class="myfieldset">
+       <h1 class="legend"><?=_('Détail')?></h1>
 <table class="result">
 <?
   bcscale(2);
@@ -161,7 +161,8 @@
     }
     $row.=td($input->input().$hidden);
     $row.=td($sym_tva,'style="text-align:center"');
-       $pu=bcdiv($q['qp_price'],$q['qp_quantite']);
+       $pu=0;
+       if ( $q['qp_quantite'] != 0 ) 
$pu=bcdiv($q['qp_price'],$q['qp_quantite']);
     $row.=td(nbm($pu),'class="num"');
     $row.=td(nbm($q['qp_quantite']),'class="num"');
 
@@ -178,10 +179,15 @@
 
     if ($owner->MY_TVA_USE=='Y')
       {
-       $tva_amount=bcadd($q['qp_vat'],$q['qp_nd_tva']);
-       $tva_amount=bcadd($tva_amount,$q['qp_nd_tva_recup']);
-       $row.=td(nbm($tva_amount),'class="num"');
-       $row.=td(nbm($tvac),'class="num"');
+               $tva_amount=bcadd($q['qp_vat'],$q['qp_nd_tva']);
+               $tva_amount=bcadd($tva_amount,$q['qp_nd_tva_recup']);
+               $class="";
+               if ($q['qp_vat_sided']<>0) {
+                       $class=' style="text-decoration:line-through"';
+                       $tvac=bcsub($tvac,$q['qp_vat']);
+               }
+               $row.=td(nbm($tva_amount),'class="num" '.$class);
+               $row.=td(nbm($tvac),'class="num"');
       }
     $total_tvac+=$tvac;
     $total_htva+=$htva;
@@ -205,9 +211,9 @@
 
   }
   if ($owner->MY_TVA_USE=='Y')
-         $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;widtg:auto" 
colspan="6"');
+         $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
   else
-         $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;widtg:auto" 
colspan="6"');
+         $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
 $row.=td(nbm($total_htva),'class="num" style="font-style:italic;font-weight: 
bolder;"');
 if ($owner->MY_TVA_USE=='Y')
   $row.=td("").td(nbm($total_tvac),'class="num" 
style="font-style:italic;font-weight: bolder;"');
@@ -216,12 +222,11 @@
 </table>
 
 
-</fieldset>
-<fieldset>
-<legend>
-<?=_('Ecritures comptables')?>
-</legend>
+</div>
+       <div class="myfieldset">
+       <h1 class="legend"><?=_('Ecritures comptables')?></h1>
 
+
 <?
   /* if it is not in a popup, the details are hidden */
   if ( $div != 'popup') {
@@ -284,7 +289,7 @@
 ?>
 </table>
 </div>
-</fieldset>
+</div>
 
 <?
 require_once('ledger_detail_bottom.php');

Modified: phpcompta/trunk/include/template/ledger_detail_bottom.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_bottom.php   2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/ledger_detail_bottom.php   2013-05-03 
22:31:33 UTC (rev 5216)
@@ -1,7 +1,8 @@
-<fieldset>
-<legend>
+<div class="myfieldset">
+
+<h1 class="legend">
 <? echo _('Rapprochement');?>
-</legend>
+</h1>
 <?
 $oRap=new Acc_Reconciliation($cn);
 $oRap->jr_id=$jr_id;
@@ -36,17 +37,45 @@
   echo '</table>';
 }
 ?>
-</legend>
 <?
 if ( $access=='W') {
      $wConcerned=new IConcerned("rapt".$div);
      $wConcerned->amount_id=$obj->det->jr_montant;
-    echo $wConcerned->input();    
-    
+    echo $wConcerned->input();
+
 }
+?>
+</div>
+<?
+$array = Follow_Up::get_all_operation($jr_id);
+if (count($array) > 0)
+{
+       ?>
+       <div class="myfieldset">
+               <h1 class="legend">Actions liées</h1>
+       <?
+       /**
+        * show eventually action
+        */
+       $array = Follow_Up::get_all_operation($jr_id);
+       echo '<ul style="list-style-type:square;">';
+       for ($i = 0; $i < count($array); $i++)
+       {
+               if ( $div == 'popup')
+               {
+                       echo 
'<li>'.HtmlInput::detail_action($array[$i]['ag_id'], h($array[$i]['ag_ref']." 
".$array[$i]['ag_title']),0).'</li>';
+               }
+               else
+               {
+                       echo 
'<li>'.HtmlInput::detail_action($array[$i]['ag_id'], h($array[$i]['ag_ref']." 
".$array[$i]['ag_title']),1).'</li>';
+               }
+       }
+       echo '</ul>';
 
+       echo '</div>';
+}
 ?>
-</fieldset>
+
 <?
 
 require_once('template/ledger_detail_file.php');
@@ -62,7 +91,12 @@
 }
 
 ?>
-<?if ( $access=='W') {
+<?
+
+/**
+ * if you can write
+ */
+  if ( $access=='W') {
   echo HtmlInput::submit('save',_('Sauver'),'onClick="return 
verify_ca(\'popup\');"');
   $owner=new Own($cn);
   if ($owner->MY_ANALYTIC != 'nu' && $div=='popup'){

Modified: phpcompta/trunk/include/template/ledger_detail_fin.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_fin.php      2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/ledger_detail_fin.php      2013-05-03 
22:31:33 UTC (rev 5216)
@@ -88,14 +88,14 @@
 </table>
 
 </td>
-<fieldset>
-<legend>
+<div class="myfieldset">
+       <h1 class="legend">
 <?=_('Détail')?>
 <?
   $detail=new Acc_Misc($cn,$obj->jr_id);
 $detail->get();
 ?>
-</legend>
+</h1>
 <table class="result">
 <tr>
 <?
@@ -168,7 +168,7 @@
   }
 ?>
 </table>
-</fieldset>
+</div>
 <?
 require_once('ledger_detail_bottom.php');
 ?>

Modified: phpcompta/trunk/include/template/ledger_detail_misc.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_misc.php     2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/ledger_detail_misc.php     2013-05-03 
22:31:33 UTC (rev 5216)
@@ -72,14 +72,12 @@
 </tr>
 </table>
 
-<fieldset>
-<legend>
-<?=_('Détail')?>
+<div class="myfieldset">
+       <h1 class="legend"><?=_('Détail')?></h1>
 <?
   require_once('class_own.php');
   $owner=new Own($cn);
 ?>
-</legend>
 <table class="result">
 <tr>
 <?
@@ -152,7 +150,7 @@
     /* Analytic accountancy */
     if ( $owner->MY_ANALYTIC != "nu" && $div=='popup'){
       if ( preg_match('/^(6|7)/',$q[$e]['j_poste'])) {
-       
+
        echo HtmlInput::hidden("amount_t".$amount_idx,$q[$e]['j_montant']);
        $anc_op=new Anc_Operation($cn);
        $anc_op->j_id=$q[$e]['j_id'];
@@ -168,8 +166,7 @@
   }
 ?>
 </table>
-</fieldset>
-
+</div>
 <?
 require_once('ledger_detail_bottom.php');
 ?>

Modified: phpcompta/trunk/include/template/ledger_detail_top.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_top.php      2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/ledger_detail_top.php      2013-05-03 
22:31:33 UTC (rev 5216)
@@ -3,7 +3,7 @@
    if ($div != "popup") {
      $callback=$_SERVER['PHP_SELF'];
      $str=$_SERVER['QUERY_STRING']."&act=$action&ajax=$callback";
-     echo '<A id="close_div" HREF="javascript:void(0)" onclick="var 
a=window.open(\'popup.php?'.$str.'\',\'\',\'toolbar=0,width=600,height=400,scrollbars=yes,resizable=yes,status=0,location=0\');
 a.focus();removeDiv(\''.$div.'\')">
+     echo '<A id="close_div" HREF="javascript:void(0)" onclick="var 
a=window.open(\'popup.php?'.$str.'\',\'\',\'location=no,toolbar=no,fullscreen=yes,scrollbars=yes,resizable=yes,status=no\');
 a.focus();removeDiv(\''.$div.'\')">
 !pop me out ! </A>';
      echo '<A id="close_div" HREF="javascript:void(0)" 
onclick="removeDiv(\''.$div.'\');">Fermer</A>';
    }

Modified: phpcompta/trunk/include/template/ledger_detail_ven.php
===================================================================
--- phpcompta/trunk/include/template/ledger_detail_ven.php      2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/ledger_detail_ven.php      2013-05-03 
22:31:33 UTC (rev 5216)
@@ -97,8 +97,10 @@
 </td>
 </tr>
 </table>
-
-<fieldset><legend><?=_('Détail')?></legend>
+<div class="myfieldset">
+       <h1 class="legend">
+<?=_('Détail')?>
+       </h1>
 <table class="result">
 <?
   bcscale(2);
@@ -152,7 +154,8 @@
 
     $row.=td($input->input().$hidden);
     $sym_tva='';
-       $pu=bcdiv($q['qs_price'],$q['qs_quantite']);
+       $pu=0;
+       if ($q['qs_quantite'] != 0)     
$pu=bcdiv($q['qs_price'],$q['qs_quantite']);
     $row.=td(nbm($pu),'class="num"');
     $row.=td(nbm($q['qs_quantite']),'class="num"');
        $sym_tva='';
@@ -172,8 +175,13 @@
     $tvac=bcadd($htva,$q['qs_vat']);
     if ($owner->MY_TVA_USE=='Y')
       {
-       $row.=td(nbm($q['qs_vat']),'class="num"');
-       $row.=td(nbm($tvac),'class="num"');
+               $class="";
+               if ($q['qs_vat_sided'] != 0) {
+                       $class=' style="text-decoration:line-through"';
+                       $tvac=bcsub($tvac,$q['qs_vat']);
+               }
+               $row.=td(nbm($q['qs_vat']),'class="num"'.$class);
+               $row.=td(nbm($tvac),'class="num"');
       }
     $total_tvac=bcadd($total_tvac,$tvac);
     $total_htva=bcadd($total_htva,$htva);
@@ -212,13 +220,12 @@
 </td>
 </tr>
 </table>
-
-</fieldset>
-<fieldset>
-<legend>
+</div>
+<div class="myfieldset">
+       <h1 class="legend">
 <?=_('Ecritures comptables')?>
-</legend>
-<?
+       </h1>
+       <?
   /* if it is not in a popup, the details are hidden */
   if ( $div != 'popup') {
     $ib=new IButton ("a".$div);
@@ -281,7 +288,7 @@
 ?>
 </table>
 </div>
-</fieldset>
+</div>
 <?
 require_once('ledger_detail_bottom.php');
 ?>

Modified: phpcompta/trunk/include/template/letter_all.php
===================================================================
--- phpcompta/trunk/include/template/letter_all.php     2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/letter_all.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -11,7 +11,7 @@
 
 <?      exit();
 endif;?>
-<table class="result">
+  <table class="result">
 <tr>
 <th>
    <?=_('Lettrage')?>
@@ -28,14 +28,14 @@
 <th>
    <?=_('Description')?>
 </th>
-<th>
-   <?=_('Montant')?>
+<th style="text-align:right">
+   <?=_('Débit')?>
 </th>
-<th>
-   <?=_('Debit / Credit')?>
+<th style="text-align:right">
+   <?=_('Crédit')?>
 </th>
-<th>
-  <?=_('Op. concerné')?>
+<th style="text-align:center">
+  <?=_('Op. concernée')?>
 </th>
 </tr>
 
@@ -47,14 +47,14 @@
   <tr <? echo "class=\"$class\""; ?> >
 <td>
 <?php
-$letter=($this->content[$i]['letter']==-1)?"x":$this->content[$i]['letter'];
+$letter=($this->content[$i]['letter']==-1)?" aucun lettrage 
":strtoupper(base_convert($this->content[$i]['letter'],10,36));
 $js="this.gDossier=".dossier::id().
   ";this.j_id=".$this->content[$i]['j_id'].
   ";this.obj_type='".$this->object_type."'".
   ";dsp_letter(this)";
 
 ?>
-<A class="detail" href="javascript:<?=$js?>"><?=$letter?>
+<A class="detail" style="text-decoration: underline" 
href="javascript:<?=$js?>"><?=$letter?>
 <? if ( $this->content[$i]['letter_diff'] != 0) echo $g_failed;        ?>
        </A>
 </td>
@@ -67,9 +67,14 @@
 ?>
   <td> <?=$r?> </td>
   <td> <?=h($this->content[$i]['jr_comment'])?> </td>
+  <? if ($this->content[$i]['j_debit']=='t') : ?>
   <td style="text-align:right"> <?=nb($this->content[$i]['j_montant'])?> </td>
-<td> <?=($this->content[$i]['j_debit']=='t')?'D':'C'?> </td>
-<td>
+  <td></td>
+  <? else : ?>
+  <td></td>
+  <td style="text-align:right"> <?=nb($this->content[$i]['j_montant'])?> </td>
+  <? endif ?>
+<td style="text-align:center">
 <?php
     // Rapprochement
     $rec=new Acc_Reconciliation($this->db);
@@ -97,14 +102,14 @@
     endfor;
 ?>
 </table>
-<h2 class="info2" style="margin:0 0"> Solde débit  : <?=nb($amount_deb);?>
-<h2 class="info2"  style="margin:0 0"> Solde crédit : <?=nb($amount_cred);?>
+<h2 class="info2" style="margin:0 0"> Solde débit  : <?=nb($amount_deb);?></h2>
+<h2 class="info2"  style="margin:0 0"> Solde crédit : 
<?=nb($amount_cred);?></h2>
   <?
 bcscale(2);
   $solde=bcsub($amount_deb,$amount_cred);
 if ( $solde > 0 ) :
 ?>
-  <h2 class="info2"  style="margin:0 0"> Solde débiteur       : <?=nb($solde)?>
+  <h2 class="info2"  style="margin:0 0"> Solde débiteur       : 
<?=nb($solde)?></h2>
 <? else : ?>
-     <h2 class="info2"  style="margin:0 0"> Solde créditeur       : 
<?=nb(abs($solde))?>
+     <h2 class="info2"  style="margin:0 0"> Solde créditeur       : 
<?=nb(abs($solde))?></h2>
 <? endif; ?>

Modified: phpcompta/trunk/include/template/letter_prop.php
===================================================================
--- phpcompta/trunk/include/template/letter_prop.php    2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/letter_prop.php    2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -3,7 +3,6 @@
 require_once ('class_acc_reconciliation.php');
 
 $gDossier=dossier::id();
-
 if ( count($this->content) == 0 ) :
 ?>
   <h2 class="info2"><?=_('Désolé aucun résultat trouvé')?></h2>
@@ -27,14 +26,14 @@
 <th>
    <?=_('Description')?>
 </th>
-<th>
-   <?=_('Montant')?>
+<th style="text-align:right">
+   <?=_('Débit')?>
 </th>
-<th>
-   <?=_('Debit / Credit')?>
+<th style="text-align:right">
+   <?=_('Crédit')?>
 </th>
-<th>
-  <?=_('Op. concerné')?>
+<th style="text-align:center">
+  <?=_('Op. concernée')?>
 </th>
 </tr>
 
@@ -67,14 +66,14 @@
 <th>
    <?=_('Description')?>
 </th>
-<th>
-   <?=_('Montant')?>
+<th style="text-align:right">
+   <?=_('Débit')?>
 </th>
-<th>
-   <?=_('Debit / Credit')?>
+<th style="text-align:right">
+   <?=_('Crédit')?>
 </th>
-<th>
-  <?=_('Op. concerné')?>
+<th style="text-align:center">
+  <?=_('Op. concernée')?>
 </th>
 </tr>
 <?
@@ -98,7 +97,7 @@
 </td>
 <td>
 <?php
-$letter=($this->content[$i]['letter']< 0)?" ":$this->content[$i]['letter'];
+$letter=($this->content[$i]['letter']< 0)?" 
":strtoupper(base_convert($this->content[$i]['letter'],10,36));
 ?>
 <?=$letter?>
 </td>
@@ -109,9 +108,14 @@
 ?>
 <td> <?=$r?> </td>
 <td> <?=$this->content[$i]['jr_comment']?> </td>
-  <td> <?=nb($this->content[$i]['j_montant'])?> </td>
-<td> <?=($this->content[$i]['j_debit']=='t')?'D':'C'?> </td>
-<td>
+ <? if ($this->content[$i]['j_debit']=='t') : ?>
+  <td style="text-align:right"> <?=nb($this->content[$i]['j_montant'])?> </td>
+  <td></td>
+  <? else : ?>
+  <td></td>
+  <td style="text-align:right"> <?=nb($this->content[$i]['j_montant'])?> </td>
+  <? endif ?>
+<td style="text-align:center">
 <?php
     // Rapprochement
     $rec=new Acc_Reconciliation($this->db);

Modified: phpcompta/trunk/include/template/module.php
===================================================================
--- phpcompta/trunk/include/template/module.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/template/module.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -78,7 +78,8 @@
                                
$url="do.php?gDossier=".Dossier::id()."&ac=".$row['me_code'];
                    }
                    ?>
-               <td class="tool" style="<?=$style?>"><a class="mtitle" 
href="<?=$url?>" title="<?=_($row['me_description'])?>" <?=$js?> 
><?=_($row['me_menu'])?></td>
+               <td class="tool" style="<?=$style?>">
+                       <a class="mtitle" href="<?=$url?>" 
title="<?=_($row['me_description'])?>" <?=$js?> 
><?=_($row['me_menu'])?></a></td>
                <?
                    endforeach;
                ?>

Copied: phpcompta/trunk/include/template/operation_detail_ach.php (from rev 
5215, phpcompta/tags/rel650/include/template/operation_detail_ach.php)
===================================================================
--- phpcompta/trunk/include/template/operation_detail_ach.php                   
        (rev 0)
+++ phpcompta/trunk/include/template/operation_detail_ach.php   2013-05-03 
22:31:33 UTC (rev 5216)
@@ -0,0 +1,124 @@
+<?php
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief show detail of a operation of purchase
+ *
+ */
+global $g_parameter;
+?>
+<table class="result" >
+       <?
+       bcscale(2);
+       $total_htva = 0;
+       $total_tvac = 0;
+       echo th(_('Quick Code'));
+       echo th(_('Description'));
+       if ($g_parameter->MY_TVA_USE == 'Y')
+       {
+               echo th(_('Taux TVA'), 'style="text-align:right"');
+       }
+       else
+       {
+               echo th('');
+       }
+       echo th(_('Prix/Un.'), 'style="text-align:right"');
+       echo th(_('Quantité'), 'style="text-align:right"');
+       echo th(_('Personnel'), 'style="text-align:right"');
+       echo th(_('Non ded'), 'style="text-align:right"');
+
+       if ($g_parameter->MY_TVA_USE == 'Y')
+       {
+               echo th(_('HTVA'), 'style="text-align:right"');
+               echo th(_('TVA'), 'style="text-align:right"');
+               echo th(_('TVAC'), 'style="text-align:right"');
+       }else
+               echo th(_('Total'), 'style="text-align:right"');
+
+       echo '</tr>';
+       for ($e = 0; $e < count($obj->det->array); $e++)
+       {
+               $row = '';
+               $q = $obj->det->array[$e];
+               $fiche = new Fiche($cn, $q['qp_fiche']);
+               $view_card_detail = 
HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE), "", ' 
class="line" ');
+               $row = td($view_card_detail);
+               $sym_tva = '';
+
+               if ($g_parameter->MY_TVA_USE == 'Y' && $q['qp_vat_code'] != '')
+               {
+                       /* retrieve TVA symbol */
+                       $tva = new Acc_Tva($cn, $q['qp_vat_code']);
+                       $tva->load();
+                       $sym_tva = h($tva->get_parameter('label'));
+               }
+               $input = new ISpan("e_march" . $q['j_id'] . "_label");
+               $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
+               $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
+               $row.=td($input->input() . $hidden);
+               $row.=td($sym_tva, 'style="text-align:center"');
+               $pu = 0;
+               if ($q['qp_quantite'] != 0)
+                       $pu = bcdiv($q['qp_price'], $q['qp_quantite']);
+               $row.=td(nbm($pu), 'class="num"');
+               $row.=td(nbm($q['qp_quantite']), 'class="num"');
+
+               $no_ded = $q['qp_nd_amount'];
+               $row.=td(nbm($q['qp_dep_priv']), 'style="text-align:right"');
+               $row.=td(nbm($no_ded), ' style="text-align:right"');
+               $htva = $q['qp_price'];
+
+
+               $row.=td(nbm($htva), 'class="num"');
+               $tvac = bcadd($htva, $q['qp_vat']);
+               $tvac = bcadd($tvac, $q['qp_nd_tva']);
+               $tvac = bcadd($tvac, $q['qp_nd_tva_recup']);
+
+
+               if ($g_parameter->MY_TVA_USE == 'Y')
+               {
+                       $tva_amount = bcadd($q['qp_vat'], $q['qp_nd_tva']);
+                       $tva_amount = bcadd($tva_amount, $q['qp_nd_tva_recup']);
+                       $class = "";
+                       if ($q['qp_vat_sided'] <> 0)
+                       {
+                               $class = ' 
style="text-decoration:line-through"';
+                               $tvac = bcsub($tvac, $q['qp_vat']);
+                       }
+                       $row.=td(nbm($tva_amount), 'class="num" ' . $class);
+                       $row.=td(nbm($tvac), 'class="num"');
+               }
+               $total_tvac+=$tvac;
+               $total_htva+=$htva;
+               echo tr($row);
+       }
+       if ($g_parameter->MY_TVA_USE == 'Y')
+               $row = td(_('Total'), ' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
+       else
+               $row = td(_('Total'), ' 
style="font-style:italic;text-align:right;font-weight: bolder;width:auto" 
colspan="6"');
+       $row.=td(nbm($total_htva), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
+       if ($g_parameter->MY_TVA_USE == 'Y')
+               $row.=td("") . td(nbm($total_tvac), 'class="num" 
style="font-style:italic;font-weight: bolder;"');
+       echo tr($row);
+       ?>
+</table>

Copied: phpcompta/trunk/include/template/operation_detail_fin.php (from rev 
5215, phpcompta/tags/rel650/include/template/operation_detail_fin.php)
===================================================================
--- phpcompta/trunk/include/template/operation_detail_fin.php                   
        (rev 0)
+++ phpcompta/trunk/include/template/operation_detail_fin.php   2013-05-03 
22:31:33 UTC (rev 5216)
@@ -0,0 +1,50 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief show detail of a operation of fin
+ *
+ */
+echo '<table class="result">';
+echo '<tr>';
+echo th('Compte en banque');
+echo th('Tiers');
+echo th('Libellé');
+echo th('Montant');
+echo '</tr>';
+
+echo '<tr>';
+$bk = new Fiche($cn, $obj->det->array[0]['qf_bank']);
+$view_card_detail = HtmlInput::card_detail($bk->get_quick_code(), 
h($bk->getName()), ' class="line" ');
+echo  td($view_card_detail);
+$other = new Fiche($cn, $obj->det->array[0]['qf_other']);
+$view_card_detail = HtmlInput::card_detail($other->get_quick_code(), 
h($other->getName()), ' class="line" ');
+echo  td($view_card_detail);
+$comment = strip_tags($obj->det->jr_comment);
+echo  td($comment);
+echo td(nbm($obj->det->array[0]['qf_amount']), ' class="inum"');
+echo '</tr>';
+echo '</table>';
+?>
+

Copied: phpcompta/trunk/include/template/operation_detail_misc.php (from rev 
5215, phpcompta/tags/rel650/include/template/operation_detail_misc.php)
===================================================================
--- phpcompta/trunk/include/template/operation_detail_misc.php                  
        (rev 0)
+++ phpcompta/trunk/include/template/operation_detail_misc.php  2013-05-03 
22:31:33 UTC (rev 5216)
@@ -0,0 +1,86 @@
+<?php
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief how detail of a misc operation
+ *
+ */
+?>
+<table class="result">
+<tr>
+<?
+    echo th(_('Poste Comptable'));
+    echo th(_('Quick Code'));
+    echo th(_('Libellé'));
+echo th(_('Débit'), 'style="text-align:right"');
+echo th(_('Crédit'), 'style="text-align:right"');
+echo '</tr>';
+$amount_idx=0;
+for ($e = 0; $e < count($obj->det->array); $e++)
+{
+       $row = '';
+       $q = $obj->det->array;
+       $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_account(\'%s\',\'%s\')" >%s</A>', 
$q[$e]['j_poste'], $gDossier, $q[$e]['j_poste']);
+
+       $row.=td($view_history);
+
+       if ($q[$e]['j_qcode'] != '')
+       {
+               $fiche = new Fiche($cn);
+               $fiche->get_by_qcode($q[$e]['j_qcode']);
+               $view_history = sprintf('<A class="detail" 
style="text-decoration:underline" 
HREF="javascript:view_history_card(\'%s\',\'%s\')" >%s</A>', $fiche->id, 
$gDossier, $q[$e]['j_qcode']);
+       }
+       else
+               $view_history = '';
+       $row.=td($view_history);
+       $l_lib = $q[$e]['j_text'];
+
+       if ($l_lib != '')
+       {
+               $l_lib = $q[$e]['j_text'];
+       }
+       else if ($q[$e]['j_qcode'] != '')
+       {
+               // nom de la fiche
+               $ff = new Fiche($cn);
+               $ff->get_by_qcode($q[$e]['j_qcode']);
+               $l_lib = $ff->strAttribut(ATTR_DEF_NAME);
+       }
+       else
+       {
+               // libellé du compte
+               $name = $cn->get_value('select pcm_lib from tmp_pcmn where 
pcm_val=$1', array($q[$e]['j_poste']));
+               $l_lib = $name;
+       }
+       $l_lib = strip_tags($l_lib);
+       $input = new ISpan("e_march" . $q[$e]['j_id'] . "_label");
+       $input->value = $l_lib;
+       $hidden = HtmlInput::hidden("j_id[]", $q[$e]['j_id']);
+       $row.=td($input->input() . $hidden);
+       $montant = td(nbm($q[$e]['j_montant']), 'class="num"');
+       $row.=($q[$e]['j_debit'] == 't') ? $montant : td('');
+       $row.=($q[$e]['j_debit'] == 'f') ? $montant : td('');
+       echo tr($row);
+}
+?>
+</table>
\ No newline at end of file

Copied: phpcompta/trunk/include/template/operation_detail_ven.php (from rev 
5215, phpcompta/tags/rel650/include/template/operation_detail_ven.php)
===================================================================
--- phpcompta/trunk/include/template/operation_detail_ven.php                   
        (rev 0)
+++ phpcompta/trunk/include/template/operation_detail_ven.php   2013-05-03 
22:31:33 UTC (rev 5216)
@@ -0,0 +1,107 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief show detail of a operation of sale
+ *
+ */
+global $g_parameter;
+?>
+<table class="result">
+<?
+  bcscale(2);
+  $total_htva=0;$total_tvac=0;
+  echo th(_('Quick Code'));
+echo th(_('Description'));
+echo th(_('Prix/Un'), 'style="text-align:right"');
+echo th(_('Quantité'), 'style="text-align:right"');
+if ( $g_parameter->MY_TVA_USE == 'Y')
+  echo th(_('Taux TVA'), 'style="text-align:right"');
+else
+  echo th('');
+if ( $g_parameter->MY_TVA_USE == 'Y') {
+  echo th(_('HTVA'), 'style="text-align:right"');
+  echo th(_('TVA'), 'style="text-align:right"');
+  echo th(_('TVAC'), 'style="text-align:right"');
+} else
+  echo th(_('Total'), 'style="text-align:right"');
+
+
+echo '</tr>';
+  for ($e=0;$e<count($obj->det->array);$e++) {
+    $row='';
+    $q=$obj->det->array[$e];
+    $fiche=new Fiche($cn,$q['qs_fiche']);
+       
$view_card_detail=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),"",
 ' class="line" ');
+       $row.=td($view_card_detail);
+        $input = new ISpan("e_march" . $q['j_id'] . "_label");
+        $hidden = HtmlInput::hidden("j_id[]", $q['j_id']);
+        $input->value = $fiche->strAttribut(ATTR_DEF_NAME);
+
+    $row.=td($input->input().$hidden);
+    $sym_tva='';
+       $pu=0;
+       if ($q['qs_quantite'] != 0)     
$pu=bcdiv($q['qs_price'],$q['qs_quantite']);
+    $row.=td(nbm($pu),'class="num"');
+    $row.=td(nbm($q['qs_quantite']),'class="num"');
+       $sym_tva='';
+   if ( $g_parameter->MY_TVA_USE=='Y' && $q['qs_vat_code'] != '') {
+     /* retrieve TVA symbol */
+     $tva=new Acc_Tva($cn,$q['qs_vat_code']);
+     $tva->load();
+     $sym_tva=(h($tva->get_parameter('label')));
+     //     $sym_tva=$sym
+   }
+
+   $row.=td($sym_tva,'style="text-align:center"');
+
+    $htva=$q['qs_price'];
+
+    $row.=td(nbm($htva),'class="num"');
+    $tvac=bcadd($htva,$q['qs_vat']);
+    if ($g_parameter->MY_TVA_USE=='Y')
+      {
+               $class="";
+               if ($q['qs_vat_sided'] != 0) {
+                       $class=' style="text-decoration:line-through"';
+                       $tvac=bcsub($tvac,$q['qs_vat']);
+               }
+               $row.=td(nbm($q['qs_vat']),'class="num"'.$class);
+               $row.=td(nbm($tvac),'class="num"');
+      }
+    $total_tvac=bcadd($total_tvac,$tvac);
+    $total_htva=bcadd($total_htva,$htva);
+    echo tr($row);
+
+  }
+  if ($g_parameter->MY_TVA_USE=='Y')
+       $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
+  else
+       $row= td(_('Total'),' 
style="font-style:italic;text-align:right;font-weight: bolder;" colspan="5"');
+$row.=td(nbm($total_htva),'class="num" style="font-style:italic;font-weight: 
bolder;"');
+if ($g_parameter->MY_TVA_USE=='Y')
+  $row.=td("").td(nbm($total_tvac),'class="num" 
style="font-style:italic;font-weight: bolder;"');
+echo tr($row);
+?>
+</table>
\ No newline at end of file

Modified: phpcompta/trunk/include/template/periode_add_exercice.php
===================================================================
--- phpcompta/trunk/include/template/periode_add_exercice.php   2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/periode_add_exercice.php   2013-05-03 
22:31:33 UTC (rev 5216)
@@ -2,8 +2,11 @@
 <ul>
 <li>
 Exercice en 12 périodes : Ajout d'un exercice comptable de 12 périodes, 
commençant le 1 janvier et terminant le 31 décembre. </li>
-<li>   Exercice en 13 périodes: Ajout d'une période d'un jour le 31/12. Cette 
période est utilisée 
+<li>   Exercice en 13 périodes: Ajout d'une période d'un jour le 31/12. Cette 
période est utilisée
 pour faire toutes les écritures de fin d'exercice: amortissements, régulations 
de compte... Avec une 13ième période, cela simplifie les prévisions, les 
rapports...</li>
+<li>
+       Pour ajouter des années, ne commençant pas en janvier ou comptant un 
nombre de mois supérieur à 12, utilisez le plugin "Outils Comptables"
+</li>
 </ul>
 
 <form method="post" onsubmit="return confirm('Confirmez vous l\'ajout d\'un 
exercice comptable ?')">

Modified: phpcompta/trunk/include/template/search_top.php
===================================================================
--- phpcompta/trunk/include/template/search_top.php     2013-05-03 21:56:40 UTC 
(rev 5215)
+++ phpcompta/trunk/include/template/search_top.php     2013-05-03 22:31:33 UTC 
(rev 5216)
@@ -21,7 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 
-/* !\file
+/**\file
  *
  *
  * \brief

Modified: phpcompta/trunk/include/template/user_sec_profile.php
===================================================================
--- phpcompta/trunk/include/template/user_sec_profile.php       2013-05-03 
21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/template/user_sec_profile.php       2013-05-03 
22:31:33 UTC (rev 5216)
@@ -32,7 +32,7 @@
        <?=HtmlInput::hidden("p_id", $p_id);?>
        <table>
                <tr>
-                       <th><?=_("Profile")?></th>
+                       <th><?=_("Profil")?></th>
                        <th><?=_("Accès")?></th>
                </tr>
                <? for ($i=0;$i<count($array);$i++): ?>

Modified: phpcompta/trunk/include/tfpdf/tfpdf.php
===================================================================
--- phpcompta/trunk/include/tfpdf/tfpdf.php     2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/tfpdf/tfpdf.php     2013-05-03 22:31:33 UTC (rev 
5216)
@@ -1279,7 +1279,7 @@
                if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents()))
                {
                        // It contains only a UTF-8 BOM and/or whitespace, 
let's clean it
-                       ob_clean();
+                       ob_end_clean();
                }
                else
                        $this->Error("Some data has already been output, can't 
send PDF file");

Modified: phpcompta/trunk/include/tva.inc.php
===================================================================
--- phpcompta/trunk/include/tva.inc.php 2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/include/tva.inc.php 2013-05-03 22:31:33 UTC (rev 5216)
@@ -18,7 +18,7 @@
  */
 /* $Revision$ */
 // Copyright Author Dany De Bontridder address@hidden
-/* ! \file
+/** \file
  * \brief included file for customizing with the vat (account,rate...)
  */
 require_once('class_own.php');
@@ -100,6 +100,7 @@
 ?>
 <TABLE>
     <TR>
+        <th>Id</th>
        <th>Label</TH>
        <th>Taux</th>
        <th>Commentaire</th>
@@ -123,8 +124,10 @@
     echo "<TR>";
     echo '<FORM METHOD="POST">';
 
+    echo '<td>';
+    echo $row['tva_id'];
+    echo '</td>';
 
-
     echo "<TD>";
     echo HtmlInput::hidden('tva_id', $row['tva_id']);
     echo h($row['tva_label']);

Modified: phpcompta/trunk/include/user_detail.inc.php
===================================================================
--- phpcompta/trunk/include/user_detail.inc.php 2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/user_detail.inc.php 2013-05-03 22:31:33 UTC (rev 
5216)
@@ -17,7 +17,7 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 // Copyright Author Dany De Bontridder address@hidden
-/* ! \file
+/** \file
  * \brief Users Security
  */
 include_once("ac_common.php");
@@ -75,8 +75,12 @@
             {
                 $db_id = mb_substr($name, 4);
                 $cn = new Database();
-                $UserChange->set_folder_access($db_id, $elem);
-                               Dossier::synchro_admin($db_id);
+                               $name=$cn->format_name($db_id, "dos");
+                               if ( $cn->exist_database($name) == 1 )
+                               {
+                                       $UserChange->set_folder_access($db_id, 
$elem);
+                                       Dossier::synchro_admin($db_id);
+                               }
             }
         }
     }

Modified: phpcompta/trunk/include/user_menu.php
===================================================================
--- phpcompta/trunk/include/user_menu.php       2013-05-03 21:56:40 UTC (rev 
5215)
+++ phpcompta/trunk/include/user_menu.php       2013-05-03 22:31:33 UTC (rev 
5216)
@@ -135,15 +135,15 @@
     $base="?ac=".$_REQUEST['ac'];
     $str_dossier="&".dossier::get();
     echo '<TABLE>';
-    echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=0'.$str_dossier.'">0'._(' Hors Bilan').' 
</A></TD></TR>';
-    echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=1'.$str_dossier.'">1'._(' Immobilisé').' 
</A></TD></TR>';
+    echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=0'.$str_dossier.'">0 '._(' Hors Bilan').' 
</A></TD></TR>';
+    echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=1'.$str_dossier.'">1 '._(' Immobilisé').' 
</A></TD></TR>';
     echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=2'.$str_dossier.'">2 '._('Actif a un an au 
plus').'</A></TD></TR>';
     echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=3'.$str_dossier.'">3 '._('Stock et 
commande').'</A></TD></TR>';
     echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=4'.$str_dossier.'">4 '._('Compte 
tiers').'</A></TD></TR>';
-    echo '<TR><TD class="mtitle"><A class="mtitle" 
HREF="'.$base.'&p_start=5'.$str_dossier.'">5'._('Actif').'</A></TD></TR>';
-    echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=6'.$str_dossier.'">6'._('Charges').'</A></TD></TR>';
-    echo '<TR><TD class="mtitle"><A class="mtitle" 
HREF="'.$base.'&p_start=7'.$str_dossier.'">7'._('Produits').'</A></TD></TR>';
-    echo '<TR><TD class="mtitle"><A class="mtitle" 
HREF="'.$base.'&p_start=8'.$str_dossier.'">8'._('Hors 
Comptabilité').'</A></TD></TR>';
+    echo '<TR><TD class="mtitle"><A class="mtitle" 
HREF="'.$base.'&p_start=5'.$str_dossier.'">5 '._('Financier').'</A></TD></TR>';
+    echo '<TR><TD class="mtitle"><A class="mtitle"  
HREF="'.$base.'&p_start=6'.$str_dossier.'">6 '._('Charges').'</A></TD></TR>';
+    echo '<TR><TD class="mtitle"><A class="mtitle" 
HREF="'.$base.'&p_start=7'.$str_dossier.'">7 '._('Produits').'</A></TD></TR>';
+    echo '<TR><TD class="mtitle"><A class="mtitle" 
HREF="'.$base.'&p_start=8'.$str_dossier.'">8 '._('Hors 
Comptabilité').'</A></TD></TR>';
     echo '<TR><TD class="mtitle"><A class="mtitle" 
HREF="'.$base.'&p_start=9'.$str_dossier.'">9 '._('Hors 
Comptabilité').'</A></TD></TR>';
     echo "</TABLE>";
 }

Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql     2013-05-03 21:56:40 UTC (rev 5215)
+++ phpcompta/trunk/sql/upgrade.sql     2013-05-03 22:31:33 UTC (rev 5216)
@@ -0,0 +1,104 @@
+
+CREATE OR REPLACE FUNCTION comptaproc.insert_quick_code(nf_id integer, 
tav_text text)
+  RETURNS integer AS
+$BODY$
+       declare
+       ns integer;
+       nExist integer;
+       tText text;
+       begin
+       tText := lower(trim(tav_text));
+       tText := replace(tText,' ','');
+       tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*','');
+       tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
+
+
+       loop
+               -- take the next sequence
+               select nextval('s_jnt_fic_att_value') into ns;
+               if length (tText) = 0 or tText is null then
+                       tText := 'FID'||ns;
+               end if;
+               -- av_text already used ?
+               select count(*) into nExist
+                       from fiche_detail
+               where
+                       ad_id=23 and  ad_value=upper(tText);
+
+               if nExist = 0 then
+                       exit;
+               end if;
+               tText:='FID'||ns;
+       end loop;
+
+
+       insert into fiche_detail(jft_id,f_id,ad_id,ad_value) values 
(ns,nf_id,23,upper(tText));
+       return ns;
+       end;
+$BODY$
+  LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION comptaproc.update_quick_code(njft_id integer, 
tav_text text)
+  RETURNS integer AS
+$BODY$
+       declare
+       ns integer;
+       nExist integer;
+       tText text;
+       old_qcode varchar;
+       begin
+       -- get current value
+       select ad_value into old_qcode from fiche_detail where jft_id=njft_id;
+       -- av_text didn't change so no update
+       if tav_text = upper( trim(old_qcode)) then
+               return 0;
+       end if;
+
+       tText := trim(lower(tav_text));
+       tText := replace(tText,' ','');
+       tText := translate(tText,E' $€µ£%.+-/\\!(){}(),;_&|"#''^<>*','');
+       tText := translate(tText,E'éèêëàâäïîüûùöôç','eeeeaaaiiuuuooc');
+       tText := upper(tText);
+       if length ( tText) = 0 or tText is null then
+               return 0;
+       end if;
+
+       ns := njft_id;
+
+       loop
+               -- av_text already used ?
+               select count(*) into nExist
+                       from fiche_detail
+               where
+                       ad_id=23 and ad_value=tText;
+
+               if nExist = 0 then
+                       exit;
+               end if;
+               if tText = 'FID'||ns then
+                       -- take the next sequence
+                       select nextval('s_jnt_fic_att_value') into ns;
+               end if;
+               tText  :='FID'||ns;
+
+       end loop;
+       update fiche_detail set ad_value = tText where jft_id=njft_id;
+
+       -- update also the contact
+       update fiche_detail set ad_value = tText
+               where jft_id in
+                       ( select jft_id
+                               from fiche_detail
+                       where ad_id=25 and ad_value=old_qcode);
+
+
+       update jrnx set j_qcode=tText where j_qcode = old_qcode;
+       return ns;
+       end;
+$BODY$
+  LANGUAGE plpgsql;
+
+
+alter table document_state add s_status char(1);
+
+update document_state set s_status='C' where s_id in (1,4)
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]