This commit was generated by cvs2svn to compensate for changes in r3880,
[freeside.git] / sql-ledger / sql-ledger / doc / faq.html
1 <ul>
2 <p><li><h4>lineitems not printing</h4>
3 Templates designed on a *NIX platform don't work on a DOS platform.
4 To make them work load the template either with the builtin template editor
5 or a text editor and save. Templates designed on a Windows platform have the
6 same problem and won't work on a *NIX platform. Once you strip the ^M's
7 the'll work just fine.
8
9 <p>Everybody now, "Who do we thank for this schlamassl".
10
11 <p><li><h4>UTF-8 character encoding</h4>
12 Most of the translations are in ISO format. To convert the translations
13 change directory to locale/cc and convert the files with iconv to UTF-8.
14 You should also convert the COAs too and make sure you select UTF-8
15 encoding when you setup a new dataset.
16
17
18 <p><li><h4>characterset problems</h4>
19 If you have problems displaying the correct characterset try adding
20 <pre>
21   AddDefaultCharset On</pre>
22 in your httpd.conf file.
23
24 <p><li><h4>About installation</h4>
25 The easiest is to use the setup.pl script as root.
26 You don't need to know very much about your system, just login as root,
27 run 'perl setup.pl' and follow the prompts.
28 <p>setup.pl does not check for missing software packages and it is your
29 responsibilite to make sure you have the required software
30 installed either from source or from a package supplied with your distro.
31
32 <p>Requirements are clearly indicated in the README file and on the
33 download page.
34
35
36 <p><li><h4>cannot create function</h4>
37 <ol>
38 <li>either run createlang and install the plpgsql language handler or
39 install yourself. For more information how to do that, visit
40 <a href=http://www.postgresql.org/docs/>PostgreSQL</a> and
41 read the interactive documentation for procedural languages.
42
43 <li>load admin.pl
44 <li>unlock the system
45 <li>login
46 </ol>
47
48
49 <p><li><h4>The requested URL /sql-ledger/admin.pl was not found</h4>
50 Your webserver doesn't know where to find the script. Most commonly this
51 is from distributions hiding webserver configuration files in different
52 locations or files and setup.pl wasn't able to configure the location for
53 you. Find out which file (httpd.conf, httpdcommon.conf, ...)
54 controls your webserver configuration and add
55 <pre>
56   # SQL-Ledger
57   Include /etc/httpd/sql-ledger-httpd.conf</pre>
58
59 Create a file 'sql-ledger-httpd.conf' in /etc/httpd and copy the next part
60 into the file.
61
62 <pre>
63   AddHandler cgi-script .pl
64   Alias /sql-ledger/ /var/www/sql-ledger/
65   &lt;Directory /var/www/sql-ledger&gt;
66     Options ExecCGI Includes FollowSymlinks
67   &lt;/Directory&gt;
68
69   &lt;Directory /var/www/sql-ledger/users&gt;
70     Order Deny,Allow
71     Deny from All
72   &lt;/Directory&gt;</pre>
73 replace '/etc/httpd' and '/var/www' with the appropriate directories.
74
75
76 <p><li><h4>users/members : Permission denied</h4>
77 Your webserver must have write access to the users directory.
78 If your server runs as user/group 'apache:apache' then set the
79 users directory to owner/group apache:apache.
80 <pre>
81   # chown -R apache:apache users</pre>
82
83
84 <p><li><h4>Dataset newer than version</h4>
85 You are trying to use an older version with a dataset which was
86 created with a newer version.
87
88
89 <p><li><h4>PDF option not working</h4>
90 Check if you have latex and pdflatex installed.
91
92
93 <p><li><h4>Apache 2.0 "error 500"</h4>
94 Some of the early versions of Apache 2.0 (< patchlevel 44) had a rewrite engine
95 which decoded escaped strings. This created a lot of problems and I worked
96 around it by escaping strings twice.
97 If you get a server 500 error 'filename too long' or if collapsed menus
98 don't expand you may have to adjusted the following code in
99 SL/Form.pm and change the number (44) on line 84.
100 <pre>
101   # for Apache 2 we escape strings twice
102   if (($ENV{SERVER_SIGNATURE} =~ /Apache\/2\.(\d+)\.(\d+)/) && !$beenthere) {
103     $str = $self->escape($str, 1) if $2 < 44;
104   }</pre>
105
106
107 <p><li><h4>IDENT Authentication failed for user "sql-ledger"</h4>
108 Edit pg_hba.conf and change authentication to
109
110 <pre>
111   local           all              trust</pre>
112
113 The file is in the 'data' directory of your postgresql installation.
114 This is different with every distribution so look for it.
115 <pre>
116   # find / -name 'pg_hba.conf'</pre>
117
118
119 <p><li><h4>DBD-Pg for Mandrake 9.0</h4>
120 Mandrake did not package a compiled DBD-Pg package again, so install DBD-Pg
121 from the source package.
122 Install perl-DBD-Pg-1.01-4mdk.i586.rpm from the 'contrib' area.
123 (Mandrake / 9.0 / contrib / RPMS)
124
125
126 <p><li><h4>LaTeX error</h4>
127 If for some reason LaTeX produces an error message check for strange
128 characters in your account description and parts description
129 and use \usepackage[latin1]{inputenc} in the preamble.
130
131
132 <p><li><h4>LaTeX templates</h4>
133 If you don't want to edit tex code by hand,
134 you could use Lyx, Abiword, or any WYSIWYG editor capable of exporting
135 latex code.
136 To do that you must change the tokens for the variables <% and %> to something
137 like << and >>. % is the comment character in tex. There is also a
138 pagebreak block which must be commented out.
139 When you are done with the changes
140 replace << and >> with <% and %> and uncomment the pagebreak block.
141
142 <p>LaTeX is difficult but it also offers a much superior environment
143 to produce professionally looking forms in postscript and PDF format.
144 Unfortunately with all that power there is also a steep learning curve.
145
146
147 <p><li><h4>W3M</h4>
148 pass terminal=mozilla when you start w3m
149 <pre>
150   $ w3m -F http://localhost/sql-ledger/login.pl?terminal=mozilla</pre>
151
152 To use without frames
153 <pre>
154   $ w3m http://localhost/sql-ledger/login.pl?terminal=lynx</pre>
155
156 <p><li><h4>PDF option disappeared</h4>
157 Edit sql-ledger.conf and set $latex = 1;
158 <br>sql-ledger.conf is perl code, check if it compiles, if it does not,
159 the internal defaults are used which turn off $latex, hence no PDF option.
160
161 <p><li><h4>SQL-Ledger installation Mac Os X 10.3 (Panther)</h4>
162 Paul J. Teeter put together
163 <a href="http://paulteeter.net/writing/technical/howto-sql-ledger-osx.htm">
164 installation instructions</a> to run SL on a Mac.
165 <br>The instructions are for SL 2.2 but the will work for any of the later
166 releases too.
167
168 <p><li><h4>Installation on Windows (WIN32)</h4>
169 <ul>
170 <li>install Apache, perl,
171 <a href=http://techdocs.postgresql.org/guides/InstallingOnWindows>Postgres</a>
172 or Oracle, DBI and the appropriate DBD
173 module
174 <br>if you can't compile DBD-Pg here is a precompiled
175 <a href=http://www.edmund-mergl.de/export/>DBD-Pg module</a>
176 <li>download the latest version of <a href=/cgi-bin/nav.pl?page=source/index.html&title=Download>SQL-Ledger</a>
177 <li>extract the files to c:\apache\sql-ledger
178 <li>run 'perl shebang' to change the first line of the scripts. If perl
179 is not in c:\perl\bin' change '#!c:\\perl\\bin\\perl' to the location where
180 your perl binary is.
181 <li>edit c:\apache\conf\httpd.conf and add
182 <pre>
183 Alias /sql-ledger/ "c:/apache/sql-ledger/"
184 &lt;Directory "c:/apache/sql-ledger"&gt;
185   AllowOverride All
186   AddHandler cgi-script .pl
187   Options +ExecCGI
188   Order Allow,Deny
189   Allow from All
190 &lt;/Directory&gt;
191
192 &lt;Directory "c:/apache/sql-ledger/users"&gt;
193   Order Deny,Allow
194   Deny from All
195 &lt;/Directory&gt;
196 </pre>
197
198 <li>start Apache
199 <li>start Postgres|Oracle|DB2
200 <li>connect to http://localhost/sql-ledger/admin.pl and setup users
201 and datasets
202 <li>connect to http://localhost/sql-ledger/login.pl and login
203
204 </ul>
205
206 <p><li><h4>Installation on Windows /w cygwin</h4>
207 <ul>
208 <li>install <a href=http://sources.redhat.com/cygwin/>cygwin</a>
209 Apache, perl, postgres, gcc and lynx
210 <li>install <a href=http://search.cpan.org/search?module=DBI>DBI</a>
211 <li>tar zxvf DBI-1.30.tar.gz
212 <li>cd DBI-1.30
213 <li>perl Makefile.PL
214 <li>make install
215 <li>install <a href=http://search.cpan.org/search?dist=DBD-Pg>DBD-Pg</a>
216 <li>tar -zxvf DBD-Pg-1.13.tar.gz
217 <li>export POSTGRES_INCLUDE=/usr/include/postgresql
218 <li>export POSTGRES_LIB=/usr/lib/postgresql
219 <li>cd DBD-Pg-1.13
220 <li>perl Makefile.PL
221 <li>make install
222 <li>edit /etc/apache/httpd.conf and add
223 <pre>
224 AddHandler cgi-script .pl
225 Alias /sql-ledger/ /var/www/sql-ledger/
226 &lt;Directory /var/www/sql-ledger&gt;
227   Options +ExecCGI
228 &lt;/Directory&gt;
229
230 &lt;Directory /var/www/sql-ledger/users&gt;
231   Order Deny,Allow
232   Deny from All
233 &lt/Directory&gt;
234 </pre>
235 <li>install SQL-Ledger
236 <li>cd /var/www
237 <li>mkdir sql-ledger
238 <li>download <a href=/cgi-bin/download.pl?setup.pl>setup.pl</a> and save the file
239 in /var/www/sql-ledger
240 <li>cd /var/www/sql-ledger
241 <li>perl setup.pl
242 </ul>
243
244 <p><li><h4>What do I enter for the language</h4>
245 If you use English, nothing, if you want to use a foreign language for
246 the login screen and admin stuff enter the language code, this is the
247 directory in the locale directory.
248
249
250 <p><li><h4>printing to a printer</h4>
251 Printers are defined in sql-ledger.conf
252
253 <pre>
254 %printers = ( 'Default' => 'lpr', 'Color' => 'lpr -PEpson' );</pre>
255
256 Check in your /etc/printcap file for the names of available printers.
257
258 <p>If you have LaTeX installed set
259 <pre>
260   $latex = 1</pre> in sql-ledger.conf
261
262 <p>To send the document to the printer check the "Postscript" or "PDF" format,
263 enter the number of copies and click on the "Print" button.
264
265 <p>The printer you enter in your preferences is the default printer.
266 You can choose any other available printer. This makes it possible
267 to print from anywhere on the network to any printer.
268
269 <p>Note: html format is for screen preview. Use the "Print" option from your
270 browser to print to a printer.
271
272
273 <p><li><h4>Using samba to send printjobs to a printer attached to a Windows XP workstation</h4>
274 The next part applies to roll your own printfilters only. If you use CUPS or
275 LPRng your milage may vary but you can still use this as a guide how it works.
276 I use the printer 'Epson' as an example which is
277 attached to a XP workstation called Raven, no password to log on.
278
279 <pre>
280 /etc/printcap entry on the server which runs lpd
281  
282 epson:Epson\
283   :sh:\
284   :lp=/dev/null:\
285   :sd=/var/spool/output/epson:\
286   :if=/usr/libexec/lpr/epson/prnfilter:\
287
288 # end of entry in /etc/printcap
289
290
291 # pnrfilter shell script
292 #!/bin/sh
293 # Filter for Epson Stylus
294
295 PATH="$PATH:/usr/local/bin"
296
297 #read first_line
298 read tmp
299 first_line=`echo $tmp | cut -b1-2 | sed -n '1p'`
300
301 first_chr=`expr "$first_line" : '\(.\)'`
302 first_two=`expr "$first_line" : '\(..\)'`
303 rewindstdin
304
305 if [ "$first_two" = "%!" ]; then # Postscript file
306   gs @st640p.upp -dSAFER -dNOPAUSE -q -sOutputFile=/tmp/$$ -
307 else
308   # text file
309   cat &gt; /tmp/$$
310   echo -n "^L" &gt;&gt; /tmp/$$
311   smbclient '\\Raven\Epson' "" -c 'printmode text'
312 fi
313
314 smbclient '\\Raven\Epson' "" -P -c "print /tmp/$$"
315 rm /tmp/$$
316
317 # EOF
318
319
320 rewindstdin is a small program to rewind the filehandle for STDIN
321 save the next part up to EOF to a file rewindstdin.c and compile
322
323 #include &lt;sys/types.h&gt;
324 #include &lt;unistd.h&gt;
325 extern int errno;
326 main()
327 {
328   if( lseek(0,0,0) == 0 ){
329     errno = 0;
330   }
331   return( errno );
332 }
333
334 # EOF
335
336 compile to an executable
337
338 gcc -o /usr/local/bin/rewindstdin rewindstdin.c
339 </pre>
340
341
342 <p><li><h4>beginning balances</h4>
343 Add a GL Journal entry and enter the beginning balance for your accounts.
344 Beginning balances are the balances from your last balance sheet. If you also
345 add open invoices to account for COGS for inventory, add the invoices
346 and make the appropriate adjustments.
347
348
349 <p><li><h4>establish a beginning inventory</h4>
350 add the parts with a vendor invoice. Use the <b>real cost</b> for the items,
351 not zero. If you use zero cost then the cost of goods will be zero when you
352 sell the item.
353
354
355 <p><li><h4>Assemblies</h4>
356 Assemblies are manufactured goods assembled from parts, services and
357 assemblies.  Because you do not buy assemblies you 'stock assemblies' by
358 adding assembled units to your inventory. The quantity for individual parts 
359 is reduced and the quantity for the assembly increased. To disassemble an
360 assembly you simply return the parts to inventory by entering a negative
361 quantity for the number of assemblies to stock.
362
363
364 <p><li><h4>customizing SQL-Ledger</h4>
365 The <a href=/cgi-bin/nav.pl?page=feature/api.html&title=Application%20Interface>application interface</a>
366 consists of a global and private interface.
367
368
369 <p><li><h4>DBD-Pg not installed</h4>
370
371 Most modern distributions now package DBD-Pg. If it is
372 not packaged follow this recipe to get it working.
373
374 <ul>
375   <li>check if you have the header files for PostgreSQL
376   <br>$ find / -name 'libpq-fe.h'
377   <br>if nothing shows up install the development package for PostgreSQL
378   <li>download and untar DBD-Pg
379   <li>set the environment variables POSTGRES_LIB and POSTGRES_INCLUDE
380   <li>cd to DBD-Pg directory
381   <br>as ordinary user
382   <br>$ perl Makefile.PL
383   <br>$ make
384   <br>$ make test
385   <br>if all went well su to root
386   <br># make install
387   <li>remove DBD-Pg
388 </ul>
389
390
391 <p><li><h4>login.pl has compilation error</h4>
392
393 This could be because of a missing configuration file in the users directory
394
395 <p>check the permission for the users directory. The directory must be
396 set writeable for the webserver. If your webserver runs ias user/group
397 nobody.nogroup set the directory to
398 <pre>
399 drwx--x--x   2 nobody   nogroup    1024 May 26 16:49 users
400
401 or
402
403 drwxrwx--x   2 johndoe  nogroup    1024 May 26 16:49 users</pre>
404
405
406 <p><li><h4>script not executing, shows in browser instead</h4>
407
408 Add
409 <pre>
410   AddHandler cgi-script .pl</pre>
411 in your httpd.conf file.
412
413
414 <p><li><h4>unknown terminal!</h4>
415 the frontend script couldn't figure out which browser you are using
416 <p>include the terminal variable on the URL
417 <pre>
418   http://localhost/sql-ledger/login.pl?terminal=lynx</pre>
419 Valid terminal variables are lynx and mozilla
420
421
422 <p><li><h4>permission denied</h4>
423
424 Check if your web server has write permission to write to the following
425 files and directories:
426 <pre>
427   users/
428   templates/
429   users/members
430
431   # chown nobody:nogroup users templates users/members
432 </pre>
433
434
435 <p><li><h4>permission denied to access tables</h4>
436 The user you entered in the "Database section" must be a valid
437 database user who has rights to access the tables.
438
439 <p>If the tables are owned by 'joe' and you enter 'mary' as the dba
440 you might run into this problem if mary doesn't have the rights to
441 access tables owned by joe.
442
443
444 <p><li><h4>html and graphics files don't show up on screen</h4>
445
446 Enable Includes and FollowSymlinks Options in your httpd.conf file
447 <pre>
448   &lt;Directory /usr/local/sql-ledger&gt;
449     Options ExecCGI Includes FollowSymlinks
450   &lt;/Directory&gt;
451 </pre>
452
453
454 <p><li><h4>Can I use mySQL</h4>
455
456 mySQL lacks certain features required by SQL-Ledger.
457
458
459 <p><li><h4>switch display to a foreign language</h4>
460
461 Load your preferences and select the language.
462 <br>Language selection is in accordance to 
463 <a href=http://www.unece.org/cefact/locode/service/main.htm>
464 ISO 3166-1</a> standards.
465
466
467 <p><li><h4>Text shows in English when I use a foreign language</h4>
468
469 This is because the corresponding hash entry is missing.
470 Add the missing text in the locale/cc/all or locale/cc/missing
471 file and run 'perl locales.pl' from the command line to rebuild
472 the individual files.
473
474 <br>cc refers to the country code.
475
476
477 <p><li><h4>switch to a foreign language for the login and admin screen</h4>
478
479 Edit sql-ledger.conf and enter the code for the $language variable
480 <pre>
481   $language = "de";</pre>
482
483 <p>This is a global change and applies to all logins, individual settings
484 may be changed by setting the language in your Preferences.
485
486
487 </ul>
488
489 <p>
490 <hr>
491 <a name=security>
492 <h1>SQL-Ledger security</h1>
493 </a>
494
495 <ul>
496 <li>The security features built into SQL-Ledger provide encrypted passwords
497 and access control which makes it fairly safe out of the box to run even in
498 front of a firewall.
499 Some precautions which are out of our control must be taken though.
500 It matters where you install SL and how you configure your web server and
501 SQL server.
502
503 <pre>
504   Typical setups:
505   
506   /usr/local/vh/www                   <- DocumentRoot for virtual host
507   /usr/local/vh/sql-ledger            <- Alias for sql-ledger
508   /usr/local/vh/users                 <- users directory out of reach
509
510 <hr width=60% align=left>
511   /usr/local/vh/www                   <- DocumentRoot for virtual host
512   /usr/local/vh/www/sql-ledger        <- Alias for sql-ledger
513   /usr/local/vh/www/sql-ledger/users  <- users configuration files and tmp space
514
515   &lt;Directory /usr/local/vh/www/sql-ledger/users&gt;  <- disable webserver access
516     Order Deny,Allow                                 for users directory
517     Deny from All
518   &lt;/Directory&gt;
519
520 </pre>
521
522 The location for the users directory can be specified in sql-ledger.conf
523
524 <p><li>Set permission for the users and templates directory to 711
525
526 <p><li>If you do not want anyone to change the templates with the built-in
527 editor set the files in templates/directory/ to read only or disable
528 the menu item to edit the templates.
529
530 <p><li>You may setup a read-only environment if you disable the menu items
531 to add data. i.e 'Add Transaction' if unchecked you will not be able to add
532 a transaction or repost a transaction. You may look at it but nothing else.
533
534 <p><li>There are various settings for audit control and you may disable
535 reposting entirely or up to a certain date.
536
537 <p><li>For PostgreSQL you may also set who has access to the server in the file
538 pg_hba.conf
539 <br>Authentication crypt does not work because not all SQL servers
540 accept encrypted passwords.
541
542 <p><li>in addition you can secure the tables from unauthorized access by
543 setting up a different database user and GRANT rights. For instance,
544 users without DELETE rights will still be able to use the program, change
545 customers and vendors, add transactions but will not be able to delete or
546 repost transactions.
547 <br>To lock all the tables to create a RO system GRANT SELECT rights only.
548
549 <p><li>Other security options include a secure shell, your webserver's
550 authentication system, SSL, encrypted tunnels, ...
551
552 </ul>
553
554 </BODY>
555 </HTML>
556