svn+ssh://danydb@svn/svn/phpcompta/branches/rel410-exp ........ r1909 | danydb | 2008-03-03 18:01:14 +0100 (Mon, 03 Mar 2008) | 1 line New branches for the rel410 : priority = interface ........ r1914 | danydb | 2008-03-05 18:53:35 +0100 (Wed, 05 Mar 2008) | 1 line Code cleaning for the predefined operation ........ r1918 | danydb | 2008-03-07 16:56:47 +0100 (Fri, 07 Mar 2008) | 1 line The database version is now in a constant ........ r1920 | danydb | 2008-03-10 12:07:00 +0100 (Mon, 10 Mar 2008) | 1 line Not needed patch ........ r1922 | danydb | 2008-03-10 16:45:29 +0100 (Mon, 10 Mar 2008) | 1 line COSMETIC : improve login page ........ r1923 | danydb | 2008-03-10 17:10:52 +0100 (Mon, 10 Mar 2008) | 1 line COSMETIC : improve interface template of document ........ r1924 | danydb | 2008-03-10 18:34:12 +0100 (Mon, 10 Mar 2008) | 1 line Cosmetic : improve interface "preference" ........ r1929 | danydb | 2008-03-11 16:08:53 +0100 (Tue, 11 Mar 2008) | 1 line Complete workaround (see rev 1927) ........ r1930 | danydb | 2008-03-11 18:28:23 +0100 (Tue, 11 Mar 2008) | 1 line Task 46 : rewrite Rapport before adding miniRapport ........ r1931 | danydb | 2008-03-11 18:36:31 +0100 (Tue, 11 Mar 2008) | 1 line class_periode was removed by mistake, it is readded ........ r1932 | danydb | 2008-03-12 19:12:07 +0100 (Wed, 12 Mar 2008) | 1 line task 46 : rewritting of rapport ........ r1934 | danydb | 2008-03-13 14:13:23 +0100 (Thu, 13 Mar 2008) | 1 line Task 46 Rapport are completely rewritted ........ r1935 | danydb | 2008-03-13 17:06:36 +0100 (Thu, 13 Mar 2008) | 1 line Task 46 mini report on welcome page -> task finished ........ r1936 | danydb | 2008-03-14 10:55:15 +0100 (Fri, 14 Mar 2008) | 1 line Correct documentation ........ r1937 | danydb | 2008-03-14 12:13:54 +0100 (Fri, 14 Mar 2008) | 1 line if the browser doesn\'t accept the cookie, the PHPSESSID must be put into the url ........ r1938 | danydb | 2008-03-14 16:26:01 +0100 (Fri, 14 Mar 2008) | 1 line Fix unknow pass_1 ........ r1939 | danydb | 2008-03-14 16:27:15 +0100 (Fri, 14 Mar 2008) | 1 line Duplicate DBVERSION ........ r1940 | danydb | 2008-03-14 16:50:14 +0100 (Fri, 14 Mar 2008) | 1 line Cosmetic ........ r1941 | danydb | 2008-03-14 16:51:19 +0100 (Fri, 14 Mar 2008) | 1 line In .htaccess the value of error_reporting must different in prod. ........ r1943 | danydb | 2008-03-15 20:13:47 +0100 (Sat, 15 Mar 2008) | 1 line task 50 : check if bcmath avail. ........ r1952 | danydb | 2008-03-18 16:43:48 +0100 (Tue, 18 Mar 2008) | 1 line Improve code ........ r1955 | danydb | 2008-03-18 18:19:35 +0100 (Tue, 18 Mar 2008) | 1 line Code cleaning : Replace InsertJrn and InsertJrnx by Acc_Operation:insert_jrn and Acc_Operation:insert_jrnx, replace also the reconciliation by Acc_Reconciliation:insert ........ r1956 | danydb | 2008-03-19 19:12:37 +0100 (Wed, 19 Mar 2008) | 1 line Improve code : tva is now an object acc_tva ........ r1957 | danydb | 2008-03-20 13:43:38 +0100 (Thu, 20 Mar 2008) | 1 line Fix some vulnerabilities for SQL Injection ........ r1959 | danydb | 2008-03-20 23:07:24 +0100 (Thu, 20 Mar 2008) | 1 line task 34 : Improve CSS ........ r1960 | danydb | 2008-03-20 23:45:04 +0100 (Thu, 20 Mar 2008) | 1 line task 48 : improve report ........ r1961 | danydb | 2008-03-20 23:52:32 +0100 (Thu, 20 Mar 2008) | 1 line Fix small cosmetic bugs and improve the search account_windows ........ r1962 | danydb | 2008-03-20 23:55:07 +0100 (Thu, 20 Mar 2008) | 1 line improve the search account_windows ........ r1968 | danydb | 2008-03-21 18:46:26 +0100 (Fri, 21 Mar 2008) | 1 line Improve the account search functionnality ........ r1969 | danydb | 2008-03-21 20:29:39 +0100 (Fri, 21 Mar 2008) | 1 line task #31 & task #34 : mail follow-up, 2 step instead of 3 and improve appearance ........ r1970 | danydb | 2008-03-21 22:01:30 +0100 (Fri, 21 Mar 2008) | 1 line Task #27 : modify detail of folder and template ........ r1971 | danydb | 2008-03-21 22:22:20 +0100 (Fri, 21 Mar 2008) | 1 line Task 53 : add the tva rate in the generated invoice ........ r1972 | danydb | 2008-03-21 22:26:41 +0100 (Fri, 21 Mar 2008) | 1 line Make a insensitive search for the folder name ........ r1990 | danydb | 2008-03-26 23:36:46 +0100 (Wed, 26 Mar 2008) | 1 line Conversion to unicode ........ r1991 | danydb | 2008-03-26 23:58:06 +0100 (Wed, 26 Mar 2008) | 1 line cosmetic ........ r1992 | danydb | 2008-03-26 23:58:08 +0100 (Wed, 26 Mar 2008) | 1 line Remove last latin1 code ........ r1995 | danydb | 2008-03-31 17:35:30 +0200 (Mon, 31 Mar 2008) | 1 line report : Add the button Search for new line ........ r1996 | danydb | 2008-03-31 17:38:56 +0200 (Mon, 31 Mar 2008) | 1 line report : add the set_poste_child ........ r1997 | danydb | 2008-03-31 22:32:05 +0200 (Mon, 31 Mar 2008) | 1 line Next SQL Upgrade for class_acc_tva ........ r1998 | danydb | 2008-03-31 22:32:53 +0200 (Mon, 31 Mar 2008) | 1 line Rewriting of class_acc_parm_code ........ r1999 | danydb | 2008-03-31 23:13:23 +0200 (Mon, 31 Mar 2008) | 1 line Improve VAT class and form ........ r2000 | danydb | 2008-03-31 23:16:37 +0200 (Mon, 31 Mar 2008) | 1 line Rewrite TVA insert ........ r2001 | danydb | 2008-04-01 16:01:52 +0200 (Tue, 01 Apr 2008) | 5 lines Start to rewrite ledger encoding Move predefined operation to preod.inc.php Add the menu Predefined operation in the parameter module ........ r2003 | danydb | 2008-04-01 22:02:26 +0200 (Tue, 01 Apr 2008) | 1 line Ergonomy : drop folder and template ........ r2004 | danydb | 2008-04-03 22:59:45 +0200 (Thu, 03 Apr 2008) | 1 line Fix undefined variable in class_periode.php ........ r2005 | danydb | 2008-04-04 00:13:05 +0200 (Fri, 04 Apr 2008) | 1 line Fix undefined variable in gestion->customer->operation ........ r2006 | danydb | 2008-04-07 14:23:01 +0200 (Mon, 07 Apr 2008) | 1 line Login & mot de passe en français ........ r2007 | danydb | 2008-04-07 15:24:56 +0200 (Mon, 07 Apr 2008) | 1 line Documentation : change to unicode ........ r2008 | danydb | 2008-04-07 16:42:02 +0200 (Mon, 07 Apr 2008) | 1 line Protect against SQL Injection ........ r2009 | danydb | 2008-04-07 16:43:07 +0200 (Mon, 07 Apr 2008) | 1 line Download the definition of a report ........ r2010 | danydb | 2008-04-07 16:57:55 +0200 (Mon, 07 Apr 2008) | 2 lines Remove debug info ........ r2011 | danydb | 2008-04-07 17:32:17 +0200 (Mon, 07 Apr 2008) | 1 line Upload and save of a definition of a report ........ r2012 | danydb | 2008-04-08 17:04:00 +0200 (Tue, 08 Apr 2008) | 1 line task 50 : use of bcmat to avoid rounding problem ........ r2013 | danydb | 2008-04-09 13:48:30 +0200 (Wed, 09 Apr 2008) | 2 lines task #36 : add a warning if no mini report is defined ........ r2024 | danydb | 2008-04-11 18:02:22 +0200 (Fri, 11 Apr 2008) | 1 line Task #25 : feature backup / restore useful, restore is always in unicode ........ r2025 | danydb | 2008-04-11 18:35:55 +0200 (Fri, 11 Apr 2008) | 1 line task 51 : warning when trying to create a new folder ........ r2026 | danydb | 2008-04-12 16:00:09 +0200 (Sat, 12 Apr 2008) | 2 lines Cosmetic : change in the detailled operation Debit by Montant ........ r2027 | danydb | 2008-04-12 16:04:32 +0200 (Sat, 12 Apr 2008) | 2 lines Operation ; without details by default ........ r2028 | danydb | 2008-04-12 16:04:47 +0200 (Sat, 12 Apr 2008) | 2 lines Remove details from operation supplier ........ r2029 | danydb | 2008-04-12 16:15:17 +0200 (Sat, 12 Apr 2008) | 1 line Gestion : fix bug in return button when adding a customer ........ r2030 | danydb | 2008-04-12 16:19:19 +0200 (Sat, 12 Apr 2008) | 1 line Gestion : bug remove delete message ........ r2031 | danydb | 2008-04-12 16:22:25 +0200 (Sat, 12 Apr 2008) | 3 lines Remove php tag and replace by echo Add in "Comptabilité" the Great Ledger ........ r2032 | danydb | 2008-04-12 17:10:06 +0200 (Sat, 12 Apr 2008) | 1 line Fix Bilan : France bug with unicode ........ r2033 | danydb | 2008-04-12 17:17:55 +0200 (Sat, 12 Apr 2008) | 3 lines Separate the user setting from the general constant.php, a template file is given (config.inc) Fix some cosmetic bug for this shit of IE ........ r2034 | danydb | 2008-04-18 14:51:13 +0200 (Fri, 18 Apr 2008) | 2 lines Fix bug : missing coma ........ r2035 | danydb | 2008-04-19 23:39:09 +0200 (Sat, 19 Apr 2008) | 1 line class_widget fix button_href to work on the same way with IE and firefox ........ r2036 | danydb | 2008-05-01 18:17:06 +0200 (Thu, 01 May 2008) | 2 lines task #33 start rewriting of encoding operation (VEN) ........ r2037 | danydb | 2008-05-01 18:18:26 +0200 (Thu, 01 May 2008) | 2 lines task #33 start rewriting of encoding operation (VEN) ........ r2040 | danydb | 2008-05-07 20:53:32 +0200 (Wed, 07 May 2008) | 1 line Unicode for doxygen ........ r2043 | danydb | 2008-05-25 17:32:51 +0200 (Sun, 25 May 2008) | 2 lines Default pref is TEXT instead of SELECT ........ r2045 | danydb | 2008-06-14 17:48:46 +0200 (Sat, 14 Jun 2008) | 1 line Add a style input_type ........ r2046 | danydb | 2008-06-14 17:49:58 +0200 (Sat, 14 Jun 2008) | 3 lines 1. Replace the CSS class u_content by content, the u_content existed for historic reason 2. Start the coding of ledger sold ........ r2048 | danydb | 2008-06-14 18:31:55 +0200 (Sat, 14 Jun 2008) | 1 line remove javascript warning ........ r2049 | danydb | 2008-06-14 18:32:26 +0200 (Sat, 14 Jun 2008) | 1 line Ledger SOLD add row ........ r2050 | danydb | 2008-06-14 19:54:29 +0200 (Sat, 14 Jun 2008) | 1 line Ledger sold : replace dot by style ........ r2051 | danydb | 2008-06-14 21:08:48 +0200 (Sat, 14 Jun 2008) | 1 line correct unicode char in doc folder ........ r2052 | danydb | 2008-06-14 23:58:01 +0200 (Sat, 14 Jun 2008) | 1 line Ledger SOLD : automatic update of the total ........ r2053 | danydb | 2008-06-15 12:05:02 +0200 (Sun, 15 Jun 2008) | 1 line Performance : the prototype.js is quite heavy, and is not any more included in every page, instead now, there is a html_min_start_page with a minimum of javascript files and a mintoolkit.js which contains the minimum for javascript ........ r2054 | danydb | 2008-06-15 12:17:22 +0200 (Sun, 15 Jun 2008) | 1 line Prototype.js performance, included only if needed, improve performance for access.php, user_login.php ........ r2055 | danydb | 2008-06-19 11:29:52 +0200 (Thu, 19 Jun 2008) | 1 line Cosmetic : Adapt CSS for F3 ........ r2056 | danydb | 2008-06-19 12:18:13 +0200 (Thu, 19 Jun 2008) | 1 line remove useless comment and debug message ........ r2057 | danydb | 2008-06-19 12:32:58 +0200 (Thu, 19 Jun 2008) | 1 line Update CSS classic ........ r2058 | danydb | 2008-06-24 01:14:21 +0200 (Tue, 24 Jun 2008) | 1 line ........ r2059 | danydb | 2008-06-28 14:05:23 +0200 (Sat, 28 Jun 2008) | 1 line task #67 : infobulle ........ r2060 | danydb | 2008-06-28 14:16:37 +0200 (Sat, 28 Jun 2008) | 1 line Bug in add_row ........ r2061 | danydb | 2008-06-28 14:16:49 +0200 (Sat, 28 Jun 2008) | 1 line task #67 : infobulle ........ r2062 | danydb | 2008-06-28 15:21:57 +0200 (Sat, 28 Jun 2008) | 1 line Compute the sold amount via javascript ........ r2063 | danydb | 2008-06-28 15:34:38 +0200 (Sat, 28 Jun 2008) | 1 line Correct typo ........ r2064 | danydb | 2008-07-01 23:02:29 +0200 (Tue, 01 Jul 2008) | 1 line Add predef operation for VEN ........ r2065 | danydb | 2008-07-02 23:57:45 +0200 (Wed, 02 Jul 2008) | 1 line Fixed undefined use_predef ........ r2066 | danydb | 2008-07-03 15:27:22 +0200 (Thu, 03 Jul 2008) | 2 lines Work without prototype.js ........ r2067 | danydb | 2008-07-03 18:33:03 +0200 (Thu, 03 Jul 2008) | 2 lines Fix bug with undefined variable ........ r2068 | danydb | 2008-07-03 18:43:53 +0200 (Thu, 03 Jul 2008) | 2 lines typo ........ r2069 | danydb | 2008-07-03 20:37:06 +0200 (Thu, 03 Jul 2008) | 1 line New version for Ledger sold and invoice ........ r2070 | danydb | 2008-07-03 20:56:47 +0200 (Thu, 03 Jul 2008) | 1 line Update infobulle + typo ........ r2071 | danydb | 2008-07-04 12:55:16 +0200 (Fri, 04 Jul 2008) | 1 line Correct last bug for compta_ven ........ r2072 | danydb | 2008-07-04 14:34:24 +0200 (Fri, 04 Jul 2008) | 1 line Task#39 Migrate to unicode ........ r2073 | danydb | 2008-07-04 14:34:47 +0200 (Fri, 04 Jul 2008) | 1 line Task#39 Migrate to unicode ........ r2074 | danydb | 2008-07-04 14:40:38 +0200 (Fri, 04 Jul 2008) | 2 lines Add documentation for task #39 (unicode) ........ r2075 | danydb | 2008-07-04 14:53:47 +0200 (Fri, 04 Jul 2008) | 2 lines cosmetic ........ r2076 | danydb | 2008-07-04 16:52:56 +0200 (Fri, 04 Jul 2008) | 2 lines cosmetic ........ r2077 | danydb | 2008-07-04 18:02:23 +0200 (Fri, 04 Jul 2008) | 1 line Update CSS ........ r2078 | danydb | 2008-07-04 18:22:11 +0200 (Fri, 04 Jul 2008) | 2 lines Add reset type ........ r2079 | danydb | 2008-07-04 21:50:24 +0200 (Fri, 04 Jul 2008) | 1 line Rewriting of the financial ledger ........ r2080 | danydb | 2008-07-04 21:53:43 +0200 (Fri, 04 Jul 2008) | 1 line Cosmetic ........ r2081 | danydb | 2008-07-05 00:18:17 +0200 (Sat, 05 Jul 2008) | 1 line Ledger Purchase ........ r2082 | danydb | 2008-07-05 00:18:42 +0200 (Sat, 05 Jul 2008) | 1 line rename compta_ach.php ........ r2083 | danydb | 2008-07-05 03:49:35 +0200 (Sat, 05 Jul 2008) | 1 line Finish ledger purchase ........ r2084 | danydb | 2008-07-05 04:22:50 +0200 (Sat, 05 Jul 2008) | 1 line bugs ledger purchase + javascript : need to trim parameters for Ajax (qcode and amounts) ........ r2085 | danydb | 2008-07-05 06:04:21 +0200 (Sat, 05 Jul 2008) | 1 line Rewriting of the ledger is complete, now we can remove dead code and files ........ r2086 | danydb | 2008-07-05 14:10:23 +0200 (Sat, 05 Jul 2008) | 1 line Correct javascript bugs ........ r2087 | danydb | 2008-07-05 14:13:16 +0200 (Sat, 05 Jul 2008) | 1 line code cleaning ........ r2088 | danydb | 2008-07-05 14:34:16 +0200 (Sat, 05 Jul 2008) | 1 line code cleaning ........ r2089 | danydb | 2008-07-05 17:18:48 +0200 (Sat, 05 Jul 2008) | 1 line Adapt a little bit the direct writing ........ r2090 | danydb | 2008-07-05 21:53:50 +0200 (Sat, 05 Jul 2008) | 1 line Improve installation ........ r2091 | danydb | 2008-07-05 21:54:00 +0200 (Sat, 05 Jul 2008) | 1 line Improve installation ........ r2092 | danydb | 2008-07-05 22:20:11 +0200 (Sat, 05 Jul 2008) | 1 line Setup ........ r2093 | danydb | 2008-07-05 22:33:36 +0200 (Sat, 05 Jul 2008) | 1 line Readd user_action_gl.php ........ r2094 | danydb | 2008-07-05 22:38:15 +0200 (Sat, 05 Jul 2008) | 1 line Re-add user_action_gl.php ........ r2095 | danydb | 2008-07-06 00:52:23 +0200 (Sun, 06 Jul 2008) | 1 line New setup ........ r2096 | danydb | 2008-07-06 02:02:41 +0200 (Sun, 06 Jul 2008) | 1 line small bugs ........ r2097 | danydb | 2008-07-06 19:27:05 +0200 (Sun, 06 Jul 2008) | 1 line Fix security bug with domain ........ r2098 | danydb | 2008-07-06 19:39:55 +0200 (Sun, 06 Jul 2008) | 1 line fix bug : javascript Purchase does not update correctly when a card is blanked ........ r2099 | danydb | 2008-07-13 00:31:41 +0200 (Sun, 13 Jul 2008) | 1 line Task #49 add a simple todo list ........ r2100 | danydb | 2008-07-13 00:32:08 +0200 (Sun, 13 Jul 2008) | 1 line remove print_r ........ r2101 | danydb | 2008-07-13 00:43:55 +0200 (Sun, 13 Jul 2008) | 1 line Add sql patch 49 ........ r2102 | danydb | 2008-07-13 00:44:08 +0200 (Sun, 13 Jul 2008) | 1 line Add sql patch 49 ........ r2103 | danydb | 2008-07-13 00:59:01 +0200 (Sun, 13 Jul 2008) | 1 line Fix bug in the table todo_list ........ r2104 | danydb | 2008-07-13 01:09:49 +0200 (Sun, 13 Jul 2008) | 1 line Task #49 cosmetic todo list ........ r2105 | danydb | 2008-07-15 19:56:35 +0200 (Tue, 15 Jul 2008) | 1 line remove var_dump ........ r2106 | danydb | 2008-07-16 21:42:42 +0200 (Wed, 16 Jul 2008) | 1 line Fix bug : creating card ........ r2107 | danydb | 2008-07-17 12:46:16 +0200 (Thu, 17 Jul 2008) | 1 line Fix numerous small bugs ........ r2108 | danydb | 2008-07-17 13:20:51 +0200 (Thu, 17 Jul 2008) | 1 line Fix bug : if the account changed for a card then the ledgers are update with the new account ........ r2109 | danydb | 2008-07-17 14:44:42 +0200 (Thu, 17 Jul 2008) | 1 line Fix : character encoding ........ r2110 | danydb | 2008-07-17 20:34:15 +0200 (Thu, 17 Jul 2008) | 1 line task : the attribut of a card are now ordered by the users ........ r2111 | danydb | 2008-07-18 13:45:10 +0200 (Fri, 18 Jul 2008) | 1 line Import of opening are now concerned by the qcode ........ r2112 | danydb | 2008-07-18 14:05:47 +0200 (Fri, 18 Jul 2008) | 2 lines Fix bug : quick_writing_add_row duplicates value ........ r2113 | danydb | 2008-07-18 14:23:28 +0200 (Fri, 18 Jul 2008) | 1 line Cosmetic : add comment, fix bug for quick_writing (add a verify ) ........ r2114 | danydb | 2008-07-21 22:25:33 +0200 (Mon, 21 Jul 2008) | 1 line SQL Patch Add order to the card ........ r2115 | danydb | 2008-07-22 15:17:33 +0200 (Tue, 22 Jul 2008) | 1 line Release candidate : fix bug ledger sold ........ r2116 | danydb | 2008-07-22 17:50:14 +0200 (Tue, 22 Jul 2008) | 1 line Fix Bug : Ledger SOLD & PURCHASE ........ r2117 | danydb | 2008-07-24 18:11:57 +0200 (Thu, 24 Jul 2008) | 1 line Fix Bug Ledger FIN + import FIN ........ r2118 | danydb | 2008-07-24 18:29:20 +0200 (Thu, 24 Jul 2008) | 1 line Fix Bug Import FIN utf8 encoding ........ r2119 | danydb | 2008-07-24 22:19:23 +0200 (Thu, 24 Jul 2008) | 1 line Fix Bug Printing and Quick Writing ........ r2120 | danydb | 2008-07-24 22:46:50 +0200 (Thu, 24 Jul 2008) | 1 line Fix Bug Security ........ r2121 | danydb | 2008-07-24 22:51:05 +0200 (Thu, 24 Jul 2008) | 1 line Cosmetic ........ r2122 | danydb | 2008-07-24 23:00:38 +0200 (Thu, 24 Jul 2008) | 2 lines Fix problem with simple printing French ........ r2123 | danydb | 2008-07-24 23:01:48 +0200 (Thu, 24 Jul 2008) | 2 lines Missing { ........ r2124 | danydb | 2008-07-24 23:02:45 +0200 (Thu, 24 Jul 2008) | 2 lines Unicode ........ r2125 | danydb | 2008-07-24 23:04:31 +0200 (Thu, 24 Jul 2008) | 2 lines Unicode ........ r2126 | danydb | 2008-07-25 17:40:28 +0200 (Fri, 25 Jul 2008) | 1 line Fix Bug install on windows ........ r2127 | danydb | 2008-07-25 17:42:01 +0200 (Fri, 25 Jul 2008) | 1 line Add version ........ r2128 | danydb | 2008-07-25 17:44:38 +0200 (Fri, 25 Jul 2008) | 1 line short tag ........ r2129 | danydb | 2008-07-25 18:40:34 +0200 (Fri, 25 Jul 2008) | 1 line Add Generate invoice + Fix bug for show_ledger() ........ r2130 | danydb | 2008-07-25 20:51:47 +0200 (Fri, 25 Jul 2008) | 1 line remove debug ........ r2131 | danydb | 2008-07-25 20:52:12 +0200 (Fri, 25 Jul 2008) | 1 line set version ........ r2132 | danydb | 2008-07-27 22:55:03 +0200 (Sun, 27 Jul 2008) | 1 line Unicode ........ r2133 | danydb | 2008-08-28 17:52:50 +0200 (Thu, 28 Aug 2008) | 1 line add pguser for documentation ........ r2134 | danydb | 2008-08-28 19:55:26 +0200 (Thu, 28 Aug 2008) | 1 line correst documentation script ........ r2135 | danydb | 2008-08-28 21:23:05 +0200 (Thu, 28 Aug 2008) | 1 line Improve install. : automatic writing of htaccess file ........ r2136 | danydb | 2008-08-28 21:23:21 +0200 (Thu, 28 Aug 2008) | 1 line Improve install. : automatic writing of htaccess file ........ r2137 | danydb | 2008-08-28 22:43:31 +0200 (Thu, 28 Aug 2008) | 1 line Remove the useless category of card ........ r2138 | danydb | 2008-08-29 15:57:33 +0200 (Fri, 29 Aug 2008) | 1 line update version ........ r2139 | danydb | 2008-09-04 21:49:29 +0200 (Thu, 04 Sep 2008) | 1 line update doc ........ r2140 | danydb | 2008-09-06 20:47:13 +0200 (Sat, 06 Sep 2008) | 1 line Remove a not wanted hidden value which makes failed the searching for card ........ r2141 | danydb | 2008-09-07 18:57:42 +0200 (Sun, 07 Sep 2008) | 1 line Update doc. ........ r2142 | danydb | 2008-09-08 13:38:00 +0200 (Mon, 08 Sep 2008) | 1 line Fix small in fin ........ r2143 | danydb | 2008-09-08 13:49:52 +0200 (Mon, 08 Sep 2008) | 1 line Fix small bugs in ach & ven ........ r2144 | danydb | 2008-09-08 13:57:25 +0200 (Mon, 08 Sep 2008) | 1 line bug : courrier concerne ........ r2145 | danydb | 2008-09-08 14:24:00 +0200 (Mon, 08 Sep 2008) | 2 lines Fix bug with export of report ........ r2146 | danydb | 2008-09-08 15:25:50 +0200 (Mon, 08 Sep 2008) | 1 line Add the security ........ r2147 | danydb | 2008-09-09 21:31:52 +0200 (Tue, 09 Sep 2008) | 1 line files cleaning ........ r2148 | danydb | 2008-09-09 21:34:40 +0200 (Tue, 09 Sep 2008) | 1 line files cleaning ........ r2149 | danydb | 2008-09-10 13:52:56 +0200 (Wed, 10 Sep 2008) | 1 line Fix bug in ledger sold, purchase for negative amount and financial for qcode ........ r2150 | danydb | 2008-09-10 14:33:07 +0200 (Wed, 10 Sep 2008) | 1 line update version ........ r2151 | danydb | 2008-09-10 14:42:24 +0200 (Wed, 10 Sep 2008) | 1 line Add patch for insert_jrnx ........ r2152 | danydb | 2008-09-10 14:42:56 +0200 (Wed, 10 Sep 2008) | 1 line update version ........ r2153 | danydb | 2008-09-10 17:53:28 +0200 (Wed, 10 Sep 2008) | 1 line typo ........ r2154 | danydb | 2008-09-10 18:07:51 +0200 (Wed, 10 Sep 2008) | 1 line Fix layout ........ r2155 | danydb | 2008-09-13 18:08:09 +0200 (Sat, 13 Sep 2008) | 1 line Update documentation ........ r2156 | danydb | 2008-09-13 18:11:52 +0200 (Sat, 13 Sep 2008) | 1 line Update version ........ r2157 | danydb | 2008-09-13 22:27:29 +0200 (Sat, 13 Sep 2008) | 1 line Add document to upload ........ r2158 | danydb | 2008-09-13 22:28:52 +0200 (Sat, 13 Sep 2008) | 1 line Add document ........
1248 lines
35 KiB
PHP
1248 lines
35 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
|
|
include_once("class_attribut.php");
|
|
require_once('class_fiche_def.php');
|
|
require_once('class_widget.php');
|
|
/*! \file
|
|
* \brief define Class fiche, this class are using
|
|
* class attribut
|
|
*/
|
|
/*!
|
|
* \brief define Class fiche and fiche def, those class are using
|
|
* class attribut
|
|
*/
|
|
|
|
//-----------------------------------------------------
|
|
// class fiche
|
|
//-----------------------------------------------------
|
|
class fiche {
|
|
var $cn; /*! < $cn database connection */
|
|
var $id; /*! < $id fiche.f_id */
|
|
var $fiche_def; /*! < $fiche_def fd_id */
|
|
var $attribut; /*! < $attribut array of attribut object */
|
|
var $fiche_def_ref; /*!< $fiche_def_ref Type */
|
|
var $row; /*! < All the row from the ledgers */
|
|
var $quick_code; /*!< quick_code of the card */
|
|
function fiche($p_cn,$p_id=0) {
|
|
$this->cn=$p_cn;
|
|
$this->id=$p_id;
|
|
$this->quick_code='';
|
|
}
|
|
/*! get_by_qcode($p_qcode)
|
|
* \brief Retrieve a card thx his quick_code
|
|
* complete the object,, set the id member of the object
|
|
* \param $p_qcode quick_code (ad_id=23)
|
|
* \param $p_all retrieve all the attribut of the card, possible value
|
|
* are true, false retrieve only the f_id
|
|
* \return 0 success 1 error not found
|
|
*/
|
|
|
|
function get_by_qcode($p_qcode=null,$p_all=true)
|
|
{
|
|
if ( $p_qcode == null )
|
|
$p_qcode=$this->quick_code;
|
|
|
|
$p_qcode=FormatString($p_qcode);
|
|
$sql="select f_id from jnt_fic_att_value join attr_value
|
|
using (jft_id) where ad_id=23 and av_text=upper('".$p_qcode."')";
|
|
$Res=ExecSql($this->cn,$sql);
|
|
$r=pg_fetch_all($Res);
|
|
echo_debug('fiche',__LINE__,'result:'.var_export($r,true).'size '.sizeof($r));
|
|
|
|
if ( $r == null )
|
|
return 1;
|
|
$this->id=$r[0]['f_id'];
|
|
echo_debug('class_fiche',__LINE__,'f_id = '.$this->id);
|
|
|
|
if ( $p_all )
|
|
$this->getAttribut();
|
|
return 0;
|
|
}
|
|
/*!
|
|
**************************************************
|
|
* \brief get all the attribute of a card, add missing ones
|
|
* and sort the array ($this-\>attribut) by ad_id
|
|
*/
|
|
function getAttribut() {
|
|
if ( $this->id == 0){
|
|
return;
|
|
}
|
|
$sql="select *
|
|
from jnt_fic_att_value
|
|
natural join fiche
|
|
natural join attr_value
|
|
join jnt_fic_attr on (jnt_fic_attr.fd_id=fiche.fd_id and jnt_fic_attr.ad_id=jnt_fic_att_value.ad_id)
|
|
join attr_def on (attr_def.ad_id=jnt_fic_att_value.ad_id) where f_id=".$this->id.
|
|
" order by jnt_order";
|
|
|
|
$Ret=ExecSql($this->cn,$sql);
|
|
if ( ($Max=pg_NumRows($Ret)) == 0 )
|
|
return ;
|
|
for ($i=0;$i<$Max;$i++) {
|
|
$row=pg_fetch_array($Ret,$i);
|
|
$this->fiche_def=$row['fd_id'];
|
|
$t=new Attribut ($row['ad_id']);
|
|
$t->ad_text=$row['ad_text'];
|
|
$t->av_text=$row['av_text'];
|
|
$t->jnt_order=$row['jnt_order'];
|
|
$this->attribut[$i]=$t;
|
|
}
|
|
$e=new Fiche_def($this->cn,$this->fiche_def);
|
|
$e->GetAttribut();
|
|
|
|
if ( sizeof($this->attribut) != sizeof($e->attribut ) ) {
|
|
|
|
// !!! Missing attribute
|
|
foreach ($e->attribut as $f ) {
|
|
$flag=0;
|
|
foreach ($this->attribut as $g ) {
|
|
if ( $g->ad_id == $f->ad_id )
|
|
$flag=1;
|
|
}
|
|
if ( $flag == 0 ) {
|
|
// there's a missing one, we insert it
|
|
$t=new Attribut ($f->ad_id);
|
|
$t->av_text="";
|
|
$t->ad_text=$f->ad_text;
|
|
$t->jnt_order=$f->jnt_order;
|
|
$this->attribut[$Max]=$t;
|
|
$Max++;
|
|
} // if flag == 0
|
|
|
|
}// foreach
|
|
$this->attribut=SortAttributeById($this->attribut);
|
|
|
|
|
|
}//missing attribut
|
|
}
|
|
|
|
|
|
/*!
|
|
* \brief give the size of a card object
|
|
*
|
|
* \return size
|
|
*/
|
|
function size() {
|
|
if ( isset ($this->ad_id))
|
|
return sizeof($this->ad_id);
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*!
|
|
**************************************************
|
|
* \brief Return array of card from the frd family
|
|
*
|
|
* \param $p_frd_id the fiche_def_ref.frd_id
|
|
* \param $p_search p_search is a filter on the name
|
|
* \param $p_sql extra sql condition
|
|
*
|
|
* \return array of fiche object
|
|
*/
|
|
function CountByDef($p_frd_id,$p_search="",$p_sql="") {
|
|
$sql="select *
|
|
from
|
|
fiche join fiche_Def using (fd_id)
|
|
where frd_id=".$p_frd_id;
|
|
if ( $p_search != "" )
|
|
{
|
|
$a=FormatString($p_search);
|
|
$sql="select * from vw_fiche_attr where frd_id=".$p_frd_id.
|
|
" and vw_name ~* '$p_search'";
|
|
}
|
|
|
|
$Ret=ExecSql($this->cn,$sql.$p_sql);
|
|
|
|
return pg_NumRows($Ret) ;
|
|
}
|
|
/*!
|
|
**************************************************
|
|
* \brief Return array of card from the frd family
|
|
*
|
|
*
|
|
* \param $p_frd_id the fiche_def_ref.frd_id
|
|
* \param $p_offset
|
|
* \param $p_search is an optional filter
|
|
*
|
|
* \return array of fiche object
|
|
*/
|
|
function GetByDef($p_frd_id,$p_offset=-1,$p_search="") {
|
|
if ( $p_offset == -1 )
|
|
{
|
|
$sql="select *
|
|
from
|
|
fiche join fiche_Def using (fd_id)
|
|
where frd_id=".$p_frd_id." $p_search order by f_id";
|
|
}
|
|
else
|
|
{
|
|
$limit=($_SESSION['g_pagesize']!=-1)?"limit ".$_SESSION['g_pagesize']:"";
|
|
$sql="select *
|
|
from
|
|
fiche join fiche_Def using (fd_id)
|
|
where frd_id=".$p_frd_id." $p_search order by f_id "
|
|
.$limit." offset ".$p_offset;
|
|
|
|
}
|
|
|
|
$Ret=ExecSql($this->cn,$sql);
|
|
if ( ($Max=pg_NumRows($Ret)) == 0 )
|
|
return ;
|
|
$all[0]=new fiche($this->cn);
|
|
|
|
for ($i=0;$i<$Max;$i++) {
|
|
$row=pg_fetch_array($Ret,$i);
|
|
$t=new fiche($this->cn,$row['f_id']);
|
|
$t->getAttribut();
|
|
$all[$i]=$t;
|
|
|
|
}
|
|
echo_debug(__FILE__,__LINE__,$all);
|
|
return $all;
|
|
}
|
|
function ShowTable() {
|
|
echo "<TR><TD> ".
|
|
$this->id."</TD>".
|
|
"<TR> <TD>".
|
|
$this->attribut_value."</TD>".
|
|
"<TR> <TD>".
|
|
$this->attribut_def."</TD></TR>";
|
|
}
|
|
/*!
|
|
**************************************************
|
|
* \brief return the string of the given attribute
|
|
* (attr_def.ad_id)
|
|
* \param $p_ad_id the AD_ID from attr_def.ad_id
|
|
* \see constant.php
|
|
* \return string
|
|
*/
|
|
function strAttribut($p_ad_id)
|
|
{
|
|
if ( sizeof ($this->attribut) == 0 )
|
|
{
|
|
|
|
if ($this->id==0) return '- ERROR -';
|
|
// object is not in memory we need to look into the database
|
|
$sql="select av_text from attr_value join jnt_fic_att_value using(jft_id)
|
|
where f_id=".FormatString($this->id)." and ad_id=".$p_ad_id;
|
|
$Res=ExecSql($this->cn,$sql);
|
|
$row=pg_fetch_all($Res);
|
|
// if not found return error
|
|
if ( $row == false )
|
|
return ' - ERROR -';
|
|
|
|
return $row[0]['av_text'];
|
|
}
|
|
|
|
foreach ($this->attribut as $e)
|
|
{
|
|
if ( $e->ad_id == $p_ad_id )
|
|
return $e->av_text;
|
|
}
|
|
return '- ERROR -';
|
|
}
|
|
/*!
|
|
**************************************************
|
|
* \brief insert a new record
|
|
* show a blank card to be filled
|
|
*
|
|
* \param $p_fiche_def is the fiche_def.fd_id
|
|
*
|
|
* \return HTML Code
|
|
*/
|
|
function blank($p_fiche_def)
|
|
{
|
|
// array = array of attribute object sorted on ad_id
|
|
$f=new fiche_def($this->cn,$p_fiche_def);
|
|
$f->Get();
|
|
$array=$f->getAttribut();
|
|
$r='<table>';
|
|
foreach ($array as $attr)
|
|
{
|
|
$msg="";
|
|
if ( $attr->ad_id == ATTR_DEF_ACCOUNT)
|
|
{
|
|
$r.=JS_SEARCH_POSTE;
|
|
$w=new widget("js_search_poste");
|
|
// account created automatically
|
|
$sql="select account_auto($p_fiche_def)";
|
|
echo_debug("class_fiche",__LINE__,$sql);
|
|
$ret_sql=ExecSql($this->cn,$sql);
|
|
$a=pg_fetch_array($ret_sql,0);
|
|
$label=new widget("span");
|
|
$label->name="av_text".$attr->ad_id."_label";
|
|
|
|
if ( $a['account_auto'] == 't' )
|
|
$msg.="<TD>".$label->IOValue()."<br> <font color=\"red\">Rappel: Poste créé automatiquement !</font></TD> ";
|
|
else
|
|
{
|
|
// if there is a class base in fiche_def_ref, this account will be the
|
|
// the default one
|
|
if ( strlen(trim($f->class_base)) != 0 )
|
|
{
|
|
$msg.="<TD>".$label->IOValue()."<br> <font color=\"red\">Rappel: Poste par défaut sera ".
|
|
$f->class_base.
|
|
" !</font></TD> ";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
elseif ( $attr->ad_id == ATTR_DEF_TVA)
|
|
{
|
|
$r.=JS_SHOW_TVA;
|
|
$w=new widget("js_tva");
|
|
|
|
}
|
|
elseif ( $attr->ad_id == ATTR_DEF_COMPANY )
|
|
{
|
|
$r.=JS_SEARCH_CARD;
|
|
$w=new widget("js_search");
|
|
// filter on frd_id
|
|
$w->extra=FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX;
|
|
$w->extra2=0; // jrn = 0
|
|
$label=new widget("span");
|
|
$label->name="av_text".$attr->ad_id."_label";
|
|
$msg=$label->IOValue();
|
|
}
|
|
else
|
|
{
|
|
$w=new widget("text");
|
|
}
|
|
$w->table=1;
|
|
$w->label=$attr->ad_text;
|
|
$w->name="av_text".$attr->ad_id;
|
|
|
|
$r.="<TR>".$w->IOValue()."$msg </TR>";
|
|
}
|
|
$r.= '</table>';
|
|
return $r;
|
|
}
|
|
|
|
|
|
/*!
|
|
**************************************************
|
|
* \brief Display object instance, getAttribute
|
|
* sort the attribute and add missing ones
|
|
* \param $p_readonly true= if can not modify, otherwise false
|
|
*
|
|
*
|
|
* \return string to display
|
|
*/
|
|
function Display($p_readonly)
|
|
{
|
|
$this->GetAttribut();
|
|
$attr=$this->attribut;
|
|
|
|
$ret="<table>";
|
|
if ( empty ($attr) ) {
|
|
return "Fiche non trouvée";
|
|
}
|
|
foreach ( $attr as $r)
|
|
{
|
|
$msg="";
|
|
if ( $p_readonly)
|
|
{
|
|
$w=new widget("text");
|
|
}
|
|
if ($p_readonly==false)
|
|
{
|
|
if ( $r->ad_id == ATTR_DEF_ACCOUNT)
|
|
{
|
|
$ret.=JS_SEARCH_POSTE;
|
|
$w=new widget("js_search_poste");
|
|
// account created automatically
|
|
$sql="select account_auto($this->fiche_def)";
|
|
echo_debug("class_fiche",__LINE__,$sql);
|
|
$ret_sql=ExecSql($this->cn,$sql);
|
|
$a=pg_fetch_array($ret_sql,0);
|
|
$msg='<tD><span id="'.$r->ad_id.'_label"></span></td>';
|
|
|
|
if ( $a['account_auto'] == 't' )
|
|
$msg.="<TD> <font color=\"red\">si vide le Poste sera créé automatiquement</font> </TD> ";
|
|
$msg.="<td><font color=\"red\">ATTENTION changer le poste comptable d'une fiche modifiera toutes les opérations où cette fiche est utilisée</font></td>";
|
|
}
|
|
elseif ( $r->ad_id == ATTR_DEF_TVA)
|
|
{
|
|
$ret.=JS_SHOW_TVA;
|
|
$w=new widget("js_tva");
|
|
}
|
|
elseif ( $r->ad_id == ATTR_DEF_COMPANY )
|
|
{
|
|
$ret.=JS_SEARCH_CARD;
|
|
$w=new widget("js_search");
|
|
// filter on frd_id
|
|
$w->extra=FICHE_TYPE_CLIENT.','.FICHE_TYPE_FOURNISSEUR.','.FICHE_TYPE_ADM_TAX;
|
|
$w->extra2=0; // jrn = 0
|
|
$label=new widget("span");
|
|
$label->name="av_text".$r->ad_id."_label";
|
|
$msg=$label->IOValue();
|
|
}
|
|
|
|
else
|
|
{
|
|
$w=new widget("text");
|
|
}
|
|
}
|
|
$w->label=$r->ad_text;
|
|
$w->value=$r->av_text;
|
|
$w->name="av_text".$r->ad_id;
|
|
$w->readonly=$p_readonly;
|
|
$w->table=1;
|
|
|
|
|
|
$ret.="<TR>".$w->IOValue()."$msg </TR>";
|
|
}
|
|
$ret.="</table>";
|
|
return $ret;
|
|
}
|
|
/*!
|
|
**************************************************
|
|
* \brief Save a card, call insert or update
|
|
*
|
|
* \param p_fiche_def (default 0)
|
|
*/
|
|
function Save($p_fiche_def=0)
|
|
{
|
|
// new card or only a update ?
|
|
if ( $this->id == 0 )
|
|
$this->insert($p_fiche_def);
|
|
else
|
|
$this->update();
|
|
}
|
|
/*!
|
|
**************************************************
|
|
* \brief insert a new record
|
|
*
|
|
* \param p_fiche_def fiche_def.fd_id
|
|
* \param p_array is the array containing the data
|
|
*/
|
|
function insert($p_fiche_def,$p_array=null)
|
|
{
|
|
if ( $p_array == null)
|
|
$p_array=$_POST;
|
|
|
|
$fiche_id=NextSequence($this->cn,'s_fiche');
|
|
$this->id=$fiche_id;
|
|
// first we create the card
|
|
StartSql($this->cn);
|
|
try
|
|
{
|
|
$sql=sprintf("insert into fiche(f_id,fd_id)".
|
|
" values (%d,%d)",
|
|
$fiche_id,$p_fiche_def);
|
|
$Ret=ExecSql($this->cn,$sql);
|
|
// parse the $p_array array
|
|
foreach ($p_array as $name=>$value )
|
|
{
|
|
echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ;
|
|
list ($id) = sscanf ($name,"av_text%d");
|
|
if ( $id == null ) continue;
|
|
echo_debug("class_fiche",__LINE__,"add $id");
|
|
|
|
// Special traitement
|
|
// quickcode
|
|
if ( $id == ATTR_DEF_QUICKCODE)
|
|
{
|
|
echo_debug("Modify ATTR_DEF_QUICKCODE");
|
|
$sql=sprintf("select insert_quick_code(%d,'%s')",
|
|
$fiche_id,FormatString($value));
|
|
ExecSql($this->cn,$sql);
|
|
continue;
|
|
}
|
|
// stock
|
|
if ( $id == ATTR_DEF_STOCK ) {
|
|
$st=CountSql($this->cn,'select * from stock_goods where '.
|
|
" upper(sg_code)=upper('$value')");
|
|
if ( $st == 0 ) {
|
|
$user=new User($this->cn);
|
|
$exercice=$user->get_exercice();
|
|
if ( $exercice == 0 ) throw Exception ('Annee invalide erreur');
|
|
|
|
$str_stock=sprintf('insert into stock_goods(f_id,sg_quantity,sg_comment,sg_code,sg_type,sg_exercice) '.
|
|
' values (%d,0,\'%s\',upper(\'%s\'),\'d\',\'%s\')',
|
|
$fiche_id,
|
|
'initial',
|
|
FormatString($value),
|
|
$exercice);
|
|
|
|
ExecSql($this->cn,$str_stock);
|
|
}
|
|
}
|
|
// name
|
|
if ( $id == ATTR_DEF_NAME )
|
|
{
|
|
echo_debug("Modify ATTR_DEF_NAME");
|
|
if ( strlen(trim($value)) == 0 )
|
|
$value="pas de nom";
|
|
|
|
}
|
|
// account
|
|
if ( $id == ATTR_DEF_ACCOUNT )
|
|
{
|
|
echo_debug("insert ATTR_DEF_ACCOUNT");
|
|
$v=FormatString($value);
|
|
try {
|
|
if (
|
|
isNumber($v) == 1
|
|
)
|
|
{
|
|
$sql=sprintf("select account_insert(%d,%f)",
|
|
$this->id,$v);
|
|
}
|
|
else
|
|
{
|
|
$sql=sprintf("select account_insert(%d,null)",
|
|
$this->id);
|
|
}
|
|
ExecSql($this->cn,$sql);
|
|
} catch (Exception $e) {
|
|
throw new Exception ("Erreur : ce compte [$v] n'a pas de compte parent.".
|
|
"L'opération est annulée",
|
|
1);
|
|
}
|
|
continue;
|
|
}
|
|
// TVA
|
|
if ( $id == ATTR_DEF_TVA )
|
|
{
|
|
echo_debug("Modify ATTR_DEF_TVA");
|
|
// Verify if the rate exists, if not then do not update
|
|
if ( strlen(trim($value)) != 0 )
|
|
{
|
|
if ( CountSql($this->cn,"select * from tva_rate where tva_id=".$value) == 0)
|
|
{
|
|
echo_debug("class_fiche",__LINE__,"Tva invalide $value");
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
// The contact has a company attribut
|
|
if ( $id == ATTR_DEF_COMPANY )
|
|
{
|
|
$exist=CountSql($this->cn,"select f_id from fiche join fiche_def using (fd_id) ".
|
|
" join jnt_fic_att_value using (f_id) join attr_value using (jft_id) ".
|
|
" where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
|
|
" and av_text='".FormatString($value)."'");
|
|
if ( $exist == 0 && FormatString($value) != null )
|
|
{
|
|
$value="";
|
|
}
|
|
}
|
|
// Normal traitement
|
|
$value2=FormatString($value);
|
|
|
|
$sql=sprintf("select attribut_insert(%d,%d,'%s')",
|
|
$fiche_id,$id,trim($value2));
|
|
ExecSql($this->cn,$sql);
|
|
}
|
|
} catch (Exception $e)
|
|
{
|
|
echo '<span class="error">'.
|
|
$e->getMessage().
|
|
'</span>';
|
|
Rollback($this->cn);
|
|
return;
|
|
}
|
|
Commit($this->cn);
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
/*!\brief update a card
|
|
* \todo add a check to return an error and rollback operation
|
|
*/
|
|
function update($p_array=null)
|
|
{
|
|
if ( $p_array == null)
|
|
$p_array=$_POST;
|
|
|
|
try {
|
|
StartSql($this->cn);
|
|
// parse the $p_array array
|
|
foreach ($p_array as $name=>$value )
|
|
{
|
|
echo_debug ("class_fiche",__LINE__,"Name = $name value $value") ;
|
|
list ($id) = sscanf ($name,"av_text%d");
|
|
if ( $id == null ) continue;
|
|
echo_debug("class_fiche",__LINE__,"modify $id");
|
|
|
|
// retrieve jft_id to update table attr_value
|
|
$sql=" select jft_id from jnt_fic_att_value where ad_id=$id and f_id=$this->id";
|
|
$Ret=ExecSql($this->cn,$sql);
|
|
if ( pg_NumRows($Ret) != 1 ) {
|
|
// we need to insert this new attribut
|
|
echo_debug ("class_fiche ".__LINE__." adding id !!! ");
|
|
$jft_id=NextSequence($this->cn,'s_jnt_fic_att_value');
|
|
|
|
$sql2=sprintf("insert into jnt_fic_att_value(jft_id,ad_id,f_id) values (%s,%s,%s)",
|
|
$jft_id,$id,$this->id);
|
|
|
|
$ret2=ExecSql($this->cn,$sql2);
|
|
// insert a null value for this attribut
|
|
$sql3=sprintf("insert into attr_value(jft_id,av_text) values (%s,null)",
|
|
$jft_id);
|
|
$ret3=ExecSql($this->cn,$sql3);
|
|
} else
|
|
{
|
|
$tmp=pg_fetch_array($Ret,0);
|
|
$jft_id=$tmp['jft_id'];
|
|
}
|
|
// Special traitement
|
|
// quickcode
|
|
if ( $id == ATTR_DEF_QUICKCODE)
|
|
{
|
|
echo_debug("Modify ATTR_DEF_QUICKCODE");
|
|
$sql=sprintf("select update_quick_code(%d,'%s')",
|
|
$jft_id,FormatString($value));
|
|
ExecSql($this->cn,$sql);
|
|
continue;
|
|
}
|
|
// name
|
|
if ( $id == ATTR_DEF_NAME )
|
|
{
|
|
echo_debug("Modify ATTR_DEF_NAME");
|
|
if ( strlen(trim($value)) == 0 )
|
|
continue;
|
|
|
|
|
|
}
|
|
if ( $id == ATTR_DEF_STOCK ) {
|
|
$st=CountSql($this->cn,'select * from stock_goods where '.
|
|
" f_id=".$this->id);
|
|
if ( $st == 0 ) {
|
|
$user=new User($this->cn);
|
|
$exercice=$user->get_exercice();
|
|
if ( $exercice == 0 ) throw Exception ('Annee invalide erreur');
|
|
|
|
$str_stock=sprintf('insert into stock_goods(f_id,sg_quantity,sg_comment,sg_code,sg_type,sg_exercice) '.
|
|
' values (%d,0,\'%s\',upper(\'%s\'),\'d\',\'%s\')',
|
|
$this->id,
|
|
'initial',
|
|
FormatString($value),
|
|
$exercice);
|
|
|
|
ExecSql($this->cn,$str_stock);
|
|
}else {
|
|
$str_stock=sprintf("update stock_goods set sg_code=upper('%s') where f_id=%d",
|
|
FormatString($value),
|
|
$this->id);
|
|
ExecSql($this->cn,$str_stock);
|
|
}
|
|
}
|
|
|
|
// account
|
|
if ( $id == ATTR_DEF_ACCOUNT )
|
|
{
|
|
echo_debug("Modify ATTR_DEF_ACCOUNT");
|
|
$v=FormatString($value);
|
|
echo_debug("Value = $v");
|
|
if ( isNumber($v) == 1 )
|
|
{
|
|
$sql=sprintf("select account_update(%d,%d)",
|
|
$this->id,$v);
|
|
try {
|
|
ExecSql($this->cn,$sql);
|
|
/* update also the jrnx */
|
|
$sql='update jrnx set j_poste=$1 where j_qcode in (select quick_code from vw_fiche_attr where f_id=$2)';
|
|
ExecSqlParam($this->cn,
|
|
$sql,
|
|
array($v,$this->id));
|
|
|
|
} catch (Exception $e) {
|
|
throw new Exception(__LINE__."Erreur : ce compte [$v] n'a pas de compte parent.".
|
|
"L'opération est annulée");
|
|
}
|
|
continue;
|
|
}
|
|
if ( strlen (trim($v)) == 0 )
|
|
{
|
|
|
|
$sql=sprintf("select account_update(%d,null)",
|
|
$this->id);
|
|
try {
|
|
$Ret=ExecSql($this->cn,$sql);
|
|
/* update also the jrnx */
|
|
|
|
$sql='update jrnx set j_poste=$1 where j_qcode in (select quick_code from vw_fiche_attr where f_id=$2)';
|
|
ExecSqlParam($this->cn,
|
|
$sql,
|
|
array($v,$this->id));
|
|
|
|
} catch (Exception $e) {
|
|
throw new Exception(__LINE__."Erreur : ce compte [$v] n'a pas de compte parent.".
|
|
"L'opération est annulée");
|
|
}
|
|
|
|
continue;
|
|
}
|
|
}
|
|
// TVA
|
|
if ( $id == ATTR_DEF_TVA )
|
|
{
|
|
echo_debug("Modify ATTR_DEF_TVA");
|
|
// Verify if the rate exists, if not then do not update
|
|
if ( strlen(trim($value)) != 0 )
|
|
{
|
|
if ( CountSql($this->cn,"select * from tva_rate where tva_id=".$value) == 0)
|
|
{
|
|
echo_debug("class_fiche",__LINE__,"Tva invalide $value");
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
if ( $id == ATTR_DEF_COMPANY )
|
|
{
|
|
$exist=CountSql($this->cn,"select f_id from fiche join fiche_def using (fd_id) ".
|
|
" join jnt_fic_att_value using (f_id) join attr_value using (jft_id) ".
|
|
" where frd_id in (8,9,14) and ad_id=".ATTR_DEF_QUICKCODE.
|
|
" and av_text='".FormatString($value)."'");
|
|
|
|
|
|
if ( $exist == 0 && FormatString($value) != null )
|
|
{
|
|
$value="Attention : pas de société ";
|
|
}
|
|
}
|
|
|
|
// Normal traitement
|
|
$value2=FormatString($value);
|
|
$sql=sprintf("update attr_value set av_text='%s' where jft_id=%d",
|
|
trim($value2),$jft_id);
|
|
ExecSql($this->cn,$sql);
|
|
}
|
|
} catch (Exception $e ) {
|
|
echo '<span class="error">'.
|
|
$e->getMessage().
|
|
'</span>';
|
|
Rollback($this->cn);
|
|
return;
|
|
}
|
|
Commit($this->cn);
|
|
return;
|
|
|
|
}
|
|
/*!\brief remove a card
|
|
*/
|
|
function remove()
|
|
{
|
|
if ( $this->id==0 ) return;
|
|
// verify if that card has not been used is a ledger
|
|
// if the card has its own account in PCMN
|
|
// Get the fiche_def.fd_id from fiche.f_id
|
|
$this->Get();
|
|
$fiche_def=new fiche_def($this->cn,$this->fiche_def);
|
|
$fiche_def->Get();
|
|
|
|
// if the card is used do not removed it
|
|
$qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
|
|
|
|
if ( CountSql($this->cn,"select * from jrnx where j_qcode='".pg_escape_string($qcode)."'") != 0)
|
|
{
|
|
echo "<SCRIPT> alert('Impossible cette fiche est utilisée dans un journal'); </SCRIPT>";
|
|
return;
|
|
}
|
|
|
|
if ( $fiche_def->create_account=='t' ) {
|
|
// Retrieve the 'poste comptable'
|
|
$class=$this->strAttribut(ATTR_DEF_ACCOUNT);
|
|
$is_used_jrnx=0;
|
|
if ( trim(strlen($class)) != 0 && isNumber($class) == 1 )
|
|
$is_used_jrnx= CountSql($this->cn,"select * from jrnx where j_poste=$class");
|
|
// if class is not NULL and if we use it before, we can't remove it
|
|
if (FormatString($class) != null && $is_used_jrnx != 0 )
|
|
{
|
|
echo "<SCRIPT> alert('Impossible ce poste est utilisée dans un journal'); </SCRIPT>";
|
|
return;
|
|
}
|
|
else
|
|
// Remove in PCMN
|
|
if ( trim(strlen($class)) != 0 && isNumber($class) == 1 && $is_used_jrnx == 0)
|
|
{
|
|
ExecSql($this->cn,"delete from tmp_pcmn where pcm_val=$class");
|
|
}
|
|
|
|
}
|
|
$this->delete();
|
|
}
|
|
|
|
|
|
/*!\brief return the name of a card
|
|
*/
|
|
function getName()
|
|
{
|
|
$sql="select av_text from jnt_fic_att_value join attr_value
|
|
using (jft_id) where ad_id=1 and f_id=".$this->id;
|
|
$Res=ExecSql($this->cn,$sql);
|
|
$r=pg_fetch_all($Res);
|
|
if ( sizeof($r) == 0 )
|
|
return 1;
|
|
return $r[0]['av_text'];
|
|
}
|
|
|
|
/*!\brief return the quick_code of a card
|
|
* \return null if not quick_code is found
|
|
*/
|
|
function get_quick_code()
|
|
{
|
|
$sql="select av_text from jnt_fic_att_value join attr_value
|
|
using (jft_id) where ad_id=23 and f_id=".$this->id;
|
|
$Res=ExecSql($this->cn,$sql);
|
|
$r=pg_fetch_all($Res);
|
|
if ( sizeof($r) == 0 )
|
|
return null;
|
|
return $r[0]['av_text'];
|
|
}
|
|
|
|
/*!\brief Synonum of fiche::getAttribut
|
|
*/
|
|
function Get()
|
|
{
|
|
echo_debug('class_client',__LINE__,'Get');
|
|
fiche::getAttribut();
|
|
}
|
|
/*!\brief get all the card thanks the fiche_def_ref
|
|
* \param $p_offset (default =-1)
|
|
* \param $p_search sql condition
|
|
* \return fiche::GetByDef
|
|
*/
|
|
function GetAll($p_offset=-1,$p_search="")
|
|
{
|
|
return fiche::GetByDef($this->fiche_def_ref,$p_offset,$p_search);
|
|
}
|
|
/*!\brief retrieve the frd_id of the fiche it is the type of the
|
|
* card (bank, purchase...)
|
|
* (fiche_def_ref primary key)
|
|
*/
|
|
function get_fiche_def_ref_id()
|
|
{
|
|
$result=get_array($this->cn,"select frd_id from fiche join fiche_Def using (fd_id) where f_id=".$this->id);
|
|
if ( $result == null )
|
|
return null;
|
|
|
|
return $result[0]['frd_id'];
|
|
}
|
|
|
|
/*!
|
|
* \brief Get data for poste
|
|
*
|
|
* \param $p_from periode from
|
|
* \param $p_to end periode
|
|
* \return double array (j_date,deb_montant,cred_montant,description,jrn_name,j_debit,jr_internal)
|
|
* (tot_deb,tot_credit
|
|
*
|
|
*/
|
|
function get_row($p_from,$p_to)
|
|
{
|
|
if ( $this->id == 0 )
|
|
{
|
|
echo_error("class_fiche",__LINE__,"id is 0");
|
|
return;
|
|
}
|
|
$qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
|
|
$periode=sql_filter_per($this->cn,$p_from,$p_to,'p_id','jr_tech_per');
|
|
|
|
$Res=ExecSql($this->cn,"select to_char(j_date,'DD.MM.YYYY') as j_date,j_qcode,".
|
|
"case when j_debit='t' then j_montant else 0 end as deb_montant,".
|
|
"case when j_debit='f' then j_montant else 0 end as cred_montant,".
|
|
" jr_comment as description,jrn_def_name as jrn_name,".
|
|
"j_debit, jr_internal,jr_id ".
|
|
" from jrnx left join jrn_def on jrn_def_id=j_jrn_def ".
|
|
" left join jrn on jr_grpt_id=j_grpt".
|
|
" where j_qcode='".$qcode."' and ".$periode.
|
|
" order by j_date::date");
|
|
$array=array();
|
|
$tot_cred=0.0;
|
|
$tot_deb=0.0;
|
|
$Max=pg_NumRows($Res);
|
|
if ( $Max == 0 ) return null;
|
|
for ($i=0;$i<$Max;$i++) {
|
|
$array[]=pg_fetch_array($Res,$i);
|
|
if ($array[$i]['j_debit']=='t') {
|
|
$tot_deb+=$array[$i]['deb_montant'] ;
|
|
} else {
|
|
$tot_cred+=$array[$i]['cred_montant'] ;
|
|
}
|
|
}
|
|
$this->row=$array;
|
|
return array($array,$tot_deb,$tot_cred);
|
|
}
|
|
/*!
|
|
* \brief HtmlTable, display a HTML of a card for the asked period
|
|
* \param none
|
|
*
|
|
* \return none
|
|
*/
|
|
function HtmlTableDetail($p_array=null)
|
|
{
|
|
if ( $p_array == null)
|
|
$p_array=$_REQUEST;
|
|
|
|
$name=$this->getName();
|
|
|
|
list($array,$tot_deb,$tot_cred)=$this->get_row( $p_array['from_periode'],
|
|
$p_array['to_periode']
|
|
);
|
|
|
|
if ( count($this->row ) == 0 )
|
|
return;
|
|
|
|
$rep="";
|
|
|
|
echo '<h2 class="info">'.$this->id." ".$name.'</h2>';
|
|
echo "<TABLE class=\"result\" width=\"100%\">";
|
|
echo "<TR>".
|
|
"<TH> Code interne </TH>".
|
|
"<TH> Date</TH>".
|
|
"<TH> Description </TH>".
|
|
"<TH> Montant </TH>".
|
|
"<TH> Débit/Crédit </TH>".
|
|
"</TR>";
|
|
|
|
foreach ( $this->row as $op ) {
|
|
echo "<TR style=\"text-align:center;background-color:lightgrey\">".
|
|
"<td >".$op['jr_internal']."</td>".
|
|
"<td >".$op['j_date']."</td>".
|
|
"<td >".$op['description']."</td>".
|
|
"<td >"."</td>".
|
|
"<td >"."</td>".
|
|
"</TR>";
|
|
$ac=new Acc_Operation($this->cn);
|
|
$ac->jr_id=$op['jr_id'];
|
|
echo $ac->display_jrnx_detail(1);
|
|
|
|
}
|
|
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
|
|
$diff=round(abs($tot_deb-$tot_cred),2);
|
|
echo "<TR>".
|
|
"<TD>$solde_type".
|
|
"<TD>$diff</TD>".
|
|
"<TD></TD>".
|
|
"<TD>$tot_deb</TD>".
|
|
"<TD>$tot_cred</TD>".
|
|
"</TR>";
|
|
|
|
echo "</table>";
|
|
|
|
return;
|
|
}
|
|
/*!
|
|
* \brief HtmlTable, display a HTML of a card for the asked period
|
|
* \param $p_array default = null keys = from_periode, to_periode
|
|
*/
|
|
function HtmlTable($p_array=null)
|
|
{
|
|
if ( $p_array == null)
|
|
$p_array=$_REQUEST;
|
|
|
|
$name=$this->getName();
|
|
|
|
list($array,$tot_deb,$tot_cred)=$this->get_row( $p_array['from_periode'],
|
|
$p_array['to_periode']
|
|
);
|
|
|
|
if ( count($this->row ) == 0 )
|
|
return;
|
|
|
|
$rep="";
|
|
|
|
echo '<h2 class="info">'.$this->id." ".$name.'</h2>';
|
|
echo "<TABLE class=\"result\" width=\"100%\">";
|
|
echo "<TR>".
|
|
"<TH> Code interne </TH>".
|
|
"<TH> Date</TH>".
|
|
"<TH> Description </TH>".
|
|
"<TH> Débit </TH>".
|
|
"<TH> Crédit </TH>".
|
|
"</TR>";
|
|
|
|
foreach ( $this->row as $op ) {
|
|
echo "<TR>".
|
|
"<TD>".$op['jr_internal']."</TD>".
|
|
"<TD>".$op['j_date']."</TD>".
|
|
"<TD>".$op['description']."</TD>".
|
|
"<TD>".$op['deb_montant']."</TD>".
|
|
"<TD>".$op['cred_montant']."</TD>".
|
|
"</TR>";
|
|
|
|
}
|
|
$solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
|
|
$diff=round(abs($tot_deb-$tot_cred),2);
|
|
echo "<TR>".
|
|
"<TD>$solde_type</TD>".
|
|
"<TD>$diff</TD>".
|
|
"<TD></TD>".
|
|
"<TD>$tot_deb</TD>".
|
|
"<TD>$tot_cred</TD>".
|
|
"</TR>";
|
|
|
|
echo "</table>";
|
|
|
|
return;
|
|
}
|
|
/*!
|
|
* \brief Display HTML Table Header (button)
|
|
*
|
|
* \return none
|
|
*/
|
|
function HtmlTableHeader($p_array=null)
|
|
{
|
|
if ( $p_array == null)
|
|
$p_array=$_REQUEST;
|
|
|
|
$submit=new widget();
|
|
$hid=new widget("hidden");
|
|
echo '<div class="noprint">';
|
|
echo "<table >";
|
|
echo '<TR>';
|
|
|
|
echo '<TD><form method="GET" ACTION="">'.
|
|
widget::submit('bt_other',"Autre poste").
|
|
dossier::hidden().
|
|
$hid->IOValue("type","poste").$hid->IOValue('p_action','impress')."</form></TD>";
|
|
|
|
echo '<TD><form method="POST" ACTION="quick_code_pdf.php">'.
|
|
widget::submit('bt_pdf',"Export PDF").
|
|
dossier::hidden().
|
|
$hid->IOValue("type","poste").
|
|
$hid->IOValue('p_action','impress').
|
|
$hid->IOValue("f_id",$this->id).
|
|
dossier::hidden().
|
|
$hid->IOValue("from_periode",$p_array['from_periode']).
|
|
$hid->IOValue("to_periode",$p_array['to_periode']);
|
|
if (isset($p_array['oper_detail']))
|
|
echo $hid->IOValue('oper_detail','on');
|
|
|
|
echo "</form></TD>";
|
|
|
|
echo '<TD><form method="POST" ACTION="quick_code_csv.php">'.
|
|
widget::submit('bt_csv',"Export CSV").
|
|
dossier::hidden().
|
|
$hid->IOValue("type","poste").
|
|
$hid->IOValue('p_action','impress').
|
|
$hid->IOValue("f_id",$this->id).
|
|
$hid->IOValue("from_periode",$p_array['from_periode']).
|
|
$hid->IOValue("to_periode",$p_array['to_periode']);
|
|
if (isset($p_array['oper_detail']))
|
|
echo $hid->IOValue('oper_detail','on');
|
|
|
|
echo "</form></TD>";
|
|
echo "</table>";
|
|
echo '</div>';
|
|
|
|
}
|
|
/*!
|
|
* \brief give the balance of an card
|
|
* \return
|
|
* balance of the card
|
|
*
|
|
*/
|
|
function get_solde_detail($p_cond="") {
|
|
if ( $this->id == 0 ) exit('fiche->id est nul');
|
|
$qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
|
|
|
|
if ( $p_cond != "") $p_cond=" and ".$p_cond;
|
|
$Res=ExecSql($this->cn,"select sum(deb) as sum_deb, sum(cred) as sum_cred from
|
|
( select j_poste,
|
|
case when j_debit='t' then j_montant else 0 end as deb,
|
|
case when j_debit='f' then j_montant else 0 end as cred
|
|
from jrnx
|
|
where
|
|
j_qcode = ('$qcode'::text)
|
|
$p_cond
|
|
) as m ");
|
|
$Max=pg_NumRows($Res);
|
|
if ($Max==0) return 0;
|
|
$r=pg_fetch_array($Res,0);
|
|
|
|
return array('debit'=>$r['sum_deb'],
|
|
'credit'=>$r['sum_cred'],
|
|
'solde'=>abs($r['sum_deb']-$r['sum_cred']));
|
|
}
|
|
/*!\brief check if an attribute is empty
|
|
*\param
|
|
*\return return true is the attribute is empty or missing
|
|
*/
|
|
function empty_attribute($p_attr) {
|
|
$sql="select av_text
|
|
from jnt_fic_att_value
|
|
natural join fiche
|
|
natural join attr_value
|
|
left join attr_def using (ad_id) where f_id=".$this->id.
|
|
" and ad_id = ".$p_attr.
|
|
" order by ad_id";
|
|
$res=ExecSql($this->cn,$sql);
|
|
if ( pg_NumRows($res) == 0 ) return true;
|
|
$text=pg_fetch_result($res,0,0);
|
|
return (strlen(trim($text)) > 0)?false:true;
|
|
|
|
|
|
}
|
|
|
|
/*!
|
|
* \brief get the fd_id of the card : fd_id, it set the attribute fd_id
|
|
*/
|
|
function get_categorie()
|
|
{
|
|
if ( $this->id == 0 ) exit('class_fiche : f_id = 0 ');
|
|
$sql='select fd_id from fiche where f_id='.$this->id;
|
|
$R=getDbValue($this->cn,$sql);
|
|
if ( $R == "" )
|
|
$this->fd_id=0;
|
|
else
|
|
$this->fd_id=$R;
|
|
}
|
|
/*!
|
|
***************************************************
|
|
* \brief Check if a fiche is used by a jrn
|
|
* return 1 if the fiche is in the range otherwise 0, the quick_code
|
|
* or the id must be set
|
|
*
|
|
*
|
|
* \param $p_jrn journal_id
|
|
* \param $p_type : deb or cred default empty
|
|
*
|
|
*\todo fiche::belong_ledger this function will replace fiche_inc.php
|
|
*function isFicheOfJrn , it should be replaced everywhere in the code
|
|
*
|
|
* \return 1 if the fiche is in the range otherwise < 1
|
|
* -1 the card doesn't exist
|
|
* -2 the ledger has no card to check
|
|
*
|
|
*/
|
|
function belong_ledger($p_jrn,$p_type="")
|
|
{
|
|
// check if we have a quick_code or a f_id
|
|
if (($this->quick_code==null || $this->quick_code == "" )
|
|
&& $this->id == 0 ) {
|
|
echo 'erreur ni quick_code ni f_id ne sont donnes';
|
|
exit();
|
|
}
|
|
|
|
//retrieve the quick_code
|
|
if ( $this->quick_code=="")
|
|
$this->quick_code=$this->get_quick_code();
|
|
|
|
|
|
if ( $this->quick_code==null)
|
|
return -1;
|
|
|
|
if ( $this->id == 0 )
|
|
if ( $this->get_by_qcode(null,false) == 1)
|
|
return -1;
|
|
|
|
$get="";
|
|
if ( $p_type == 'deb' ) {
|
|
$get='jrn_def_fiche_deb';
|
|
}
|
|
if ( $p_type == 'cred' ) {
|
|
$get='jrn_def_fiche_cred';
|
|
}
|
|
if ( $get != "" ) {
|
|
$Res=ExecSql($this->cn,"select $get as fiche from jrn_def where jrn_def_id=$p_jrn");
|
|
} else {
|
|
// Get all the fiche type (deb and cred)
|
|
$Res=ExecSql($this->cn," select jrn_def_fiche_cred as fiche
|
|
from jrn_def where jrn_def_id=$p_jrn
|
|
union
|
|
select jrn_def_fiche_deb
|
|
from jrn_def where jrn_def_id=$p_jrn"
|
|
);
|
|
}
|
|
$Max=pg_NumRows($Res);
|
|
if ( $Max==0) {
|
|
return -2;
|
|
}
|
|
/* convert the array to a string */
|
|
$list=pg_fetch_all($Res);
|
|
$str_list="";
|
|
$comma='';
|
|
foreach ($list as $row) {
|
|
if ( $row['fiche'] != '' ) {
|
|
$str_list.=$comma.$row['fiche'];
|
|
$comma=',';
|
|
}
|
|
}
|
|
// Normally Max must be == 1
|
|
|
|
if ( $str_list=="") {
|
|
return -3;
|
|
}
|
|
|
|
$sql="select *
|
|
from fiche
|
|
where
|
|
fd_id in (".$str_list.") and f_id= ".$this->id;
|
|
|
|
$Res=ExecSql($this->cn,$sql);
|
|
$Max=pg_NumRows($Res);
|
|
if ($Max==0 )
|
|
return 0;
|
|
else
|
|
return 1;
|
|
}
|
|
/*!\brief get all the card from a categorie
|
|
*\param $p_cn database connx
|
|
*\param $pFd_id is the category id
|
|
*\return an array of card, but only the fiche->id is set
|
|
*/
|
|
static function get_fiche_def($p_cn,$pFd_id) {
|
|
$sql='select f_id from fiche where fd_id=$1';
|
|
$array=get_array($p_cn,$sql,array($pFd_id));
|
|
if ( empty ($array) ) return null;
|
|
foreach ($array as $ret ) {
|
|
$r[]=new fiche($p_cn,$ret['f_id']);
|
|
}
|
|
return $r;
|
|
}
|
|
/*!\brief check if a card is used
|
|
*\return return true is a card is used otherwise false
|
|
*/
|
|
function is_used() {
|
|
/* retrieve first the quickcode */
|
|
$qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
|
|
$sql='select count(*) as c from jrnx where j_qcode=$1';
|
|
$count=getDbValue($this->cn,$sql,array($qcode));
|
|
if ( $count == 0 ) return false;
|
|
return true;
|
|
}
|
|
/*\brief remove a card without verification */
|
|
function delete() {
|
|
// Remove from attr_value
|
|
$Res=ExecSql($this->cn,"delete from attr_value
|
|
where jft_id in (select jft_id
|
|
from jnt_fic_att_value
|
|
natural join fiche where f_id=".$this->id.")");
|
|
// Remove from jnt_fic_att_value
|
|
$Res=ExecSql($this->cn,"delete from jnt_fic_att_value where f_id=".$this->id);
|
|
|
|
// Remove from fiche
|
|
$Res=ExecSql($this->cn,"delete from fiche where f_id=".$this->id);
|
|
|
|
}
|
|
}
|
|
?>
|