so Search.tsf and Search.rdf work
[freeside.git] / httemplate / docs / upgrade8.html
1 <head>
2   <title>Upgrading to 1.4.0</title>
3 </head>
4 <body>
5 <h1>Upgrading to 1.4.0 from 1.3.1</h1>
6 <ul>
7   <li>If migrating from less than 1.3.1, see these <a href="upgrade7.html">instructions</a> first.
8   <li><font size="+2" color="#ff0000">Backup your database and current Freeside installation.</font> (with&nbsp;<a href="http://www.ca.postgresql.org/devel-corner/docs/postgres/backup.html">PostgreSQL</a>) (with&nbsp;<a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Backup">MySQL</a>)
9   <li><a href="http://perl.apache.org/">mod_perl</a> is now required.
10   <li>Install <a href="http://search.cpan.org/search?dist=Time-Duration">Time-Duration</a>, <a href="http://search.cpan.org/search?dist=Tie-IxHash">Tie-IxHash</a> and <a href="http://search.cpan.org/search?dist=HTML-Widgets-SelectLayers">HTML-Widgets-SelectLayers</a> (minimum version 0.02).
11   <li>Install <a href="http://www.apache-asp.org/">Apache::ASP</a> or <a href="http://www.masonhq.com/">HTML::Mason</a> (use version 1.0x - Freeside is not yet compatible with version 1.1x).
12   <li>Install <a href="http://rsync.samba.org/">rsync</a>
13 </ul>
14 <table>
15   <tr>
16     <th>Apache::ASP</th><th>Mason</th>
17   </tr>
18   <tr>
19     <td><ul>
20       <li>Run <tt>make aspdocs</tt>
21       <li>Copy <tt>aspdocs/</tt> to your web server's document space.
22       <li>Create a <a href="http://www.apache-asp.org/config.html#Global">Global</a> directory, such as <tt>/usr/local/etc/freeside/asp-global/</tt>
23       <li>Copy <tt>htetc/global.asa</tt> to the Global directory.
24       <li>Configure Apache for the Global directory and to execute .cgi files using Apache::ASP.  For example:
25 <font size="-1"><pre>
26 &lt;Directory /usr/local/apache/htdocs/freeside-asp&gt;
27 &lt;Files ~ (\.cgi)&gt;
28 AddHandler perl-script .cgi
29 PerlHandler Apache::ASP
30 &lt;/Files&gt;
31 &lt;Perl&gt;
32 $MLDBM::RemoveTaint = 1;
33 &lt;/Perl&gt;
34 PerlSetVar Global /usr/local/etc/freeside/asp-global/
35 &lt;/Directory&gt;
36 </pre></font>
37     </ul></td>
38     <td><ul>
39       <li>(use version 1.0x - Freeside is not yet compatible with version 1.1x)
40       <li>Run <tt>make masondocs</tt>
41       <li>Copy <tt>masondocs/</tt> to your web server's document space.
42       <li>Copy <tt>htetc/handler.pl</tt> to your web server's configuration directory.
43       <li>Edit <tt>handler.pl</tt> and set an appropriate <tt>data_dir</tt>, such as <tt>/usr/local/etc/freeside/mason-data</tt>
44       <li>Configure Apache to use the <tt>handler.pl</tt> file and to execute .cgi files using HTML::Mason.  For example:
45 <font size="-1"><pre>
46 &lt;Directory /usr/local/apache/htdocs/freeside-mason&gt;
47 &lt;Files ~ (\.cgi)&gt;
48 AddHandler perl-script .cgi
49 PerlHandler HTML::Mason
50 &lt;/Files&gt;
51 &lt;Perl&gt;
52 require "/usr/local/apache/conf/handler.pl";
53 &lt;/Perl&gt;
54 &lt;/Directory&gt;
55 </pre></font>
56     </ul></td>
57   </tr>
58 </table>
59 <ul>
60   <li>Build and install the Perl modules:
61     <pre>
62 $ su
63 # make install-perl-modules</pre>
64    <li>Apply the following changes to your database:
65 <pre>
66 CREATE TABLE svc_forward (
67   svcnum int NOT NULL,
68   srcsvc int NOT NULL,
69   dstsvc int NOT NULL,
70   dst varchar(80),
71   PRIMARY KEY (svcnum)
72 );
73 ALTER TABLE part_svc ADD svc_forward__srcsvc varchar(80) NULL;
74 ALTER TABLE part_svc ADD svc_forward__srcsvc_flag char(1) NULL;
75 ALTER TABLE part_svc ADD svc_forward__dstsvc varchar(80) NULL;
76 ALTER TABLE part_svc ADD svc_forward__dstsvc_flag char(1) NULL;
77 ALTER TABLE part_svc ADD svc_forward__dst varchar(80) NULL;
78 ALTER TABLE part_svc ADD svc_forward__dst_flag char(1) NULL;
79
80 CREATE TABLE cust_credit_bill (
81   creditbillnum int primary key,
82   crednum int not null,
83   invnum int not null,
84   _date int not null,
85   amount decimal(10,2) not null
86 );
87
88 CREATE TABLE cust_bill_pay (
89   billpaynum int primary key,
90   invnum int not null,
91   paynum int not null,
92   _date int not null,
93   amount decimal(10,2) not null
94 );
95
96 CREATE TABLE cust_credit_refund (
97   creditrefundnum int primary key,
98   crednum int not null,
99   refundnum int not null,
100   _date int not null,
101   amount decimal(10,2) not null
102 );
103
104 CREATE TABLE part_svc_column (
105   columnnum int primary key,
106   svcpart int not null,
107   columnname varchar(64) not null,
108   columnvalue varchar(80) null,
109   columnflag char(1) null
110 );
111
112 CREATE TABLE queue (
113   jobnum int primary key,
114   job text not null,
115   _date int not null,
116   status varchar(80) not null,
117   statustext text null,
118   svcnum int null
119 );
120 CREATE INDEX queue1 ON queue ( svcnum );
121 CREATE INDEX queue2 ON queue ( status );
122
123 CREATE TABLE queue_arg (
124   argnum int primary key,
125   jobnum int not null,
126   arg text null
127 );
128 CREATE INDEX queue_arg1 ON queue_arg ( jobnum );
129
130 CREATE TABLE queue_depend (
131   dependnum int primary key,
132   jobnum int not null,
133   depend_jobnum int not null
134 );
135 CREATE INDEX queue_depend1 ON queue_depend ( jobnum );
136 CREATE INDEX queue_depend2 ON queue_depend ( depend_jobnum );
137
138 CREATE TABLE part_pop_local (
139   localnum int primary key,
140   popnum int not null,
141   city varchar(80) null,
142   state char(2) null,
143   npa char(3) not null,
144   nxx char(3) not null
145 );
146 CREATE UNIQUE INDEX part_pop_local1 ON part_pop_local ( npa, nxx );
147
148 CREATE TABLE cust_bill_event (
149   eventnum int primary key,
150   invnum int not null,
151   eventpart int not null,
152   _date int not null,
153   status varchar(80) not null, 
154   statustext text
155 );
156 CREATE UNIQUE INDEX cust_bill_event1 ON cust_bill_event ( eventpart, invnum );
157 CREATE INDEX cust_bill_event2 ON cust_bill_event ( invnum );
158
159 CREATE TABLE part_bill_event (
160   eventpart int primary key,
161   payby char(4) not null,
162   event varchar(80) not null,
163   eventcode text null,
164   seconds int null,
165   weight int not null,
166   plan varchar(80) null,
167   plandata text null,
168   disabled char(1) null
169 );
170 CREATE INDEX part_bill_event1 ON part_bill_event ( payby );
171
172 CREATE TABLE export_svc (
173   exportsvcnum int primary key,
174   exportnum int not null,
175   svcpart int not null
176 );
177 CREATE UNIQUE INDEX export_svc1 ON export_svc ( exportnum, svcpart );
178 CREATE INDEX export_svc2 ON export_svc ( exportnum );
179 CREATE INDEX export_svc3 ON export_svc ( svcpart );
180
181 CREATE TABLE part_export (
182   exportnum int primary key,
183   machine varchar(80) not null,
184   exporttype varchar(80) not null,
185   nodomain char(1) NULL
186 );
187 CREATE INDEX part_export1 ON part_export ( machine );
188 CREATE INDEX part_export2 ON part_export ( exporttype );
189
190 CREATE TABLE part_export_option (
191   optionnum int primary key,
192   exportnum int not null,
193   optionname varchar(80) not null,
194   optionvalue text NULL
195 );
196 CREATE INDEX part_export_option1 ON part_export_option ( exportnum );
197 CREATE INDEX part_export_option2 ON part_export_option ( optionname );
198
199 CREATE TABLE radius_usergroup (
200   usergroupnum int primary key,
201   svcnum int not null,
202   groupname varchar(80) not null
203 );
204 CREATE INDEX radius_usergroup1 ON radius_usergroup ( svcnum );
205 CREATE INDEX radius_usergroup2 ON radius_usergroup ( groupname );
206
207 CREATE TABLE msgcat (
208   msgnum int primary key,
209   msgcode varchar(80) not null,
210   locale varchar(16) not null,
211   msg text not null
212 );
213 CREATE INDEX msgcat1 ON msgcat ( msgcode, locale );
214
215 CREATE TABLE cust_tax_exempt (
216   exemptnum int primary key,
217   custnum int not null,
218   taxnum int not null,
219   year int not null,
220   month int not null,
221   amount decimal(10,2)
222 );
223 CREATE UNIQUE INDEX cust_tax_exempt1 ON cust_tax_exempt ( taxnum, year, month );
224
225 ALTER TABLE svc_acct ADD domsvc integer NULL;
226 ALTER TABLE part_svc ADD svc_acct__domsvc varchar(80) NULL;
227 ALTER TABLE part_svc ADD svc_acct__domsvc_flag char(1) NULL;
228 ALTER TABLE svc_domain ADD catchall integer NULL;
229 ALTER TABLE cust_main ADD referral_custnum integer NULL;
230 ALTER TABLE cust_main ADD comments text NULL;
231 ALTER TABLE cust_pay ADD custnum integer;
232 ALTER TABLE cust_pay_batch ADD paybatchnum integer;
233 ALTER TABLE cust_refund ADD custnum integer;
234 ALTER TABLE cust_pkg ADD manual_flag char(1) NULL;
235 ALTER TABLE part_pkg ADD plan varchar(80) NULL;
236 ALTER TABLE part_pkg ADD plandata text NULL;
237 ALTER TABLE part_pkg ADD setuptax char(1) NULL;
238 ALTER TABLE part_pkg ADD recurtax char(1) NULL;
239 ALTER TABLE part_pkg ADD disabled char(1) NULL;
240 ALTER TABLE part_svc ADD disabled char(1) NULL;
241 ALTER TABLE cust_bill ADD closed char(1) NULL;
242 ALTER TABLE cust_pay ADD closed char(1) NULL;
243 ALTER TABLE cust_credit ADD closed char(1) NULL;
244 ALTER TABLE cust_refund ADD closed char(1) NULL;
245 ALTER TABLE cust_bill_event ADD status varchar(80);
246 ALTER TABLE cust_bill_event ADD statustext text NULL;
247 ALTER TABLE svc_acct ADD sec_phrase varchar(80) NULL;
248 ALTER TABLE part_svc ADD svc_acct__sec_phrase varchar(80) NULL;
249 ALTER TABLE part_svc ADD svc_acct__sec_phrase_flag char(1) NULL;
250 ALTER TABLE part_pkg ADD taxclass varchar(80) NULL;
251 ALTER TABLE cust_main_county ADD taxclass varchar(80) NULL;
252 ALTER TABLE cust_main_county ADD exempt_amount decimal(10,2);
253 CREATE INDEX cust_main3 ON cust_main ( referral_custnum );
254 CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum );
255 CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum );
256 CREATE INDEX cust_bill_pay1 ON cust_bill_pay ( invnum );
257 CREATE INDEX cust_bill_pay2 ON cust_bill_pay ( paynum );
258 CREATE INDEX cust_credit_refund1 ON cust_credit_refund ( crednum );
259 CREATE INDEX cust_credit_refund2 ON cust_credit_refund ( refundnum );
260 CREATE UNIQUE INDEX cust_pay_batch_pkey ON cust_pay_batch ( paybatchnum );
261 CREATE UNIQUE INDEX part_svc_column1 ON part_svc_column ( svcpart, columnname );
262 CREATE INDEX cust_pay2 ON cust_pay ( paynum );
263 CREATE INDEX cust_pay3 ON cust_pay ( custnum );
264 CREATE INDEX cust_pay4 ON cust_pay ( paybatch );
265 </pre>
266
267   <li>If you are using PostgreSQL, apply the following changes to your database:
268 <pre>
269 CREATE UNIQUE INDEX agent_pkey ON agent ( agentnum );
270 CREATE UNIQUE INDEX agent_type_pkey ON agent_type ( typenum );
271 CREATE UNIQUE INDEX cust_bill_pkey ON cust_bill ( invnum );
272 CREATE UNIQUE INDEX cust_credit_pkey ON cust_credit ( crednum );
273 CREATE UNIQUE INDEX cust_main_pkey ON cust_main ( custnum );
274 CREATE UNIQUE INDEX cust_main_county_pkey ON cust_main_county ( taxnum );
275 CREATE UNIQUE INDEX cust_main_invoice_pkey ON cust_main_invoice ( destnum );
276 CREATE UNIQUE INDEX cust_pay_pkey ON cust_pay ( paynum );
277 CREATE UNIQUE INDEX cust_pkg_pkey ON cust_pkg ( pkgnum );
278 CREATE UNIQUE INDEX cust_refund_pkey ON cust_refund ( refundnum );
279 CREATE UNIQUE INDEX cust_svc_pkey ON cust_svc ( svcnum );
280 CREATE UNIQUE INDEX domain_record_pkey ON domain_record ( recnum );
281 CREATE UNIQUE INDEX nas_pkey ON nas ( nasnum );
282 CREATE UNIQUE INDEX part_pkg_pkey ON part_pkg ( pkgpart );
283 CREATE UNIQUE INDEX part_referral_pkey ON part_referral ( refnum );
284 CREATE UNIQUE INDEX part_svc_pkey ON part_svc ( svcpart );
285 CREATE UNIQUE INDEX port_pkey ON port ( portnum );
286 CREATE UNIQUE INDEX prepay_credit_pkey ON prepay_credit ( prepaynum );
287 CREATE UNIQUE INDEX session_pkey ON session ( sessionnum );
288 CREATE UNIQUE INDEX svc_acct_pkey ON svc_acct ( svcnum );
289 CREATE UNIQUE INDEX svc_acct_pop_pkey ON svc_acct_pop ( popnum );
290 CREATE UNIQUE INDEX svc_acct_sm_pkey ON svc_acct_sm ( svcnum );
291 CREATE UNIQUE INDEX svc_domain_pkey ON svc_domain ( svcnum );
292 CREATE UNIQUE INDEX svc_www_pkey ON svc_www ( svcnum );
293 </pre>
294   <li>If you wish to enable service/shipping addresses, apply the following
295       changes to your database:
296 <pre>
297 ALTER TABLE cust_main ADD COLUMN ship_last varchar(80) NULL;
298 ALTER TABLE cust_main ADD COLUMN ship_first varchar(80) NULL;
299 ALTER TABLE cust_main ADD COLUMN ship_company varchar(80) NULL;
300 ALTER TABLE cust_main ADD COLUMN ship_address1 varchar(80) NULL;
301 ALTER TABLE cust_main ADD COLUMN ship_address2 varchar(80) NULL;
302 ALTER TABLE cust_main ADD COLUMN ship_city varchar(80) NULL;
303 ALTER TABLE cust_main ADD COLUMN ship_county varchar(80) NULL;
304 ALTER TABLE cust_main ADD COLUMN ship_state varchar(80) NULL;
305 ALTER TABLE cust_main ADD COLUMN ship_zip varchar(10) NULL;
306 ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL;
307 ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL;
308 ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL;
309 ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL;
310 CREATE INDEX cust_main4 ON cust_main ( ship_last );
311 CREATE INDEX cust_main5 ON cust_main ( ship_company );
312 </pre>
313   <li>If you are using the signup server, reinstall it according to the <a href="signup.html">instructions</a>.  The 1.3.x signup server is not compatible with 1.4.x.
314   <li>Run <tt>bin/dbdef-create <i>username</i></tt>
315   <li>If you have svc_acct_sm records or service definitions:
316     <ul>
317       <li>Create a service definition with table svc_forward
318       <li>Run <tt>bin/fs-migrate-svc_acct_sm <i>username</i></tt>
319     </ul>
320   <li>Or if you just have svc_acct records:
321     <ul>
322       <li>Order and provision a package for your default domain and note down the <b>Service #</b> or <i>svcnum</i>.
323       <li><tt>UPDATE svc_acct SET domsvc = </tt><i>svcnum</i>
324       <li>Update your service definitions to have default (or fixed) <b>domsvc</b>.
325     </ul>
326   <li>Run <tt>bin/fs-migrate-payref<i>username</i></tt>
327   <li>Run <tt>bin/fs-migrate-part_svc<i>username</i></tt>
328   <li><b>After running bin/fs-migrate-payref</b>, apply the following changes to your database:
329   <table border><tr><th>PostgreSQL</th><th>MySQL, others</th></tr>
330 <tr><td>
331 <font size=-1><pre>
332 CREATE TABLE cust_pay_temp (
333   paynum int primary key,
334   custnum int not null,
335   paid decimal(10,2) not null,
336   _date int null,
337   payby char(4) not null,
338   payinfo varchar(16) null,
339   paybatch varchar(80) null,
340   closed char(1) null
341 );
342 INSERT INTO cust_pay_temp SELECT paynum, custnum, paid, _date, payby, payinfo, paybatch, closed FROM cust_pay;
343 DROP TABLE cust_pay;
344 ALTER TABLE cust_pay_temp RENAME TO cust_pay;
345 CREATE UNIQUE INDEX cust_pay1 ON cust_pay (paynum);
346 CREATE TABLE cust_refund_temp (
347   refundnum int primary key,
348   custnum int not null,
349   _date int null,
350   refund decimal(10,2) not null,
351   otaker varchar(8) not null,
352   reason varchar(80) not null,
353   payby char(4) not null,
354   payinfo varchar(16) null,
355   paybatch varchar(80) null,
356   closed char(1) null
357 );
358 INSERT INTO cust_refund_temp SELECT refundnum, custnum, _date, refund, otaker, reason, payby, payinfo, '', closed from cust_refund;
359 DROP TABLE cust_refund;
360 ALTER TABLE cust_refund_temp RENAME TO cust_refund;
361 CREATE UNIQUE INDEX cust_refund1 ON cust_refund (refundnum);
362 </pre></font>
363 </td><td>
364 <font size=-1><pre>
365 ALTER TABLE cust_pay DROP COLUMN invnum;
366 ALTER TABLE cust_refund DROP COLUMN crednum;
367 </pre></font>
368 </td></tr></table>
369   <li><b>IMPORTANT: After applying the second set of database changes</b>, run <tt>bin/dbdef-create <i>username</i></tt> again.
370   <li><b>IMPORTANT</b>: run <tt>bin/create-history-tables <i>username</i></tt>
371   <li><b>IMPORTANT: After running bin/create-history-tables</b>, run <tt>bin/dbdef-create <i>username</i></tt> again.
372   <li>As the freeside UNIX user, run <tt>bin/populate-msgcat <i>username</i></tt
373 > to populate the message catalog
374 <!--  <li>set the <a href="../config/config.cgi#username_policy">user_policy configuration value</a> as appropriate for your site. -->
375   <li>set the <a href="../config/config.cgi#locale">locale configuration value</a> to en_US.
376   <li>the mxmachines, nsmachines, arecords and cnamerecords configuration values have been deprecated.  Set the <a href="../config/config.cgi#defaultrecords">defaultrecords configuration value</a> instead.
377   <li>Create the `/usr/local/etc/freeside/cache.<i>datasrc</i>' directory
378       (owned by the freeside user).
379   <li>freeside-queued was installed with the Perl modules.  Start it now and ensure that is run upon system startup.
380   <li>Set appropriate <a href="../browse/part_bill_event.cgi">invoice events</a> for your site.  At the very least, you'll want to set some invoice events "<i>After 0 days</i>": a <i>BILL</i> invoice event to print invoices, a <i>CARD</i> invoice event to batch or run cards real-time, and a <i>COMP</i> invoice event to "pay" complimentary customers.  If you were using the <i>-i</i> option to <a href="man/bin/freeside-bill.html">freeside-bill</a> it should be removed.
381   <li>Use <a href="man/bin/freeside-daily.html">freeside-daily</a> instead of <a href="man/bin/freeside-bill.html">freeside-bill</a>.
382   <li>If you would like Freeside to notify your customers when their credit
383   cards and other billing arrangements are about to expire, arrange for
384   <b>freeside-expiration-alerter</b> to be run daily by cron or similar
385   facility.  The message it sends can be configured from the
386   <u>Configuration</u> choice of the main menu as <u>alerter_template</u>.
387   <li>Export has been rewritten.  If you were using the icradiusmachines,
388   icradius_mysqldest, icradius_mysqlsource, or icradius_secrets files, add
389   an appropriate "sqlradius" export to all relevant Service Definitions
390   instead.  Use <a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Replication">MySQL replication</a> or
391   point the "sqlradius" export directly at your external ICRADIUS or FreeRADIUS
392   database (or through an SSL-necrypting proxy...)
393 </ul>
394 </body>