svn+ssh://danydb@svn/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 à exercice courant 0000667: DASHBOAD : agrandir les éléments ........ 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ême numéro de pièce ........ 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élioration apparence ........ r5073 | danydb | 2012-07-19 12:51:27 +0200 (Thu, 19 Jul 2012) | 2 lines Enlève 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élioration recherche ........ r5091 | danydb | 2012-07-30 21:44:23 +0200 (Mon, 30 Jul 2012) | 1 line Amélioration 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énération 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é ........ r5107 | danydb | 2012-09-16 18:53:59 +0200 (Sun, 16 Sep 2012) | 1 line Améliore 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ème 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 écran ........ r5122 | danydb | 2012-10-01 20:47:26 +0200 (Mon, 01 Oct 2012) | 1 line 0000733: Impression opération 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ération 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érations 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 à 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é ligne paire ........ r5130 | danydb | 2012-10-01 22:03:42 +0200 (Mon, 01 Oct 2012) | 1 line CSS présentation, remplace fieldset ........ r5131 | danydb | 2012-10-01 22:04:03 +0200 (Mon, 01 Oct 2012) | 1 line Ne surligne pas les actions cloturées ........ 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érer la date = oui ne met plus la date à jour dans les achats ........ r5140 | danydb | 2012-10-16 01:13:30 +0200 (Tue, 16 Oct 2012) | 1 line Suggérer la date = oui ne met plus la date à jour dans les achats ........ r5141 | danydb | 2012-10-16 01:14:01 +0200 (Tue, 16 Oct 2012) | 1 line Suggérer la date = oui ne met plus la date à jour dans les achats ........ r5142 | danydb | 2012-10-17 17:54:22 +0200 (Wed, 17 Oct 2012) | 1 line 0000749: poste alphanumérique (fournisseur 44xxx) ........ r5143 | danydb | 2012-10-20 19:13:04 +0200 (Sat, 20 Oct 2012) | 2 lines #754 Les totaux dans Prévisions #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ème 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éation de fiche avec un compte (455) déjà utilisé. ........ r5150 | danydb | 2012-10-30 22:20:07 +0100 (Tue, 30 Oct 2012) | 2 lines 0000744: (classe) 5Actif 0000746: ajouter un espace là où 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 être 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é différent pour l'opération de paiement et d'achat/vente. 0000765: affichage des colonnes Prix HTVA quand la société n'est pas assujettie à 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ération ........ r5162 | danydb | 2012-12-06 23:09:20 +0100 (Thu, 06 Dec 2012) | 1 line 0000745: en bas de page il apparaît 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étail opération ........ 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ètres / 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âche suivi ........ r5185 | danydb | 2013-03-13 16:30:37 +0100 (Wed, 13 Mar 2013) | 2 lines 0000796: Lettrage : en code Hexadécimal ou en base 36 (A à Z + 0 à 10) ........ r5186 | danydb | 2013-03-13 22:10:15 +0100 (Wed, 13 Mar 2013) | 2 lines 0000796: Lettrage : en code Hexadécimal ou en base 36 (A à Z + 0 à 10) ........ r5187 | danydb | 2013-03-14 00:04:53 +0100 (Thu, 14 Mar 2013) | 2 lines esthétique ........ r5188 | danydb | 2013-03-17 01:24:05 +0100 (Sun, 17 Mar 2013) | 3 lines 0000797: Amélioration 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étail non disponible ........ r5195 | danydb | 2013-03-27 20:20:33 +0100 (Wed, 27 Mar 2013) | 1 line 0000802: Bug : visibilité des actions ........ r5196 | danydb | 2013-03-27 20:22:53 +0100 (Wed, 27 Mar 2013) | 1 line 0000802: Bug : visibilité 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ées 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ébit et de crédit négative 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ébit et de crédit négative 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ées ........ 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énération document : changer le type de cellule Attention problème si on a utiliser = devant le tag pour forcer le type numérique ........
935 lines
28 KiB
PHP
935 lines
28 KiB
PHP
<?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 ddebontridder@yahoo.fr
|
|
|
|
/*!\file
|
|
* \brief contains the class for connecting to a postgresql database
|
|
*/
|
|
require_once('constant.php');
|
|
require_once('ac_common.php');
|
|
|
|
/*!\brief
|
|
* This class allow you to connect to the postgresql database, execute sql, retrieve data
|
|
*
|
|
*/
|
|
class Database
|
|
{
|
|
|
|
private $db; /*!< database connection */
|
|
private $ret; /*!< return value */
|
|
/*!\brief constructor
|
|
*\param $p_database_id is the id of the dossier, or the modele following the
|
|
* p_type if = 0 then connect to the repository
|
|
*\param $p_type is 'DOS' (defaut) for dossier or 'MOD'
|
|
*/
|
|
function __construct ($p_database_id=0,$p_type='dos')
|
|
{
|
|
if ( IsNumber($p_database_id) == false || strlen($p_database_id) > 5 ) die ("-->Dossier invalide [$p_database_id]");
|
|
$phpcompta_user=phpcompta_user;
|
|
$password=phpcompta_password;
|
|
$port=phpcompta_psql_port;
|
|
$host=( ! defined ("phpcompta_psql_host"))?'127.0.0.1':phpcompta_psql_host;
|
|
|
|
if ( $p_database_id == 0 )
|
|
{ /* connect to the repository */
|
|
$l_dossier=sprintf("%saccount_repository",strtolower(domaine));
|
|
}
|
|
else if ( $p_type == 'dos')
|
|
{ /* connect to a folder (dossier) */
|
|
$l_dossier=sprintf("%sdossier%d",strtolower(domaine),$p_database_id);
|
|
}
|
|
else if ($p_type=='mod')
|
|
{ /* connect to a template (modele) */
|
|
$l_dossier=sprintf("%smod%d",strtolower(domaine),$p_database_id);
|
|
}
|
|
else if ($p_type=='template')
|
|
{
|
|
$l_dossier='template1';
|
|
}
|
|
else
|
|
{
|
|
throw new Exception ('Connection invalide');
|
|
}
|
|
|
|
ob_start();
|
|
$a=pg_connect("dbname=$l_dossier host='$host' user='$phpcompta_user'
|
|
password='$password' port=$port");
|
|
|
|
if ( $a == false )
|
|
{
|
|
if (DEBUG)
|
|
{
|
|
ob_end_clean();
|
|
echo '<h2 class="error">Impossible de se connecter à postgreSql !</h2>';
|
|
echo '<p>';
|
|
echo "Vos paramètres sont incorrectes : <br>";
|
|
echo "<br>";
|
|
echo "base de donnée : $l_dossier<br>";
|
|
echo "Domaine : ".domaine."<br>";
|
|
echo "Port $port <br>";
|
|
echo "Utilisateur : $phpcompta_user <br>";
|
|
echo '</p>';
|
|
|
|
exit ("Connection impossible : vérifiez vos paramètres de base
|
|
de données");
|
|
}
|
|
else
|
|
{
|
|
echo '<h2 class="error">Erreur de connexion !</h2>';
|
|
}
|
|
|
|
}
|
|
$this->db=$a;
|
|
if ( $this->exist_schema('comptaproc') )
|
|
pg_exec($this->db,'set search_path to public,comptaproc;');
|
|
ob_end_clean();
|
|
}
|
|
|
|
public function verify()
|
|
{
|
|
// Verify that the elt we want to add is correct
|
|
}
|
|
function set_encoding($p_charset)
|
|
{
|
|
pg_set_client_encoding($this->db,$p_charset);
|
|
}
|
|
/*!
|
|
* \brief send a sql string to the database
|
|
* \param $p_string sql string
|
|
* \param $p_array array for the SQL string (see pg_query_params)
|
|
* \return the result of the query, a resource or false if an
|
|
* error occured
|
|
*/
|
|
function exec_sql( $p_string,$p_array=null)
|
|
{
|
|
try
|
|
{
|
|
|
|
$this->sql=$p_string;
|
|
$this->array=$p_array;
|
|
|
|
if ( $p_array==null )
|
|
{
|
|
if ( ! DEBUG )
|
|
$this->ret=pg_query($this->db,$p_string);
|
|
else
|
|
$this->ret=@pg_query($this->db,$p_string);
|
|
}
|
|
else
|
|
{
|
|
if ( !is_array($p_array))
|
|
{
|
|
throw new Exception("Erreur : exec_sql attend un array");
|
|
}
|
|
if ( ! DEBUG )
|
|
$this->ret=pg_query_params($this->db,$p_string,$p_array);
|
|
else
|
|
$this->ret=@pg_query_params($this->db,$p_string,$p_array);
|
|
|
|
}
|
|
if ( ! $this->ret )
|
|
{
|
|
$str_error=pg_last_error($this->db). pg_result_error($this->ret);
|
|
throw new Exception (" SQL ERROR $p_string ".$str_error,1 );
|
|
}
|
|
|
|
}
|
|
catch (Exception $a)
|
|
{
|
|
if (DEBUG)
|
|
{
|
|
print_r ($p_string);
|
|
print_r($p_array);
|
|
echo $a->getMessage();
|
|
echo $a->getTrace();
|
|
echo $a->getTraceAsString();
|
|
echo pg_last_error($this->db);
|
|
}
|
|
throw ($a);
|
|
}
|
|
|
|
return $this->ret;
|
|
|
|
}
|
|
/*! \brief Count the number of row returned by a sql statement
|
|
*
|
|
* \param $p_sql sql string
|
|
* \param $p_array if not null we use the safer pg_query_params
|
|
*/
|
|
|
|
function count_sql($p_sql,$p_array=null)
|
|
{
|
|
$r_sql=$this->exec_sql($p_sql,$p_array);
|
|
return pg_NumRows($r_sql);
|
|
}
|
|
/*!\brief get the current sequence value
|
|
*/
|
|
function get_current_seq($p_seq)
|
|
{
|
|
$Res=$this->get_value("select currval('$p_seq') as seq");
|
|
return $Res;
|
|
}
|
|
|
|
|
|
/*!\brief get the next sequence value
|
|
*/
|
|
function get_next_seq($p_seq)
|
|
{
|
|
$Res=$this->exec_sql("select nextval('$p_seq') as seq");
|
|
$seq=pg_fetch_array($Res,0);
|
|
return $seq['seq'];
|
|
}
|
|
/**
|
|
* @ brief : start a transaction
|
|
*
|
|
*/
|
|
|
|
function start()
|
|
{
|
|
$Res=$this->exec_sql("start transaction");
|
|
}
|
|
/**
|
|
* Commit the transaction
|
|
*
|
|
*/
|
|
|
|
function commit()
|
|
{
|
|
$Res=$this->exec_sql("commit");
|
|
}
|
|
/**
|
|
* rollback the current transaction
|
|
*/
|
|
function rollback()
|
|
{
|
|
$Res=$this->exec_sql("rollback");
|
|
}
|
|
/**
|
|
* @brief alter the sequence value
|
|
* @param $p_name name of the sequence
|
|
* @param $min the start value of the sequence
|
|
*/
|
|
function alter_seq($p_name,$min)
|
|
{
|
|
if ($min < 1) $min=1;
|
|
$Res=$this->exec_sql("alter sequence $p_name restart $min");
|
|
}
|
|
/*!
|
|
* \brief Execute a sql script
|
|
* \param $script script name
|
|
*/
|
|
function execute_script($script)
|
|
{
|
|
|
|
if ( ! DEBUG ) ob_start();
|
|
$hf=fopen($script,'r');
|
|
if ( $hf == false )
|
|
{
|
|
echo 'Ne peut ouvrir '.$script;
|
|
exit();
|
|
}
|
|
$sql="";
|
|
$flag_function=false;
|
|
while (!feof($hf))
|
|
{
|
|
$buffer=fgets($hf);
|
|
$buffer=str_replace ("$","\$",$buffer);
|
|
print $buffer."<br>";
|
|
// comment are not execute
|
|
if ( substr($buffer,0,2) == "--" )
|
|
{
|
|
//echo "comment $buffer";
|
|
continue;
|
|
}
|
|
// Blank Lines Are Skipped
|
|
If ( Strlen($buffer)==0)
|
|
{
|
|
//echo "Blank $buffer";
|
|
Continue;
|
|
}
|
|
if ( strpos(strtolower($buffer),"create function")===0 )
|
|
{
|
|
echo "found a function";
|
|
$flag_function=true;
|
|
$sql=$buffer;
|
|
continue;
|
|
}
|
|
if ( strpos(strtolower($buffer),"create or replace function")===0 )
|
|
{
|
|
echo "found a function";
|
|
$flag_function=true;
|
|
$sql=$buffer;
|
|
continue;
|
|
}
|
|
// No semi colon -> multiline command
|
|
if ( $flag_function== false && strpos($buffer,';') == false )
|
|
{
|
|
$sql.=$buffer;
|
|
continue;
|
|
}
|
|
if ( $flag_function )
|
|
{
|
|
if ( strpos(strtolower($buffer), "language plpgsql") === false &&
|
|
strpos(strtolower($buffer), "language 'plpgsql'") === false )
|
|
{
|
|
$sql.=$buffer;
|
|
continue;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// cut the semi colon
|
|
$buffer=str_replace (';','',$buffer);
|
|
}
|
|
$sql.=$buffer;
|
|
if ( $this->exec_sql($sql) == false )
|
|
{
|
|
$this->rollback();
|
|
if ( ! DEBUG ) ob_end_clean();
|
|
print "ERROR : $sql";
|
|
exit();
|
|
}
|
|
$sql="";
|
|
$flag_function=false;
|
|
print "<hr>";
|
|
} // while (feof)
|
|
fclose($hf);
|
|
if ( ! DEBUG ) ob_end_clean();
|
|
}
|
|
/*!
|
|
* \brief Get version of a database, the content of the
|
|
* table version
|
|
*
|
|
* \return version number
|
|
*
|
|
*/
|
|
function get_version()
|
|
{
|
|
$Res=$this->get_value("select val from version");
|
|
return $Res;
|
|
}
|
|
|
|
/**
|
|
*@brief fetch the $p_indice array from the last query
|
|
*@param $p_indice index
|
|
*
|
|
*/
|
|
function fetch($p_indice)
|
|
{
|
|
if ( $this->ret == false ) throw new Exception ('this->ret is empty');
|
|
return pg_fetch_array($this->ret,$p_indice ) ;
|
|
}
|
|
/*!@brief return the number of rows found by the last query,
|
|
synomym for count()*/
|
|
function size()
|
|
{
|
|
return pg_NumRows($this->ret);
|
|
}
|
|
/*!@brief return the number of rows found by the last query,
|
|
synomym for size()*/
|
|
function count()
|
|
{
|
|
return pg_NumRows($this->ret);
|
|
}
|
|
|
|
/*!\brief loop to apply all the path to a folder or
|
|
* a template
|
|
* \param $p_name database name
|
|
* \param $from_setup == 1 if called from setup.php
|
|
*
|
|
*/
|
|
function apply_patch($p_name,$from_setup=1)
|
|
{
|
|
$MaxVersion=DBVERSION-1;
|
|
$succeed="<span style=\"font-size:18px;color:green\">✓</span>";
|
|
echo '<ul style="list-type-style:square">';
|
|
$add=($from_setup==0)?'admin/':'';
|
|
for ( $i = 4;$i <= $MaxVersion;$i++)
|
|
{
|
|
$to = $i + 1;
|
|
|
|
if ($this->get_version() <= $i)
|
|
{
|
|
if ($this->get_version() == 97)
|
|
{
|
|
if ($this->exist_schema("amortissement"))
|
|
{
|
|
$this->exec_sql('ALTER TABLE amortissement.amortissement_histo
|
|
ADD CONSTRAINT internal_fk FOREIGN KEY (jr_internal) REFERENCES jrn (jr_internal)
|
|
ON UPDATE CASCADE ON DELETE SET NULL');
|
|
}
|
|
}
|
|
echo "<li>Patching ".$p_name.
|
|
" from the version ".$this->get_version()." to $to ";
|
|
|
|
$this->execute_script($add.'sql/patch/upgrade'.$i.'.sql');
|
|
echo $succeed;
|
|
|
|
if ( ! DEBUG ) ob_start();
|
|
// specific for version 4
|
|
if ( $i == 4 )
|
|
{
|
|
$sql="select jrn_def_id from jrn_def ";
|
|
$Res=$this->exec_sql($sql);
|
|
$Max=$this->size();
|
|
for ($seq=0;$seq<$Max;$seq++)
|
|
{
|
|
$row=pg_fetch_array($Res,$seq);
|
|
$sql=sprintf ("create sequence s_jrn_%d",$row['jrn_def_id']);
|
|
$this->exec_sql($sql);
|
|
}
|
|
}
|
|
// specific to version 7
|
|
if ( $i == 7 )
|
|
{
|
|
// now we use sequence instead of computing a max
|
|
//
|
|
$Res2=$this->exec_sql('select coalesce(max(jr_grpt_id),1) as l from jrn');
|
|
$Max2= pg_NumRows($Res2) ;
|
|
if ( $Max2 == 1)
|
|
{
|
|
$Row=pg_fetch_array($Res2,0);
|
|
var_dump($Row);
|
|
$M=$Row['l'];
|
|
$this->exec_sql("select setval('s_grpt',$M,true)");
|
|
}
|
|
}
|
|
// specific to version 17
|
|
if ( $i == 17 )
|
|
{
|
|
$this->execute_script($add.'sql/patch/upgrade17.sql');
|
|
$max=$this->get_value('select last_value from s_jnt_fic_att_value');
|
|
$this->alter_seq($p_cn,'s_jnt_fic_att_value',$max+1);
|
|
} // version
|
|
|
|
// reset sequence in the modele
|
|
//--
|
|
if ( $i == 30 && $p_name=="mod" )
|
|
{
|
|
$a_seq=array('s_jrn','s_jrn_op','s_centralized',
|
|
's_stock_goods','c_order','s_central');
|
|
foreach ($a_seq as $seq )
|
|
{
|
|
$sql=sprintf("select setval('%s',1,false)",$seq);
|
|
$Res=$this->exec_sql($sql);
|
|
}
|
|
$sql="select jrn_def_id from jrn_def ";
|
|
$Res=$this->exec_sql($sql);
|
|
$Max=pg_NumRows($Res);
|
|
for ($seq=0;$seq<$Max;$seq++)
|
|
{
|
|
$row=pg_fetch_array($Res,$seq);
|
|
$sql=sprintf ("select setval('s_jrn_%d',1,false)",$row['jrn_def_id']);
|
|
$this->exec_sql($sql);
|
|
}
|
|
|
|
}
|
|
if ( $i == 36 )
|
|
{
|
|
/* check the country and apply the path */
|
|
$res=$this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
|
|
$country=pg_fetch_result($res,0,0);
|
|
$this->execute_script($add."sql/patch/upgrade36.".$country.".sql");
|
|
$this->exec_sql('update tmp_pcmn set pcm_type=find_pcm_type(pcm_val)');
|
|
}
|
|
if ($i == 59 )
|
|
{
|
|
$res=$this->exec_sql("select pr_value from parameter where pr_id='MY_COUNTRY'");
|
|
$country=pg_fetch_result($res,0,0);
|
|
if ( $country == 'BE') $this->exec_sql("insert into parm_code values ('SUPPLIER',440,'Poste par défaut pour les fournisseurs')");
|
|
if ($country=='FR') $this->exec_sql("insert into parm_code values ('SUPPLIER',400,'Poste par défaut pour les fournisseurs')");
|
|
}
|
|
if ( $i == 61 )
|
|
{
|
|
$country=$this->get_value ("select pr_value from parameter where pr_id='MY_COUNTRY'");
|
|
$this->execute_script($add."sql/patch/upgrade61.".$country.".sql");
|
|
}
|
|
|
|
if ( ! DEBUG ) ob_end_clean();
|
|
}
|
|
}
|
|
echo '</ul>';
|
|
}
|
|
/*!\brief return the value of the sql, the sql will return only one value
|
|
* with the value
|
|
* \param $p_sql the sql stmt example :select s_value from
|
|
document_state where s_id=2
|
|
*\param $p_array if array is not null we use the ExecSqlParm (safer)
|
|
*\see exec_sql
|
|
*\note print a warning if several value are found, if only the first value is needed
|
|
* consider using a LIMIT clause
|
|
* \return only the first value or an empty string if nothing is found
|
|
*/
|
|
function get_value($p_sql,$p_array=null)
|
|
{
|
|
$this->ret=$this->exec_sql($p_sql,$p_array);
|
|
if ( pg_NumRows($this->ret) == 0 ) return "";
|
|
if ( pg_NumRows($this->ret) > 1 )
|
|
{
|
|
$array=pg_fetch_all($this->ret);
|
|
throw new Exception( "Attention $p_sql retourne ".pg_NumRows($this->ret)." valeurs ".
|
|
var_export($p_array,true)." values=".var_export($array,true));
|
|
}
|
|
$r=pg_fetch_row($this->ret,0);
|
|
return $r[0];
|
|
|
|
}
|
|
/*!\brief purpose return the result of a sql statment
|
|
* in a array
|
|
* \param $p_sql sql query
|
|
* \param $p_array if not null we use ExecSqlParam
|
|
*\return an empty array if nothing is found
|
|
*/
|
|
function get_array($p_sql,$p_array=null)
|
|
{
|
|
$r=$this->exec_sql($p_sql,$p_array);
|
|
|
|
if ( ($Max= pg_NumRows($r)) == 0 ) return array();
|
|
$array=pg_fetch_all($r);
|
|
return $array;
|
|
}
|
|
|
|
function create_sequence($p_name,$min=1)
|
|
{
|
|
if ($min < 1) $min=1;
|
|
$sql="create sequence ".$p_name." minvalue $min";
|
|
$this->exec_sql($sql);
|
|
}
|
|
/*!\brief test if a sequence exist */
|
|
/* \return true if the seq. exist otherwise false
|
|
*/
|
|
function exist_sequence($p_name)
|
|
{
|
|
$r=$this->count_sql("select relname from pg_class where relname=lower($1)",array($p_name));
|
|
if ( $r==0)
|
|
return false;
|
|
return true;
|
|
}
|
|
/*!\brief test if a table exist
|
|
*\param $p_name table name
|
|
*\param $schema name of the schema default public
|
|
* \return true if a table exist otherwise false
|
|
*/
|
|
function exist_table($p_name,$p_schema='public')
|
|
{
|
|
$r=$this->count_sql("select table_name from information_schema.tables where table_schema=$1 and table_name=lower($2)", array($p_schema,$p_name));
|
|
if ( $r==0)
|
|
return false;
|
|
return true;
|
|
}
|
|
/**
|
|
* Check if a column exists in a table
|
|
* @param $col : column name
|
|
* @param $table :table name
|
|
* @param $schema :schema name, default public
|
|
*@return true or false
|
|
*/
|
|
function exist_column($col,$table,$schema)
|
|
{
|
|
$r=$this->get_value('select count(*) from information_schema.columns where table_name=lower($1) and column_name=lower($2) and table_schema=lower($3)',
|
|
array($col,$table,$schema));
|
|
if ( $r > 0 ) return true;
|
|
return false;
|
|
}
|
|
/**
|
|
* return the name of the database with the domain name
|
|
* @param $p_id of the folder WITHOUT the domain name
|
|
* @param $p_type dos for folder mod for template
|
|
* @return formatted name
|
|
*/
|
|
function format_name($p_id,$p_type)
|
|
{
|
|
switch ($p_type)
|
|
{
|
|
case 'dos':
|
|
$sys_name=sprintf("%sdossier%d",strtolower(domaine),$p_id);
|
|
break;
|
|
case 'mod':
|
|
$sys_name=sprintf("%smod%d",strtolower(domaine),$p_id);
|
|
break;
|
|
default:
|
|
echo_error(__FILE__." format_name invalid type ".$p_type, __LINE__);
|
|
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;
|
|
}
|
|
/**
|
|
*@brief check if the large object exists
|
|
*@param $p_oid of the large object
|
|
*@return return true if the large obj exist or false if not
|
|
*/
|
|
function exist_blob($p_oid)
|
|
{
|
|
$r=$this->get_value('select count(loid) from pg_largeobject where loid=$1'
|
|
,array($p_oid) );
|
|
if ($r > 0) return true;
|
|
else return false;
|
|
}
|
|
/*
|
|
*!\brief test if a view exist
|
|
* \return true if the view. exist otherwise false
|
|
*/
|
|
function exist_view($p_name)
|
|
{
|
|
$r=$this->count_sql("select viewname from pg_views where viewname=lower($1)",array($p_name));
|
|
if ( $r==0)
|
|
return false;
|
|
return true;
|
|
}
|
|
/*
|
|
*!\brief test if a schema exists
|
|
* \return true if the schemas exists otherwise false
|
|
*/
|
|
function exist_schema($p_name)
|
|
{
|
|
$r=$this->count_sql("select nspname from pg_namespace where nspname=lower($1)",array($p_name));
|
|
if ( $r==0)
|
|
return false;
|
|
return true;
|
|
}
|
|
/*!
|
|
*\brief create a string containing the value separated by comma
|
|
* for use in a SQL in statement
|
|
*\return the string or empty if nothing is found
|
|
*\see fid_card.php
|
|
*/
|
|
function make_list($sql,$p_array=null)
|
|
{
|
|
if ( $p_array == null )
|
|
{
|
|
$aArray=$this->get_array($sql);
|
|
}
|
|
else
|
|
{
|
|
$aArray=$this->get_array($sql,$p_array);
|
|
}
|
|
if (empty ($aArray) ) return "";
|
|
$aIdx=array_keys($aArray[0]);
|
|
$idx=$aIdx[0];
|
|
$ret="";
|
|
$f="";
|
|
for ($i = 0; $i < count($aArray);$i++)
|
|
{
|
|
$row=$aArray[$i];
|
|
$ret.=$f.$aArray[$i][$idx];
|
|
$f=',';
|
|
}
|
|
$ret=trim($ret,',');
|
|
return $ret;
|
|
}
|
|
/*!
|
|
* \brief make a array with the sql
|
|
*
|
|
* \param $p_sql sql statement, only the first two column will be returned in
|
|
* an array. The first col. is the label and the second the value
|
|
* \param $p_null if the array start with a null value
|
|
*\note this function is used with ISelect when it is needed to have a list of
|
|
* options
|
|
* \return: a double array like
|
|
\verbatim
|
|
Array
|
|
(
|
|
[0] => Array
|
|
(
|
|
[value] => 1
|
|
[label] => Marchandise A
|
|
)
|
|
|
|
[1] => Array
|
|
(
|
|
[value] => 2
|
|
[label] => Marchandise B
|
|
)
|
|
|
|
[2] => Array
|
|
(
|
|
[value] => 3
|
|
[label] => Marchandise C
|
|
)
|
|
)
|
|
\endverbatim
|
|
* \see ISelect
|
|
*/
|
|
function make_array($p_sql,$p_null=0)
|
|
{
|
|
$a=$this->exec_sql($p_sql);
|
|
$max=pg_NumRows($a);
|
|
if ( $max==0 && $p_null==0) return null;
|
|
for ($i=0;$i<$max;$i++)
|
|
{
|
|
$row=pg_fetch_row($a);
|
|
$r[$i]['value']=$row[0];
|
|
$r[$i]['label']=h($row[1]);
|
|
}
|
|
// add a blank item ?
|
|
if ( $p_null == 1 )
|
|
{
|
|
for ($i=$max;$i!=0;$i--)
|
|
{
|
|
$r[$i]['value']= $r[$i-1]['value'];
|
|
$r[$i]['label']= h($r[$i-1]['label']);
|
|
}
|
|
$r[0]['value']=-1;
|
|
$r[0]['label']=" ";
|
|
} // if ( $p_null == 1 )
|
|
|
|
return $r;
|
|
}
|
|
/*!
|
|
* \brief Save a "piece justificative"
|
|
*
|
|
* \param $seq jr_grpt_id
|
|
* \return $oid of the lob file if success
|
|
* null if a error occurs
|
|
*
|
|
*/
|
|
function save_upload_document ($seq)
|
|
{
|
|
/* there is
|
|
no file to
|
|
upload */
|
|
if ($_FILES["pj"]["error"] == UPLOAD_ERR_NO_FILE )
|
|
{
|
|
return;
|
|
}
|
|
|
|
$new_name=tempnam($_ENV['TMP'],'pj');
|
|
if ($_FILES["pj"]["error"] > 0)
|
|
{
|
|
print_r($_FILES);
|
|
echo_error(__FILE__.":".__LINE__."Error: " . $_FILES["pj"]["error"] );
|
|
}
|
|
if ( strlen ($_FILES['pj']['tmp_name']) != 0 )
|
|
{
|
|
if (move_uploaded_file($_FILES['pj']['tmp_name'],
|
|
$new_name))
|
|
{
|
|
// echo "Image saved";
|
|
$oid= pg_lo_import($this->db,$new_name);
|
|
if ( $oid == false )
|
|
{
|
|
echo_error('postgres.php',__LINE__,"cannot upload document");
|
|
$this->rollback();
|
|
return;
|
|
}
|
|
// Remove old document
|
|
$ret=$this->exec_sql("select jr_pj from jrn where jr_grpt_id=$seq");
|
|
if (pg_num_rows($ret) != 0)
|
|
{
|
|
$r=pg_fetch_array($ret,0);
|
|
$old_oid=$r['jr_pj'];
|
|
if (strlen($old_oid) != 0)
|
|
pg_lo_unlink($cn,$old_oid);
|
|
}
|
|
// Load new document
|
|
$this->exec_sql("update jrn set jr_pj=".$oid.", jr_pj_name='".$_FILES['pj']['name']."', ".
|
|
"jr_pj_type='".$_FILES['pj']['type']."' where jr_grpt_id=$seq");
|
|
return $oid;
|
|
|
|
}
|
|
else
|
|
{
|
|
echo "<H1>Error</H1>";
|
|
$this->rollback();
|
|
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
/*!\brief wrapper for the function pg_NumRows
|
|
*\param $ret is the result of a exec_sql
|
|
*\return number of line affected
|
|
*/
|
|
static function num_row($ret)
|
|
{
|
|
return pg_NumRows($ret);
|
|
}
|
|
|
|
|
|
/*!\brief wrapper for the function pg_fetch_array
|
|
*\param $ret is the result of a pg_exec
|
|
*\param $p_indice is the index
|
|
*\return $array of column
|
|
*/
|
|
static function fetch_array($ret,$p_indice=0)
|
|
{
|
|
return pg_fetch_array($ret,$p_indice);
|
|
}
|
|
|
|
/*!\brief wrapper for the function pg_fetch_all
|
|
*\param $ret is the result of pg_exec (exec_sql)
|
|
*\return double array (row x col )
|
|
*/
|
|
static function fetch_all($ret)
|
|
{
|
|
return pg_fetch_all($ret);
|
|
}
|
|
|
|
/*!\brief wrapper for the function pg_fetch_all
|
|
*\param $ret is the result of pg_exec (exec_sql)
|
|
*\param $p_row is the indice of the row
|
|
*\param $p_col is the indice of the col
|
|
*\return a string or an integer
|
|
*/
|
|
static function fetch_result($ret,$p_row=0,$p_col=0)
|
|
{
|
|
return pg_fetch_result($ret,$p_row,$p_col);
|
|
}
|
|
/*!\brief wrapper for the function pg_fetch_row
|
|
*\param $ret is the result of pg_exec (exec_sql)
|
|
*\param $p_row is the indice of the row
|
|
*\return an array indexed from 0
|
|
*/
|
|
static function fetch_row($ret,$p_row)
|
|
{
|
|
return pg_fetch_row($ret,$p_row);
|
|
}
|
|
|
|
/*!\brief wrapper for the function pg_lo_unlink
|
|
*\param $p_oid is the of oid
|
|
*\return return the result of the operation
|
|
*/
|
|
function lo_unlink($p_oid)
|
|
{
|
|
return pg_lo_unlink($this->db,$p_oid);
|
|
}
|
|
|
|
/*!\brief wrapper for the function pg_prepare
|
|
*\param $p_string string name for pg_prepare function
|
|
*\param $p_sql is the sql to prepare
|
|
*\return return the result of the operation
|
|
*/
|
|
function prepare($p_string,$p_sql)
|
|
{
|
|
return pg_prepare($this->db,$p_string,$p_sql);
|
|
}
|
|
/*!\brief wrapper for the function pg_execute
|
|
*\param $p_string string name of the stmt given in pg_prepare function
|
|
*\param $p_array contains the variables
|
|
*\note set this->ret to the return of pg_execute
|
|
*\return return the result of the operation,
|
|
*/
|
|
function execute($p_string,$p_array)
|
|
{
|
|
$this->ret=pg_execute($this->db,$p_string,$p_array);
|
|
return $this->ret;
|
|
}
|
|
|
|
/*!\brief wrapper for the function pg_lo_export
|
|
*\param $p_oid is the oid of the log
|
|
*\param $tmp is the file
|
|
*\return result of the operation
|
|
*/
|
|
function lo_export($p_oid,$tmp)
|
|
{
|
|
return pg_lo_export($this->db,$p_oid,$tmp);
|
|
}
|
|
/*!\brief wrapper for the function pg_lo_export
|
|
*\param $p_oid is the oid of the log
|
|
*\param $tmp is the file
|
|
*\return result of the operation
|
|
*/
|
|
function lo_import($p_oid)
|
|
{
|
|
return pg_lo_import($this->db,$p_oid);
|
|
}
|
|
|
|
/*!\brief wrapper for the function pg_escape_string
|
|
*\param $p_string is the string to escape
|
|
*\return escaped string
|
|
*/
|
|
static function escape_string($p_string)
|
|
{
|
|
return pg_escape_string($p_string);
|
|
}
|
|
/*!\brief wrapper for the function pg_close
|
|
*/
|
|
function close()
|
|
{
|
|
pg_close($this->db);
|
|
}
|
|
/*!\brief
|
|
*\param
|
|
*\return
|
|
*\note
|
|
*\see
|
|
*/
|
|
function __toString()
|
|
{
|
|
return "database ";
|
|
}
|
|
static function test_me()
|
|
{}
|
|
function status()
|
|
{
|
|
return pg_transaction_status($this->db);
|
|
}
|
|
/**
|
|
* with the handle of a successull query, echo each row into CSV and
|
|
* send it directly
|
|
* @param type $ret handle to a query
|
|
* @param type $aheader double array, each item of the array contains
|
|
* a key type (num) and a key title
|
|
*/
|
|
function query_to_csv($ret,$aheader)
|
|
{
|
|
$seq="";
|
|
for ($i=0;$i<count($aheader);$i++)
|
|
{
|
|
echo $seq.'"'.$aheader[$i]['title'].'"';
|
|
$seq=";";
|
|
}
|
|
printf("\n\r");
|
|
// fetch all the rows
|
|
for ($i=0;$i<Database::num_row($ret);$i++)
|
|
{
|
|
$row=Database::fetch_array($ret, $i);
|
|
$sep2="";
|
|
// for each rows, for each value
|
|
for ($e=0;$e<count($row)/2;$e++)
|
|
{
|
|
switch ($aheader[$e]['type'])
|
|
{
|
|
case 'num':
|
|
echo $sep2.nb($row[$e]);
|
|
break;
|
|
default:
|
|
echo $sep2.'"'.$row[$e].'"';
|
|
}
|
|
$sep2=";";
|
|
}
|
|
printf("\n\r");
|
|
}
|
|
}
|
|
}
|
|
|
|
/* test::test_me(); */
|