summaryrefslogtreecommitdiff
path: root/doc/faq.html
blob: e8fc94367463eb98a7ba7d261c1b82cd60a6902b (plain)
  1. <ul>
  2. <p><li><h4>PostgreSQL 8.x</h4>
  3. PostgreSQL added a restriction in v8.x that a sequence cannot be dropped
  4. after if it is referenced by a table. However backups created with
  5. LedgerSMB v2.6.13 and earlier have a DROP SEQUENCE step in the backup
  6. which will fail. To fix this edit the backup before restoring on a 8.x
  7. system.
  8. <p>This typically looks like this:
  9. <pre>
  10. DROP SEQUENCE id ;
  11. CREATE SEQUENCE id START 10579;
  12. --
  13. DROP SEQUENCE invoiceid ;
  14. CREATE SEQUENCE invoiceid START 11096;
  15. --
  16. DROP SEQUENCE orderitemsid ;
  17. CREATE SEQUENCE orderitemsid START 178;
  18. --
  19. DROP SEQUENCE jcitemsid ;
  20. CREATE SEQUENCE jcitemsid START 53;
  21. </pre>
  22. <p>Change it to:
  23. <pre>
  24. CREATE SEQUENCE id;
  25. SELECT SETVAL('id', 10579);
  26. CREATE SEQUENCE invoiceid;
  27. SELECT SETVAL('invoiceid', 11096);
  28. CREATE SEQUENCE orderitemsid;
  29. SELECT SETVAL('orderitemsid', 178);
  30. CREATE SEQUENCE jcitemsid;
  31. SELECT SETVAL('jcitemsid', 53);
  32. </pre>
  33. <p><li><h4>PostgreSQL template1</h4>
  34. template1 is a template to build new databases
  35. from. Anything you put into template1 will be copied to a new database.
  36. So when you try to create a new dataset, the tables are already created from
  37. template1 and when LedgerSMB tries to create them you'll get an error that
  38. the tables already exist.
  39. <p><li><h4>PostgreSQL 8.0+</h4>
  40. To use LedgerSMB with 8.0+ you have to modify Pg-tables.sql The file
  41. is in the sql directory.
  42. <pre>
  43. CREATE TABLE orderitems (
  44. trans_id int,
  45. parts_id int,
  46. description text,
  47. qty float4,
  48. sellprice float8,
  49. discount float4,
  50. unit varchar(5),
  51. project_id int,
  52. reqdate date,
  53. ship float4,
  54. serialnumber text,
  55. id int default nextval('orderitemsid')
  56. ) WITH OIDS;
  57. CREATE TABLE inventory (
  58. warehouse_id int,
  59. parts_id int,
  60. trans_id int,
  61. orderitems_id int,
  62. qty float4,
  63. shippingdate date,
  64. employee_id int
  65. ) WITH OIDS;
  66. CREATE TABLE assembly (
  67. id int,
  68. parts_id int,
  69. qty float,
  70. bom bool,
  71. adj bool
  72. ) WITH OIDS;
  73. </pre>
  74. This change is only required for LedgerSMB versions 2.6.3 and below.
  75. <p>If you already built a dataset without this change you will get
  76. an error when you try to save a PO or assembly.
  77. <p>"ERROR: column "oid" does not exist"
  78. <p>Drop the tables and rebuild WITH OIDS.
  79. <p><li><h4>Japanese characters</h4>
  80. modify apache so that EUC_JP is the main additional language.
  81. <br>comment out all unrelated languages except, UTF_8 shift jis, EUC_JP
  82. <br>restart apache
  83. <br>Fire up psql and do the encoding as per the table:-
  84. <br>Table 5-2. Postgres Client/Server Character Set Encodings
  85. <p>Server Encoding Available Client Encodings
  86. <br>EUC_JP EUC_JP, SJIS
  87. <br>EUC_TW EUC_TW, BIG5
  88. <br>LATIN2 LATIN2, WIN1250
  89. <br>LATIN5 LATIN5, WIN, ALT
  90. <br>MULE_INTERNAL EUC_JP, SJIS, EUC_KR, EUC_CN, EUC_TW, BIG5, LATIN1 to LATIN5, WIN, ALT, WIN1250
  91. <p>Create the dataset from admin.pl, now the Japanese shows up in multibyte encoding
  92. <p>Now you can write in Hiragana, Katakana, Kanji and English
  93. <p><li><h4>Error posting a check/receipt</h4>
  94. <pre>
  95. DBD::Pg::db do failed: ERROR: syntax error at or near "," at character 114
  96. Error!
  97. INSERT INTO acc_trans (trans_id, chart_id, transdate,amount)
  98. VALUES (13314, , '03-22-2005',1.00 * 1)
  99. ERROR: syntax error at or near "," at character 114 </pre>
  100. This error is caused by a transaction which does not have links to
  101. an AR/AP account.
  102. <br>set up your chart of accounts properly and create at least one
  103. AR and AP account. Then edit all your transactions and repost.
  104. <p><li><h4>SELinux</h4>
  105. <a href=http://fedora.redhat.com/docs/selinux-faq-fc3/index.html>http://fedora.redhat.com/docs/selinux-faq-fc3/index.html</a>
  106. <p>modify /etc/selinux/conf and set SELINUX=permissive
  107. <p>use audit2allow and add the following to policy.conf,
  108. then run "make reload"
  109. <p>#line 83
  110. <br>allow httpd_sys_script_t port_type:{ tcp_socket udp_socket } { send_msg
  111. recv_msg };
  112. <br>allow httpd_sys_script_t sysctl_kernel_t:dir search;
  113. <br>allow httpd_sys_script_t sysctl_t:dir search;
  114. <br>allow httpd_sys_script_t tmp_t:sock_file write;
  115. <br>allow httpd_sys_script_t httpd_sys_content_t:lnk_file read;
  116. <br>allow httpd_sys_script_t sysctl_kernel_t:file read;
  117. <br>allow httpd_sys_script_t unconfined_t:unix_stream_socket connectto;
  118. <p><li><h4>session timeouts</h4>
  119. If you get frequent timeouts or can't even log in synchronize
  120. the clocks from the server and workstation.
  121. <p><li><h4>lineitems not printing</h4>
  122. Templates designed on a UNIX platform don't work on a DOS platform.
  123. To make them work load the template either with the builtin template editor
  124. or a text editor and save. Templates designed on a Windows platform have the
  125. same problem and won't work on a UNIX platform. Once you strip the ^M's
  126. the'll work just fine.
  127. <p><li><h4>UTF-8 character encoding</h4>
  128. Most of the translations are in ISO format. To convert the translations
  129. change directory to locale/cc and convert the files with iconv to UTF-8.
  130. You should also convert the COAs too and make sure you select UTF-8
  131. encoding when you set up a new dataset.
  132. <p><li><h4>characterset problems</h4>
  133. If you have problems displaying the correct characterset try adding
  134. <pre>
  135. AddDefaultCharset On</pre>
  136. in your httpd.conf file.
  137. <p><li><h4>About installation</h4>
  138. The easiest is to use the setup.pl script as root.
  139. You don't need to know very much about your system, just login as root,
  140. run 'perl setup.pl' and follow the prompts.
  141. <p>setup.pl does not check for missing software packages and it is your
  142. responsibilite to make sure you have the required software
  143. installed either from source or from a package.
  144. <p>Requirements are clearly indicated in the README file and on the
  145. download page.
  146. <p><li><h4>cannot create function</h4>
  147. <ol>
  148. <li>either run createlang and install the plpgsql language handler or
  149. install yourself. For more information how to do that, visit
  150. <a href=http://www.postgresql.org/docs/>PostgreSQL</a> and
  151. read the interactive documentation for procedural languages.
  152. <li>load admin.pl
  153. <li>unlock the system
  154. <li>login
  155. </ol>
  156. <p><li><h4>The requested URL /ledger-smb/admin.pl was not found</h4>
  157. Your webserver doesn't know where to find the script. Most commonly this
  158. is from distributions hiding webserver configuration files in different
  159. locations or files and setup.pl wasn't able to configure the location for
  160. you. Find out which file (httpd.conf, httpdcommon.conf, ...)
  161. controls your webserver configuration and add
  162. <pre>
  163. # LedgerSMB
  164. Include /etc/httpd/ledger-smb-httpd.conf</pre>
  165. Create a file 'ledger-smb-httpd.conf' in /etc/httpd and copy the next part
  166. into the file.
  167. <pre>
  168. AddHandler cgi-script .pl
  169. AddDefaultCharset On
  170. Alias /ledger-smb /var/www/ledger-smb/
  171. &lt;Directory /var/www/ledger-smb&gt;
  172. Options ExecCGI Includes FollowSymlinks
  173. &lt;/Directory&gt;
  174. &lt;Directory /var/www/ledger-smb/users&gt;
  175. Order Deny,Allow
  176. Deny from All
  177. &lt;/Directory&gt;</pre>
  178. replace '/etc/httpd' and '/var/www' with the appropriate directories.
  179. <p><li><h4>users/members : Permission denied</h4>
  180. Your webserver must have write access to the users directory.
  181. If your server runs as user/group 'apache:apache' then set the
  182. users directory to owner/group apache:apache.
  183. <pre>
  184. # chown -R apache:apache users</pre>
  185. <p><li><h4>Dataset newer than version</h4>
  186. You are trying to use an older version with a dataset which was
  187. created with a newer version.
  188. <p><li><h4>PDF option not working</h4>
  189. Check if you have latex and pdflatex installed.
  190. <p><li><h4>Apache 2.0 "error 500"</h4>
  191. Some of the early versions of Apache 2.0 (< patchlevel 44) had a rewrite engine
  192. which decoded escaped strings. This created a lot of problems and I worked
  193. around it by escaping strings twice.
  194. If you get a server 500 error 'filename too long' or if collapsed menus
  195. don't expand you may have to adjusted the following code in
  196. SL/Form.pm and change the number (44) on line 84.
  197. <pre>
  198. # for Apache 2 we escape strings twice
  199. if (($ENV{SERVER_SIGNATURE} =~ /Apache\/2\.(\d+)\.(\d+)/) && !$beenthere) {
  200. $str = $self->escape($str, 1) if $2 < 44;
  201. }</pre>
  202. <p><li><h4>IDENT Authentication failed for user "sledger-smb"</h4>
  203. Edit pg_hba.conf and change authentication to
  204. <pre>
  205. local all all MD5</pre>
  206. The file is in the 'data' directory of your postgresql installation.
  207. This is different with every distribution so look for it.
  208. <pre>
  209. # find / -name 'pg_hba.conf'</pre>
  210. <p>Some people can't read and seem to think 'localhost' is just some
  211. fancy word for a local machine.
  212. 'localhost' is a host like any other host on a network.
  213. A 'local' entry in pg_hba.conf will allow socket connections ONLY and
  214. not allow a host connection. If you then try to connect to 'localhost'
  215. postgres will come back with an authentication error.
  216. <p>So, forget you ever heard there is such a thing as 'localhost' and leave
  217. the Host portion blank.
  218. <p><b>WARNING!</b> DO NOT just put a 'host all all trust' in pg_hba.conf
  219. unless you know what you are doing.
  220. <p><li><h4>DBD-Pg for Mandrake 9.0</h4>
  221. Mandrake did not package a compiled DBD-Pg package again, so install DBD-Pg
  222. from the source package.
  223. Install perl-DBD-Pg-1.01-4mdk.i586.rpm from the 'contrib' area.
  224. (Mandrake / 9.0 / contrib / RPMS)
  225. <p><li><h4>LaTeX error</h4>
  226. If for some reason LaTeX produces an error message check for strange
  227. characters in your account description and parts description
  228. and use \usepackage[latin1]{inputenc} in the preamble.
  229. <p><li><h4>LaTeX templates</h4>
  230. If you don't want to edit tex code by hand,
  231. you could use Lyx, Abiword, or any WYSIWYG editor capable of exporting
  232. latex code.
  233. To do that you must change the tokens for the variables <% and %> to something
  234. like << and >>. % is the comment character in tex. There is also a
  235. pagebreak block which must be commented out.
  236. When you are done with the changes
  237. replace << and >> with <% and %> and uncomment the pagebreak block.
  238. <p>LaTeX is difficult but it also offers a much superior environment
  239. to produce professionally looking forms in postscript and PDF format.
  240. Unfortunately with all that power there is also a steep learning curve.
  241. <p><li><h4>W3M</h4>
  242. pass terminal=mozilla when you start w3m
  243. <pre>
  244. $ w3m -F http://localhost/ledger-smb/login.pl?terminal=mozilla</pre>
  245. To use without frames
  246. <pre>
  247. $ w3m http://localhost/ledger-smb/login.pl?terminal=lynx</pre>
  248. <p><li><h4>PDF option disappeared</h4>
  249. Edit ledger-smb.conf and set $latex = 1;
  250. <br>ledger-smb.conf is perl code, check if it compiles, if it does not,
  251. the internal defaults are used which turn off $latex, hence no PDF option.
  252. <p><li><h4>Installation on Windows (WIN32)</h4>
  253. <ul>
  254. <li>install Apache, perl,
  255. <a href=http://techdocs.postgresql.org/guides/InstallingOnWindows>Postgres</a>
  256. or Oracle, DBI and the appropriate DBD
  257. module
  258. <br>if you can't compile DBD-Pg here is a precompiled
  259. <a href=http://http://pgfoundry.org/projects/dbdpgppm/>DBD-Pg module</a>
  260. <li>download the latest version of <a
  261. href=http://ledger-smb.sourceforge.net>LedgerSMB</a>
  262. <li>extract the files to c:\apache\ledger-smb
  263. <li>run 'perl shebang' to change the first line of the scripts. If perl
  264. is not in c:\perl\bin' change '#!c:\\perl\\bin\\perl' to the location where
  265. your perl binary is.
  266. <li>edit c:\apache\conf\httpd.conf and add
  267. <pre>
  268. Alias /ledger-smb "c:/apache/ledger-smb/"
  269. &lt;Directory "c:/apache/ledger-smb"&gt;
  270. AllowOverride All
  271. AddHandler cgi-script .pl
  272. AddDefaultCharset On
  273. Options +ExecCGI
  274. Order Allow,Deny
  275. Allow from All
  276. &lt;/Directory&gt;
  277. &lt;Directory "c:/apache/ledger-smb/users"&gt;
  278. Order Deny,Allow
  279. Deny from All
  280. &lt;/Directory&gt;
  281. </pre>
  282. <li>start Apache
  283. <li>start Postgres|Oracle|DB2
  284. <li>connect to http://localhost/ledger-smb/admin.pl and set up users
  285. and datasets
  286. <li>connect to http://localhost/ledger-smb/login.pl and login
  287. </ul>
  288. <p><li><h4>What do I enter for the language</h4>
  289. If you use English, nothing, if you want to use a foreign language for
  290. the login screen and admin stuff enter the language code, this is the
  291. directory in the locale directory.
  292. <p><li><h4>printing to a printer</h4>
  293. Printers are defined in ledger-smb.conf
  294. <pre>
  295. %printer = ( 'Default' => 'lpr', 'Color' => 'lpr -PEpson' );</pre>
  296. Check in your /etc/printcap file for the names of available printers.
  297. <p>If you have LaTeX installed set
  298. <pre>
  299. $latex = 1</pre> in ledger-smb.conf
  300. <p>To send the document to the printer check the "Postscript" or "PDF" format,
  301. enter the number of copies and click on the "Print" button.
  302. <p>The printer you enter in your preferences is the default printer.
  303. You can choose any other available printer. This makes it possible
  304. to print from anywhere on the network to any printer.
  305. <p>Note: html format is for screen preview. Use the "Print" option from your
  306. browser to print to a printer.
  307. <p><li><h4>Using samba to send printjobs to a printer attached to a Windows XP workstation</h4>
  308. The next part applies to roll your own print filters only. If you use CUPS or
  309. LPRng your milage may vary but you can still use this as a guide how it works.
  310. I use the printer 'Epson' as an example which is
  311. attached to a XP workstation called Raven.
  312. <pre>
  313. /etc/printcap entry on the server which runs lpd
  314. epson:Epson\
  315. :sh:\
  316. :lp=/dev/null:\
  317. :sd=/var/spool/output/epson:\
  318. :if=/usr/libexec/lpr/epson/prnfilter:\
  319. # end of entry in /etc/printcap
  320. # prnfilter shell script
  321. #!/bin/sh
  322. # Filter for Epson Stylus
  323. PATH="$PATH:/usr/local/bin"
  324. #read first_line
  325. read tmp
  326. first_line=`echo $tmp | cut -b1-2 | sed -n '1p'`
  327. first_chr=`expr "$first_line" : '\(.\)'`
  328. first_two=`expr "$first_line" : '\(..\)'`
  329. rewindstdin
  330. if [ "$first_two" = "%!" ]; then # Postscript file
  331. gs @st640p.upp -dSAFER -dNOPAUSE -q -sOutputFile=/tmp/$$ -
  332. else
  333. # text file
  334. cat &gt; /tmp/$$
  335. echo -n "^L" &gt;&gt; /tmp/$$
  336. smbclient '\\Raven\Epson' "" -c 'printmode text'
  337. fi
  338. smbclient '\\Raven\Epson' "" -P -c "print /tmp/$$"
  339. rm /tmp/$$
  340. # EOF
  341. rewindstdin is a small program to rewind the filehandle for STDIN
  342. save the next part up to EOF to a file rewindstdin.c and compile
  343. #include &lt;sys/types.h&gt;
  344. #include &lt;unistd.h&gt;
  345. extern int errno;
  346. main()
  347. {
  348. if( lseek(0,0,0) == 0 ){
  349. errno = 0;
  350. }
  351. return( errno );
  352. }
  353. # EOF
  354. compile to an executable
  355. gcc -o /usr/local/bin/rewindstdin rewindstdin.c
  356. </pre>
  357. <p><li><h4>beginning balances</h4>
  358. Add a GL Journal entry and enter the beginning balance for your accounts.
  359. Beginning balances are the balances from your last balance sheet. If you also
  360. add open invoices to account for COGS for inventory, add the invoices
  361. and make the appropriate adjustments.
  362. <p><li><h4>establish a beginning inventory</h4>
  363. add the parts with a vendor invoice. Use the <b>real cost</b> for the items,
  364. not zero. If you use zero cost then the cost of goods will be zero when you
  365. sell the item.
  366. <p><li><h4>Assemblies</h4>
  367. Assemblies are manufactured goods assembled from parts, services and
  368. assemblies. Because you do not buy assemblies you 'stock assemblies' by
  369. adding assembled units to your inventory. The quantity for individual parts
  370. is reduced and the quantity for the assembly increased. To disassemble an
  371. assembly you simply return the parts to inventory by entering a negative
  372. quantity for the number of assemblies to stock.
  373. <p><li><h4>DBD-Pg not installed</h4>
  374. Most modern distributions now package DBD-Pg. If it is
  375. not packaged follow this recipe to get it working.
  376. <ul>
  377. <li>check if you have the header files for PostgreSQL
  378. <br>$ find / -name 'libpq-fe.h'
  379. <br>if nothing shows up install the development package for PostgreSQL
  380. <li>download and untar DBD-Pg
  381. <li>set the environment variables POSTGRES_LIB and POSTGRES_INCLUDE
  382. <li>cd to DBD-Pg directory
  383. <br>as ordinary user
  384. <br>$ perl Makefile.PL
  385. <br>$ make
  386. <br>$ make test
  387. <br>if all went well su to root
  388. <br># make install
  389. <li>remove DBD-Pg
  390. </ul>
  391. <p><li><h4>login.pl has compilation error</h4>
  392. This could be because of a missing configuration file in the users directory
  393. <p>check the permission for the users directory. The directory must be
  394. set writeable for the webserver. If your webserver runs ias user/group
  395. nobody.nogroup set the directory to
  396. <pre>
  397. drwx--x--x 2 nobody nogroup 1024 May 26 16:49 users
  398. or
  399. drwxrwx--x 2 johndoe nogroup 1024 May 26 16:49 users</pre>
  400. <p><li><h4>script not executing, shows in browser instead</h4>
  401. Add
  402. <pre>
  403. AddHandler cgi-script .pl</pre>
  404. in your httpd.conf file.
  405. <p><li><h4>unknown terminal!</h4>
  406. the frontend script couldn't figure out which browser you are using
  407. <p>include the terminal variable on the URL
  408. <pre>
  409. http://localhost/ledger-smb/login.pl?terminal=lynx</pre>
  410. Valid terminal variables are lynx, mozilla and js
  411. <p><li><h4>permission denied</h4>
  412. Check if your web server has write permission to write to the following
  413. files and directories:
  414. <pre>
  415. users/
  416. templates/
  417. users/members
  418. # chown nobody:nogroup users templates users/members
  419. </pre>
  420. <p><li><h4>permission denied to access tables</h4>
  421. The user you entered in the "Database section" must be a valid
  422. database user who has rights to access the tables.
  423. <p>If the tables are owned by 'joe' and you enter 'mary' as the dba
  424. you might run into this problem if mary doesn't have the rights to
  425. access tables owned by joe.
  426. <p><li><h4>html and graphics files don't show up on screen</h4>
  427. Enable Includes and FollowSymlinks Options in your httpd.conf file
  428. <pre>
  429. &lt;Directory /usr/local/ledger-smb&gt;
  430. Options ExecCGI Includes FollowSymlinks
  431. &lt;/Directory&gt;
  432. </pre>
  433. <p><li><h4>switch display to a foreign language</h4>
  434. Load your preferences and select the language.
  435. <br>Language selection is in accordance to
  436. <a href=http://www.unece.org/cefact/locode/service/main.htm>
  437. ISO 3166-1</a> standards.
  438. <p><li><h4>Text shows in English when I use a foreign language</h4>
  439. This is because the corresponding hash entry is missing.
  440. Add the missing text in the locale/cc/all or locale/cc/missing
  441. file and run 'perl locales.pl' from the command line to rebuild
  442. the individual files.
  443. <br>cc refers to the country code.
  444. <p><li><h4>switch to a foreign language for the login and admin screen</h4>
  445. Edit ledger-smb.conf and enter the code for the $language variable
  446. <pre>
  447. $language = "de";</pre>
  448. <p>This is a global change and applies to all logins, individual settings
  449. may be changed by setting the language in your Preferences.
  450. </ul>
  451. <p>
  452. <hr>
  453. <a name=security>
  454. <h1>LedgerSMB security</h1>
  455. </a>
  456. <ul>
  457. <li>The security features built into LedgerSMB provide encrypted passwords
  458. and access control which makes it fairly safe out of the box to run even in
  459. front of a firewall.
  460. Some precautions which are out of our control must be taken though.
  461. It matters where you install SL and how you configure your web server and
  462. SQL server.
  463. <pre>
  464. Typical setups:
  465. /usr/local/vh/www <- DocumentRoot for virtual host
  466. /usr/local/vh/ledger-smb <- Alias for ledger-smb
  467. /usr/local/vh/users <- users directory out of reach
  468. <hr width=60% align=left>
  469. /usr/local/vh/www <- DocumentRoot for virtual host
  470. /usr/local/vh/www/ledger-smb <- Alias for ledger-smb
  471. /usr/local/vh/www/ledger-smb/users <- users configuration files and tmp space
  472. &lt;Directory /usr/local/vh/www/ledger-smb/users&gt; <- disable webserver access
  473. Order Deny,Allow for users directory
  474. Deny from All
  475. &lt;/Directory&gt;
  476. </pre>
  477. The location for the users directory can be specified in ledger-smb.conf
  478. <p><li>Set permission for the users and templates directory to 711
  479. <p><li>If you do not want anyone to change the templates with the built-in
  480. editor set the files in templates/directory/ to read only or disable
  481. the menu item to edit the templates.
  482. <p><li>You can set up a read-only environment if you disable the menu items
  483. to add data. i.e 'Add Transaction' if unchecked you will not be able to add
  484. a transaction or repost a transaction. You may look at it but nothing else.
  485. <p><li>There are various settings for audit control and you may disable
  486. reposting entirely or up to a certain date. And with the audit trail enabled
  487. you can keep tab of who is doing what.
  488. <p><li>For PostgreSQL you may also set who has access to the server in the file
  489. pg_hba.conf
  490. <br>Authentication crypt does not work because not all SQL servers
  491. accept encrypted passwords.
  492. <p><li>in addition you can secure the tables from unauthorized access by
  493. setting up a different database user and GRANT rights. For instance,
  494. users without DELETE rights will still be able to use the program, change
  495. customers and vendors, add transactions but will not be able to delete or
  496. repost transactions.
  497. <br>To lock all the tables to create a RO system GRANT SELECT rights only.
  498. <p><li>Other security options include a secure shell, your webserver's
  499. authentication system, SSL, encrypted tunnels, ...
  500. </ul>
  501. </BODY>
  502. </HTML>