r21607 - gnucash/trunk - Dissolve business-utils module by moving the leftovers into app-utils.

Geert Janssens gjanssens at code.gnucash.org
Mon Nov 21 05:40:43 EST 2011


Author: gjanssens
Date: 2011-11-21 05:40:43 -0500 (Mon, 21 Nov 2011)
New Revision: 21607
Trac: http://svn.gnucash.org/trac/changeset/21607

Added:
   gnucash/trunk/src/app-utils/business-options.scm
   gnucash/trunk/src/app-utils/business-prefs.scm
Removed:
   gnucash/trunk/src/business/business-utils/Makefile.am
   gnucash/trunk/src/business/business-utils/business-options.scm
   gnucash/trunk/src/business/business-utils/business-prefs.scm
   gnucash/trunk/src/business/business-utils/business-utils.scm
   gnucash/trunk/src/business/business-utils/gncmod-business-utils.c
Modified:
   gnucash/trunk/configure.ac
   gnucash/trunk/src/app-utils/Makefile.am
   gnucash/trunk/src/app-utils/app-utils.scm
   gnucash/trunk/src/business/Makefile.am
   gnucash/trunk/src/business/business-gnome/business-gnome.scm
   gnucash/trunk/src/business/business-ledger/Makefile.am
   gnucash/trunk/src/report/business-reports/balsheet-eg.scm
   gnucash/trunk/src/report/business-reports/business-reports.scm
   gnucash/trunk/src/report/business-reports/customer-summary.scm
   gnucash/trunk/src/report/business-reports/easy-invoice.scm
   gnucash/trunk/src/report/business-reports/fancy-invoice.scm
   gnucash/trunk/src/report/business-reports/invoice.scm
   gnucash/trunk/src/report/business-reports/job-report.scm
   gnucash/trunk/src/report/business-reports/owner-report.scm
   gnucash/trunk/src/report/business-reports/payables.scm
   gnucash/trunk/src/report/business-reports/receivables.scm
   gnucash/trunk/src/report/business-reports/taxinvoice.scm
   gnucash/trunk/src/report/report-system/eguile-html-utilities.scm
   gnucash/trunk/src/report/report-system/eguile-utilities.scm
Log:
Dissolve business-utils module by moving the leftovers into app-utils.

Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/configure.ac	2011-11-21 10:40:43 UTC (rev 21607)
@@ -1336,7 +1336,6 @@
   src/tax/us/test/Makefile
   src/test-core/Makefile
   src/business/Makefile
-  src/business/business-utils/Makefile
   src/business/business-gnome/Makefile
   src/business/business-gnome/glade/Makefile
   src/business/business-gnome/gtkbuilder/Makefile

Modified: gnucash/trunk/src/app-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/app-utils/Makefile.am	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/app-utils/Makefile.am	2011-11-21 10:40:43 UTC (rev 21607)
@@ -137,6 +137,8 @@
 
 gncscmdir = ${GNC_SHAREDIR}/scm
 gncscm_DATA = \
+  business-options.scm \
+  business-prefs.scm \
   c-interface.scm \
   config-var.scm \
   date-utilities.scm \

Modified: gnucash/trunk/src/app-utils/app-utils.scm
===================================================================
--- gnucash/trunk/src/app-utils/app-utils.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/app-utils/app-utils.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -298,3 +298,30 @@
 (load-from-path "date-utilities.scm")
 (load-from-path "simple-obj.scm")
 
+;; Business options
+(define gnc:*business-label* (N_ "Business"))
+(define gnc:*company-name* (N_ "Company Name"))
+(define gnc:*company-addy* (N_ "Company Address"))
+(define gnc:*company-id* (N_ "Company ID"))
+(define gnc:*company-phone* (N_ "Company Phone Number"))
+(define gnc:*company-fax* (N_ "Company Fax Number"))
+(define gnc:*company-url* (N_ "Company Website URL"))
+(define gnc:*company-email* (N_ "Company Email Address"))
+(define gnc:*company-contact* (N_ "Company Contact Person"))
+
+(export gnc:*business-label* gnc:*company-name* gnc:*company-addy* gnc:*company-id*
+            gnc:*company-phone* gnc:*company-fax* gnc:*company-url*
+            gnc:*company-email* gnc:*company-contact*)
+
+(define gnc:*option-section-accounts* OPTION-SECTION-ACCOUNTS)
+(define gnc:*option-name-trading-accounts* OPTION-NAME-TRADING-ACCOUNTS)
+
+(export gnc:*option-section-accounts* gnc:*option-name-trading-accounts*)
+
+(define gnc:*option-section-budgeting* OPTION-SECTION-BUDGETING)
+(define gnc:*option-name-default-budget* OPTION-NAME-DEFAULT-BUDGET)
+
+(export gnc:*option-section-budgeting* gnc:*option-name-default-budget*)
+
+(load-from-path "business-options.scm")
+(load-from-path "business-prefs.scm")

Copied: gnucash/trunk/src/app-utils/business-options.scm (from rev 21606, gnucash/trunk/src/business/business-utils/business-options.scm)
===================================================================
--- gnucash/trunk/src/app-utils/business-options.scm	                        (rev 0)
+++ gnucash/trunk/src/app-utils/business-options.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -0,0 +1,484 @@
+;; Scheme code for supporting options for the business modules
+;;
+;; Created by:	Derek Atkins <derek at ihtfp.com>
+;;
+;; This program 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.              
+;;                                                                  
+;; This program 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 this program; if not, contact:
+;;
+;; Free Software Foundation           Voice:  +1-617-542-5942
+;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
+;; Boston, MA  02110-1301,  USA       gnu at gnu.org
+
+
+;; Internally, values are always a guid. Externally, both guids and
+;; invoice pointers may be used to set the value of the option. The
+;; option always returns a single invoice pointer.
+
+(use-modules (gnucash main))
+
+(define (gnc:make-invoice-option
+	 section
+	 name
+	 sort-tag
+	 documentation-string
+	 default-getter
+	 value-validator)
+
+  (define (convert-to-guid item)
+    (if (string? item)
+        item
+        (gncInvoiceReturnGUID item)))
+
+  (define (convert-to-invoice item)
+    (if (string? item)
+        (gncInvoiceLookupFlip item (gnc-get-current-book))
+        item))
+
+  (let* ((option (convert-to-guid (default-getter)))
+         (option-set #f)
+         (getter (lambda () (convert-to-invoice
+			     (if option-set
+				 option
+				 (default-getter)))))
+         (value->string (lambda ()
+                          (string-append
+                           "'" (gnc:value->string (if option-set option #f)))))
+         (validator
+          (if (not value-validator)
+              (lambda (invoice) (list #t invoice))
+              (lambda (invoice)
+                (value-validator (convert-to-invoice invoice))))))
+    (gnc:make-option
+     section name sort-tag 'invoice documentation-string getter
+     (lambda (invoice) ;; setter
+       (if (null? invoice) (set! invoice (default-getter)))
+       (set! invoice (convert-to-invoice invoice))
+       (let* ((result (validator invoice))
+	      (valid (car result))
+	      (value (cadr result)))
+	 (if valid
+	     (begin
+	       (set! option (convert-to-guid value))
+	       (set! option-set #t))
+	     (gnc:error "Illegal invoice value set"))))
+     (lambda () (convert-to-invoice (default-getter)))
+     (gnc:restore-form-generator value->string)
+     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
+     (lambda (f p)
+       (let ((v (kvp-frame-get-slot-path-gslist f p)))
+	 (if (and v (string? v))
+	     (begin
+	       (set! option v)
+	       (set! option-set #t)))))
+     validator
+     #f #f #f #f)))
+
+;; Internally, values are always a guid. Externally, both guids and
+;; customer pointers may be used to set the value of the option. The
+;; option always returns a single customer pointer.
+
+(define (gnc:make-customer-option
+	 section
+	 name
+	 sort-tag
+	 documentation-string
+	 default-getter
+	 value-validator)
+
+  (define (convert-to-guid item)
+    (if (string? item)
+        item
+        (gncCustomerReturnGUID item)))
+
+  (define (convert-to-customer item)
+    (if (string? item)
+        (gncCustomerLookupFlip item (gnc-get-current-book))
+        item))
+
+  (let* ((option (convert-to-guid (default-getter)))
+         (option-set #f)
+         (getter (lambda () (convert-to-customer
+			     (if option-set
+				 option
+				 (default-getter)))))
+         (value->string (lambda ()
+                          (string-append
+                           "'" (gnc:value->string (if option-set option #f)))))
+         (validator
+          (if (not value-validator)
+              (lambda (customer) (list #t customer))
+              (lambda (customer)
+                (value-validator (convert-to-customer customer))))))
+    (gnc:make-option
+     section name sort-tag 'customer documentation-string getter
+     (lambda (customer)
+       (if (null? customer) (set! customer (default-getter)))
+       (set! customer (convert-to-customer customer))
+       (let* ((result (validator customer))
+	      (valid (car result))
+	      (value (cadr result)))
+	 (if valid
+	     (begin
+	       (set! option (convert-to-guid value))
+	       (set! option-set #t))
+	     (gnc:error "Illegal customer value set"))))
+     (lambda () (convert-to-customer (default-getter)))
+     (gnc:restore-form-generator value->string)
+     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
+     (lambda (f p)
+       (let ((v (kvp-frame-get-slot-path-gslist f p)))
+	 (if (and v (string? v))
+	     (begin
+	       (set! option v)
+	       (set! option-set #t)))))
+     validator
+     #f #f #f #f)))
+
+;; Internally, values are always a guid. Externally, both guids and
+;; vendor pointers may be used to set the value of the option. The
+;; option always returns a single vendor pointer.
+
+(define (gnc:make-vendor-option
+	 section
+	 name
+	 sort-tag
+	 documentation-string
+	 default-getter
+	 value-validator)
+
+  (define (convert-to-guid item)
+    (if (string? item)
+        item
+        (gncVendorReturnGUID item)))
+
+  (define (convert-to-vendor item)
+    (if (string? item)
+        (gncVendorLookupFlip item (gnc-get-current-book))
+        item))
+
+  (let* ((option (convert-to-guid (default-getter)))
+         (option-set #f)
+         (getter (lambda () (convert-to-vendor
+			     (if option-set
+				 option
+				 (default-getter)))))
+         (value->string (lambda ()
+                          (string-append
+                           "'" (gnc:value->string (if option-set option #f)))))
+         (validator
+          (if (not value-validator)
+              (lambda (vendor) (list #t vendor))
+              (lambda (vendor)
+                (value-validator (convert-to-vendor vendor))))))
+    (gnc:make-option
+     section name sort-tag 'vendor documentation-string getter
+     (lambda (vendor)
+       (if (null? vendor) (set! vendor (default-getter)))
+       (set! vendor (convert-to-vendor vendor))
+       (let* ((result (validator vendor))
+	      (valid (car result))
+	      (value (cadr result)))
+	 (if valid
+	     (begin
+	       (set! option (convert-to-guid value))
+	       (set! option-set #t))
+	     (gnc:error "Illegal vendor value set"))))
+     (lambda () (convert-to-vendor (default-getter)))
+     (gnc:restore-form-generator value->string)
+     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
+     (lambda (f p)
+       (let ((v (kvp-frame-get-slot-path-gslist f p)))
+	 (if (and v (string? v))
+	     (begin
+	       (set! option v)
+	       (set! option-set #t)))))
+     validator
+     #f #f #f #f)))
+
+;; Internally, values are always a guid. Externally, both guids and
+;; employee pointers may be used to set the value of the option. The
+;; option always returns a single employee pointer.
+
+(define (gnc:make-employee-option
+	 section
+	 name
+	 sort-tag
+	 documentation-string
+	 default-getter
+	 value-validator)
+
+  (define (convert-to-guid item)
+    (if (string? item)
+        item
+        (gncEmployeeReturnGUID item)))
+
+  (define (convert-to-employee item)
+    (if (string? item)
+        (gncEmployeeLookupFlip item (gnc-get-current-book))
+        item))
+
+  (let* ((option (convert-to-guid (default-getter)))
+         (option-set #f)
+         (getter (lambda () (convert-to-employee
+			     (if option-set
+				 option
+				 (default-getter)))))
+         (value->string (lambda ()
+                          (string-append
+                           "'" (gnc:value->string (if option-set option #f)))))
+         (validator
+          (if (not value-validator)
+              (lambda (employee) (list #t employee))
+              (lambda (employee)
+                (value-validator (convert-to-employee employee))))))
+    (gnc:make-option
+     section name sort-tag 'employee documentation-string getter
+     (lambda (employee)
+       (if (null? employee) (set! employee (default-getter)))
+       (set! employee (convert-to-employee employee))
+       (let* ((result (validator employee))
+	      (valid (car result))
+	      (value (cadr result)))
+	 (if valid
+	     (begin
+	       (set! option (convert-to-guid value))
+	       (set! option-set #t))
+	     (gnc:error "Illegal employee value set"))))
+     (lambda () (convert-to-employee (default-getter)))
+     (gnc:restore-form-generator value->string)
+     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
+     (lambda (f p)
+       (let ((v (kvp-frame-get-slot-path-gslist f p)))
+	 (if (and v (string? v))
+	     (begin
+	       (set! option v)
+	       (set! option-set #t)))))
+     validator
+     #f #f #f #f)))
+
+;; Internally, values are always a type/guid pair. Externally, both
+;; type/guid pairs and owner pointers may be used to set the value of
+;; the option. The option always returns a single owner pointer.
+
+(define (gnc:make-owner-option
+	 section
+	 name
+	 sort-tag
+	 documentation-string
+	 default-getter
+	 value-validator
+	 owner-type)
+
+  (let ((option-value (gncOwnerNew)))
+
+    (define (convert-to-pair item)
+      (if (pair? item)
+	  item
+	  (cons (gncOwnerGetType item)
+		(gncOwnerReturnGUID item))))
+
+    (define (convert-to-owner pair)
+      (if (pair? pair)
+	  (let ((type (car pair)))
+	    (cond
+	      ((eqv? type GNC-OWNER-CUSTOMER)
+	       (gncOwnerInitCustomer
+		option-value
+		(gncCustomerLookupFlip (cdr pair) (gnc-get-current-book)))
+	       option-value)
+
+	       ((eqv? type GNC-OWNER-VENDOR)
+		(gncOwnerInitVendor
+		 option-value
+		 (gncVendorLookupFlip (cdr pair) (gnc-get-current-book)))
+		option-value)
+
+	       ((eqv? type GNC-OWNER-EMPLOYEE)
+		(gncOwnerInitEmployee
+		 option-value
+		 (gncEmployeeLookupFlip (cdr pair) (gnc-get-current-book)))
+		option-value)
+
+	       ((eqv? type GNC-OWNER-JOB)
+		(gncOwnerInitJob
+		 option-value
+		 (gncJobLookupFlip (cdr pair) (gnc-get-current-book)))
+		option-value)
+
+	       (else '())))
+	  pair))
+
+    (let* ((option (convert-to-pair (default-getter)))
+	   (option-set #f)
+	   (getter (lambda () (convert-to-owner
+			       (if option-set
+				   option
+				   (default-getter)))))
+	   (value->string (lambda ()
+			    (string-append
+			     "'" (gnc:value->string
+				  (if option-set option #f)))))
+	   (validator
+	    (if (not value-validator)
+		(lambda (owner)
+		  (let ((type (if (pair? owner)
+                                  (car owner)
+                                  (gncOwnerGetType owner))))
+		    (if (equal? type owner-type)
+			(list #t owner)
+			(list #f "Owner-Type Mismatch"))))
+		(lambda (owner)
+		  (value-validator (convert-to-owner owner))))))
+
+      (gnc:make-option
+       section name sort-tag 'owner documentation-string getter
+       (lambda (owner)
+	 (if (null? owner) (set! owner (default-getter)))
+	 (set! owner (convert-to-owner owner))
+	 (let* ((result (validator owner))
+		(valid (car result))
+		(value (cadr result)))
+	   (if valid
+	       (begin
+		 (set! option (convert-to-pair value))
+		 (set! option-set #t))
+	       (gnc:error "Illegal owner value set"))))
+       (lambda () (convert-to-owner (default-getter)))
+       (gnc:restore-form-generator value->string)
+       (lambda (f p)
+	 (kvp-frame-set-slot-path-gslist f (symbol->string (car option))
+				      (append p '("type")))
+	 (kvp-frame-set-slot-path-gslist f (cdr option)
+				      (append p '("value"))))
+       (lambda (f p)
+	 (let ((t (kvp-frame-get-slot-path-gslist f (append p '("type"))))
+	       (v (kvp-frame-get-slot-path-gslist f (append p '("value")))))
+	   (if (and t v (string? t) (string? v))
+	       (begin
+		 (set! option (cons (string->symbol t) v))
+		 (set! option-set #t)))))
+       validator
+       owner-type #f #f #f))))
+
+
+;; Internally, values are always a guid. Externally, both guids and
+;; taxtable pointers may be used to set the value of the option. The
+;; option always returns a single taxtable pointer.
+
+(define (gnc:make-taxtable-option
+	 section
+	 name
+	 sort-tag
+	 documentation-string
+	 default-getter
+	 value-validator)
+
+  (define (convert-to-guid item)
+    (if (string? item)
+        item
+        (gncTaxTableReturnGUID item)))
+
+  (define (convert-to-taxtable item)
+    (if (string? item)
+        (gncTaxTableLookupFlip item (gnc-get-current-book))
+        item))
+
+  (let* ((option (convert-to-guid (default-getter)))
+         (option-set #f)
+         (getter (lambda () (convert-to-taxtable
+			     (if option-set
+				 option
+				 (default-getter)))))
+         (value->string (lambda ()
+                          (string-append
+                           "'" (gnc:value->string (if option-set option #f)))))
+         (validator
+          (if (not value-validator)
+              (lambda (taxtable) (list #t taxtable))
+              (lambda (taxtable)
+                (value-validator (convert-to-taxtable taxtable))))))
+    (gnc:make-option
+     section name sort-tag 'taxtable documentation-string getter
+     (lambda (taxtable)
+       (if (null? taxtable) (set! taxtable (default-getter)))
+       (set! taxtable (convert-to-taxtable taxtable))
+       (let* ((result (validator taxtable))
+	      (valid (car result))
+	      (value (cadr result)))
+	 (if valid
+	     (begin
+	       (set! option (convert-to-guid value))
+	       (set! option-set #t))
+	     (gnc:error "Illegal taxtable value set"))))
+     (lambda () (convert-to-taxtable (default-getter)))
+     (gnc:restore-form-generator value->string)
+     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
+     (lambda (f p)
+       (let ((v (kvp-frame-get-slot-path-gslist f p)))
+	 (if (and v (string? v))
+	     (begin
+	       (set! option v)
+	       (set! option-set #t)))))
+     validator
+     #f #f #f #f)))
+
+;; This defines an option to set a counter value. This is a slightly
+;; different kind of option: Unlike all other options, the values edited
+;; by this option are not saved in the "options"/<section> kvm slot, but
+;; in the "counters" slot. This is mostly due to backwards compatibility
+;; and partly because counters are a bit different from other options
+;; anyway.
+;;
+;; This is implemented by overriding the scm->kvp and kvp->scm methods
+;; to ignore the kvp path passed and replace it with a hardcoded
+;; "counters".
+(define (gnc:make-counter-option
+         section
+         name
+	 key
+         sort-tag
+         documentation-string
+         default-value)
+  (let ((option (gnc:make-number-range-option section name sort-tag documentation-string default-value 0 999999999 0 1)))
+     (gnc:set-option-scm->kvp option (lambda (f p) (kvp-frame-set-slot-path-gslist f (inexact->exact ((gnc:option-getter option))) (list "counters" key))))
+     (gnc:set-option-kvp->scm option (lambda (f p)
+                               (let ((v (kvp-frame-get-slot-path-gslist f (list "counters" key))))
+                                 (if (and v (integer? v))
+                                     ((gnc:option-setter option) v)))))
+     option))
+
+;; This defines an option to set a counter format, which has the same
+;; exception as gnc:make-counter-option above.
+(define (gnc:make-counter-format-option
+         section
+         name
+	 key
+         sort-tag
+         documentation-string
+         default-value)
+  (let ((option (gnc:make-string-option section name sort-tag documentation-string default-value)))
+     (gnc:set-option-scm->kvp option (lambda (f p) (kvp-frame-set-slot-path-gslist f ((gnc:option-getter option)) (list "counter_formats" key))))
+     (gnc:set-option-kvp->scm option (lambda (f p)
+                               (let ((v (kvp-frame-get-slot-path-gslist f (list "counter_formats" key))))
+                                 (if (and v (string? v))
+                                     ((gnc:option-setter option) v)))))
+     option))
+
+(export gnc:make-invoice-option)
+(export gnc:make-customer-option)
+(export gnc:make-vendor-option)
+(export gnc:make-employee-option)
+(export gnc:make-owner-option)
+(export gnc:make-taxtable-option)
+(export gnc:make-counter-option)
+(export gnc:make-counter-format-option)

Copied: gnucash/trunk/src/app-utils/business-prefs.scm (from rev 21606, gnucash/trunk/src/business/business-utils/business-prefs.scm)
===================================================================
--- gnucash/trunk/src/app-utils/business-prefs.scm	                        (rev 0)
+++ gnucash/trunk/src/app-utils/business-prefs.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -0,0 +1,173 @@
+;; Business Preferences
+;;
+;; Created by:	Derek Atkins <derek at ihtfp.com>
+;;
+;; This program 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.              
+;;                                                                  
+;; This program 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 this program; if not, contact:
+;;
+;; Free Software Foundation           Voice:  +1-617-542-5942
+;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
+;; Boston, MA  02110-1301,  USA       gnu at gnu.org
+
+(define gnc:*option-section-counters* (N_ "Counters"))
+
+;; This defines all available counter types to show options for. This a
+;; list that contains a sublist for each counter type, containing: The
+;; (untranslated) counter name, the format label, the previous number
+;; label, the format help text and the previous number help text.
+(define counter-types
+  (list (list "gncCustomer"     (N_ "Customer number format")
+                                (N_ "Customer number")
+                                (N_ "The format string to use for generating customer numbers. This is a printf-style format string.")
+                                (N_ "The previous customer number generated. This number will be incremented to generate the next customer number."))
+        (list "gncEmployee"     (N_ "Employee number format")
+                                (N_ "Employee number")
+                                (N_ "The format string to use for generating employee numbers. This is a printf-style format string.")
+                                (N_ "The previous employee number generated. This number will be incremented to generate the next employee number."))
+        (list "gncInvoice"      (N_ "Invoice number format")
+                                (N_ "Invoice number")
+                                (N_ "The format string to use for generating invoice numbers. This is a printf-style format string.")
+                                (N_ "The previous invoice number generated. This number will be incremented to generate the next invoice number."))
+        (list "gncBill"         (N_ "Bill number format")
+                                (N_ "Bill number")
+                                (N_ "The format string to use for generating bill numbers. This is a printf-style format string.")
+                                (N_ "The previous bill number generated. This number will be incremented to generate the next bill number."))
+        (list "gncExpVoucher"   (N_ "Expense voucher number format")
+                                (N_ "Expense voucher number")
+                                (N_ "The format string to use for generating expense voucher numbers. This is a printf-style format string.")
+                                (N_ "The previous expense voucher number generated. This number will be incremented to generate the next voucher number."))
+        (list "gncJob"          (N_ "Job number format")
+                                (N_ "Job number")
+                                (N_ "The format string to use for generating job numbers. This is a printf-style format string.")
+                                (N_ "The previous job number generated. This number will be incremented to generate the next job number."))
+        (list "gncOrder"        (N_ "Order number format")
+                                (N_ "Order number")
+                                (N_ "The format string to use for generating order numbers. This is a printf-style format string.")
+                                (N_ "The previous order number generated. This number will be incremented to generate the next order number."))
+        (list "gncVendor"       (N_ "Vendor number format")
+                                (N_ "Vendor number")
+                                (N_ "The format string to use for generating vendor numbers. This is a printf-style format string.")
+                                (N_ "The previous vendor number generated. This number will be incremented to generate the next vendor number."))
+))
+
+(define (book-options-generator options)
+  (define (reg-option new-option)
+    (gnc:register-option options new-option))
+
+  (reg-option
+   (gnc:make-string-option
+    gnc:*business-label* gnc:*company-name*
+    "a" (N_ "The name of your business") ""))
+
+  (reg-option
+   (gnc:make-text-option
+    gnc:*business-label* gnc:*company-addy*
+    "b1" (N_ "The address of your business") ""))
+
+  (reg-option
+   (gnc:make-string-option
+    gnc:*business-label* gnc:*company-contact*
+    "b2" (N_ "The contact person to print on invoices") ""))
+
+  (reg-option
+   (gnc:make-string-option
+    gnc:*business-label* gnc:*company-phone*
+    "c1" (N_ "The phone number of your business") ""))
+
+  (reg-option
+   (gnc:make-string-option
+    gnc:*business-label* gnc:*company-fax*
+    "c2" (N_ "The fax number of your business") ""))
+
+  (reg-option
+   (gnc:make-string-option
+    gnc:*business-label* gnc:*company-email*
+    "c3" (N_ "The email address of your business") ""))
+
+  (reg-option
+   (gnc:make-string-option
+    gnc:*business-label* gnc:*company-url*
+    "c4" (N_ "The URL address of your website") ""))
+
+  (reg-option
+   (gnc:make-string-option
+    gnc:*business-label* gnc:*company-id*
+    "c5" (N_ "The ID for your company (eg 'Tax-ID: 00-000000)")
+    ""))
+ 
+  (reg-option
+   (gnc:make-taxtable-option
+    gnc:*business-label* (N_ "Default Customer TaxTable")
+    "e" (N_ "The default tax table to apply to customers.")
+    (lambda () '()) #f))
+
+  (reg-option
+   (gnc:make-taxtable-option
+    gnc:*business-label* (N_ "Default Vendor TaxTable")
+    "f" (N_ "The default tax table to apply to vendors.")
+    (lambda () '()) #f))
+
+  (reg-option
+   (gnc:make-dateformat-option
+    gnc:*business-label* (N_ "Fancy Date Format")
+    "g" (N_ "The default date format used for fancy printed dates")
+    #f))
+
+  ;; Accounts tab
+
+  (reg-option 
+   (gnc:make-simple-boolean-option
+    gnc:*option-section-accounts* gnc:*option-name-trading-accounts*
+    "a" (N_ "Check to have trading accounts used for transactions involving more than one currency or commodity")
+    #f))
+
+  ;; Budgeting Tab
+
+  (reg-option
+   (gnc:make-budget-option
+    gnc:*option-section-budgeting* gnc:*option-name-default-budget*
+    "a" (N_ "Budget to be used when none has been otherwise specified")))
+
+  ;; Counters Tab
+  (map (lambda (vals)
+               (let* (
+		      ; Unpack the list of strings for this counter type
+                      (key (car vals))
+                      (sort-string key)
+                      (format-label (cadr vals))
+                      (number-label (caddr vals))
+                      (format-description (cadddr vals))
+                      (number-description (cadddr (cdr vals)))
+                     )
+                     (begin
+		      ; For each counter-type we create an option for
+		      ; the last used number and the format string to
+		      ; use.
+                      (reg-option
+                       (gnc:make-counter-option
+                        gnc:*option-section-counters* number-label key
+                        (string-append sort-string "a") number-description 0))
+                      (reg-option
+                       (gnc:make-counter-format-option
+                        gnc:*option-section-counters* format-label key
+                        (string-append sort-string "b") format-description ""))
+                      )
+               )
+       )
+       ;; Make counter and format option for each defined counter
+       counter-types
+  )
+)
+
+
+(gnc-register-kvp-option-generator QOF-ID-BOOK-SCM book-options-generator)

Modified: gnucash/trunk/src/business/Makefile.am
===================================================================
--- gnucash/trunk/src/business/Makefile.am	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/Makefile.am	2011-11-21 10:40:43 UTC (rev 21607)
@@ -1,4 +1,3 @@
 SUBDIRS = \
-  business-utils \
   business-ledger \
   business-gnome
\ No newline at end of file

Modified: gnucash/trunk/src/business/business-gnome/business-gnome.scm
===================================================================
--- gnucash/trunk/src/business/business-gnome/business-gnome.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/business-gnome/business-gnome.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -2,7 +2,7 @@
 (use-modules (gnucash gnc-module))
 
 (gnc:module-load "gnucash/gnome-utils" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 (gnc:module-load "gnucash/gnome-search" 0)
 
 (gnc:module-load "gnucash/report/report-gnome" 0)

Modified: gnucash/trunk/src/business/business-ledger/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-ledger/Makefile.am	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/business-ledger/Makefile.am	2011-11-21 10:40:43 UTC (rev 21607)
@@ -18,7 +18,6 @@
   gncEntryLedgerModel.h
 
 libgnc_business_ledger_la_LIBADD = \
-  ${top_builddir}/src/business/business-utils/libgncmod-business-utils.la \
   ${top_builddir}/src/register/register-core/libgncmod-register-core.la \
   ${top_builddir}/src/register/register-gnome/libgncmod-register-gnome.la \
   ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
@@ -31,7 +30,6 @@
   ${GLIB_LIBS}
 
 AM_CPPFLAGS = \
-  -I${top_srcdir}/src/business/business-utils \
   -I${top_srcdir}/src \
   -I${top_srcdir}/src/engine \
   -I${top_srcdir}/src/core-utils \

Deleted: gnucash/trunk/src/business/business-utils/Makefile.am
===================================================================
--- gnucash/trunk/src/business/business-utils/Makefile.am	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/business-utils/Makefile.am	2011-11-21 10:40:43 UTC (rev 21607)
@@ -1,66 +0,0 @@
-pkglib_LTLIBRARIES = libgncmod-business-utils.la
-
-AM_CPPFLAGS = \
-  -I${top_srcdir}/src \
-  -I${top_builddir}/src \
-  -I${top_srcdir}/src/engine \
-  -I${top_srcdir}/src/gnc-module \
-  -I${top_srcdir}/src/libqof/qof \
-  ${GUILE_INCS} \
-  ${GLIB_CFLAGS} \
-  ${GNOME_CFLAGS}
-
-libgncmod_business_utils_la_SOURCES = \
-  gncmod-business-utils.c
-
-libgncmod_business_utils_la_LDFLAGS = -avoid-version
-
-libgncmod_business_utils_la_LIBADD = \
-  ${top_builddir}/src/gnc-module/libgnc-module.la \
-  ${top_builddir}/src/libqof/qof/libgnc-qof.la \
-  ${GUILE_LIBS} \
-  ${GLIB_LIBS} \
-  ${EFENCE_LIBS}
-
-# Guile Modules
-gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
-gncmod_DATA = business-utils.scm
-
-# For regular scheme definitions
-gncscmdir = ${GNC_SHAREDIR}/scm
-gncscm_DATA = \
-  business-options.scm \
-  business-prefs.scm
-
-EXTRA_DIST = \
-  ${gncscm_DATA} \
-  ${gncmod_DATA}
-
-noinst_DATA = .scm-links
-
-if GNUCASH_SEPARATE_BUILDDIR
-SCM_FILE_LINKS = business-utils.scm \
-  ${gncscm_DATA}
-endif
-
-.scm-links: 
-	$(RM) -rf gnucash
-	mkdir -p  gnucash
-if GNUCASH_SEPARATE_BUILDDIR
-	for X in ${SCM_FILE_LINKS} ; do \
-	  $(LN_S) -f ${srcdir}/$$X . ; \
-	done
-endif
-	( cd gnucash; for A in $(gncmod_DATA) ; do $(LN_S) -f ../$$A . ; done )
-if ! OS_WIN32
-# Windows knows no "ln -s" but uses "cp": must copy every time (see bug #566567).
-	touch .scm-links
-endif
-
-clean-local:
-	$(RM) -rf gnucash
-
-CLEANFILES = .scm-links
-DISTCLEANFILES = ${SCM_FILE_LINKS}
-
-INCLUDES = -DG_LOG_DOMAIN=\"gnc.business.utils\"

Deleted: gnucash/trunk/src/business/business-utils/business-options.scm
===================================================================
--- gnucash/trunk/src/business/business-utils/business-options.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/business-utils/business-options.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -1,484 +0,0 @@
-;; Scheme code for supporting options for the business modules
-;;
-;; Created by:	Derek Atkins <derek at ihtfp.com>
-;;
-;; This program 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.              
-;;                                                                  
-;; This program 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 this program; if not, contact:
-;;
-;; Free Software Foundation           Voice:  +1-617-542-5942
-;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
-;; Boston, MA  02110-1301,  USA       gnu at gnu.org
-
-
-;; Internally, values are always a guid. Externally, both guids and
-;; invoice pointers may be used to set the value of the option. The
-;; option always returns a single invoice pointer.
-
-(use-modules (gnucash main))
-
-(define (gnc:make-invoice-option
-	 section
-	 name
-	 sort-tag
-	 documentation-string
-	 default-getter
-	 value-validator)
-
-  (define (convert-to-guid item)
-    (if (string? item)
-        item
-        (gncInvoiceReturnGUID item)))
-
-  (define (convert-to-invoice item)
-    (if (string? item)
-        (gncInvoiceLookupFlip item (gnc-get-current-book))
-        item))
-
-  (let* ((option (convert-to-guid (default-getter)))
-         (option-set #f)
-         (getter (lambda () (convert-to-invoice
-			     (if option-set
-				 option
-				 (default-getter)))))
-         (value->string (lambda ()
-                          (string-append
-                           "'" (gnc:value->string (if option-set option #f)))))
-         (validator
-          (if (not value-validator)
-              (lambda (invoice) (list #t invoice))
-              (lambda (invoice)
-                (value-validator (convert-to-invoice invoice))))))
-    (gnc:make-option
-     section name sort-tag 'invoice documentation-string getter
-     (lambda (invoice) ;; setter
-       (if (null? invoice) (set! invoice (default-getter)))
-       (set! invoice (convert-to-invoice invoice))
-       (let* ((result (validator invoice))
-	      (valid (car result))
-	      (value (cadr result)))
-	 (if valid
-	     (begin
-	       (set! option (convert-to-guid value))
-	       (set! option-set #t))
-	     (gnc:error "Illegal invoice value set"))))
-     (lambda () (convert-to-invoice (default-getter)))
-     (gnc:restore-form-generator value->string)
-     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
-     (lambda (f p)
-       (let ((v (kvp-frame-get-slot-path-gslist f p)))
-	 (if (and v (string? v))
-	     (begin
-	       (set! option v)
-	       (set! option-set #t)))))
-     validator
-     #f #f #f #f)))
-
-;; Internally, values are always a guid. Externally, both guids and
-;; customer pointers may be used to set the value of the option. The
-;; option always returns a single customer pointer.
-
-(define (gnc:make-customer-option
-	 section
-	 name
-	 sort-tag
-	 documentation-string
-	 default-getter
-	 value-validator)
-
-  (define (convert-to-guid item)
-    (if (string? item)
-        item
-        (gncCustomerReturnGUID item)))
-
-  (define (convert-to-customer item)
-    (if (string? item)
-        (gncCustomerLookupFlip item (gnc-get-current-book))
-        item))
-
-  (let* ((option (convert-to-guid (default-getter)))
-         (option-set #f)
-         (getter (lambda () (convert-to-customer
-			     (if option-set
-				 option
-				 (default-getter)))))
-         (value->string (lambda ()
-                          (string-append
-                           "'" (gnc:value->string (if option-set option #f)))))
-         (validator
-          (if (not value-validator)
-              (lambda (customer) (list #t customer))
-              (lambda (customer)
-                (value-validator (convert-to-customer customer))))))
-    (gnc:make-option
-     section name sort-tag 'customer documentation-string getter
-     (lambda (customer)
-       (if (null? customer) (set! customer (default-getter)))
-       (set! customer (convert-to-customer customer))
-       (let* ((result (validator customer))
-	      (valid (car result))
-	      (value (cadr result)))
-	 (if valid
-	     (begin
-	       (set! option (convert-to-guid value))
-	       (set! option-set #t))
-	     (gnc:error "Illegal customer value set"))))
-     (lambda () (convert-to-customer (default-getter)))
-     (gnc:restore-form-generator value->string)
-     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
-     (lambda (f p)
-       (let ((v (kvp-frame-get-slot-path-gslist f p)))
-	 (if (and v (string? v))
-	     (begin
-	       (set! option v)
-	       (set! option-set #t)))))
-     validator
-     #f #f #f #f)))
-
-;; Internally, values are always a guid. Externally, both guids and
-;; vendor pointers may be used to set the value of the option. The
-;; option always returns a single vendor pointer.
-
-(define (gnc:make-vendor-option
-	 section
-	 name
-	 sort-tag
-	 documentation-string
-	 default-getter
-	 value-validator)
-
-  (define (convert-to-guid item)
-    (if (string? item)
-        item
-        (gncVendorReturnGUID item)))
-
-  (define (convert-to-vendor item)
-    (if (string? item)
-        (gncVendorLookupFlip item (gnc-get-current-book))
-        item))
-
-  (let* ((option (convert-to-guid (default-getter)))
-         (option-set #f)
-         (getter (lambda () (convert-to-vendor
-			     (if option-set
-				 option
-				 (default-getter)))))
-         (value->string (lambda ()
-                          (string-append
-                           "'" (gnc:value->string (if option-set option #f)))))
-         (validator
-          (if (not value-validator)
-              (lambda (vendor) (list #t vendor))
-              (lambda (vendor)
-                (value-validator (convert-to-vendor vendor))))))
-    (gnc:make-option
-     section name sort-tag 'vendor documentation-string getter
-     (lambda (vendor)
-       (if (null? vendor) (set! vendor (default-getter)))
-       (set! vendor (convert-to-vendor vendor))
-       (let* ((result (validator vendor))
-	      (valid (car result))
-	      (value (cadr result)))
-	 (if valid
-	     (begin
-	       (set! option (convert-to-guid value))
-	       (set! option-set #t))
-	     (gnc:error "Illegal vendor value set"))))
-     (lambda () (convert-to-vendor (default-getter)))
-     (gnc:restore-form-generator value->string)
-     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
-     (lambda (f p)
-       (let ((v (kvp-frame-get-slot-path-gslist f p)))
-	 (if (and v (string? v))
-	     (begin
-	       (set! option v)
-	       (set! option-set #t)))))
-     validator
-     #f #f #f #f)))
-
-;; Internally, values are always a guid. Externally, both guids and
-;; employee pointers may be used to set the value of the option. The
-;; option always returns a single employee pointer.
-
-(define (gnc:make-employee-option
-	 section
-	 name
-	 sort-tag
-	 documentation-string
-	 default-getter
-	 value-validator)
-
-  (define (convert-to-guid item)
-    (if (string? item)
-        item
-        (gncEmployeeReturnGUID item)))
-
-  (define (convert-to-employee item)
-    (if (string? item)
-        (gncEmployeeLookupFlip item (gnc-get-current-book))
-        item))
-
-  (let* ((option (convert-to-guid (default-getter)))
-         (option-set #f)
-         (getter (lambda () (convert-to-employee
-			     (if option-set
-				 option
-				 (default-getter)))))
-         (value->string (lambda ()
-                          (string-append
-                           "'" (gnc:value->string (if option-set option #f)))))
-         (validator
-          (if (not value-validator)
-              (lambda (employee) (list #t employee))
-              (lambda (employee)
-                (value-validator (convert-to-employee employee))))))
-    (gnc:make-option
-     section name sort-tag 'employee documentation-string getter
-     (lambda (employee)
-       (if (null? employee) (set! employee (default-getter)))
-       (set! employee (convert-to-employee employee))
-       (let* ((result (validator employee))
-	      (valid (car result))
-	      (value (cadr result)))
-	 (if valid
-	     (begin
-	       (set! option (convert-to-guid value))
-	       (set! option-set #t))
-	     (gnc:error "Illegal employee value set"))))
-     (lambda () (convert-to-employee (default-getter)))
-     (gnc:restore-form-generator value->string)
-     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
-     (lambda (f p)
-       (let ((v (kvp-frame-get-slot-path-gslist f p)))
-	 (if (and v (string? v))
-	     (begin
-	       (set! option v)
-	       (set! option-set #t)))))
-     validator
-     #f #f #f #f)))
-
-;; Internally, values are always a type/guid pair. Externally, both
-;; type/guid pairs and owner pointers may be used to set the value of
-;; the option. The option always returns a single owner pointer.
-
-(define (gnc:make-owner-option
-	 section
-	 name
-	 sort-tag
-	 documentation-string
-	 default-getter
-	 value-validator
-	 owner-type)
-
-  (let ((option-value (gncOwnerNew)))
-
-    (define (convert-to-pair item)
-      (if (pair? item)
-	  item
-	  (cons (gncOwnerGetType item)
-		(gncOwnerReturnGUID item))))
-
-    (define (convert-to-owner pair)
-      (if (pair? pair)
-	  (let ((type (car pair)))
-	    (cond
-	      ((eqv? type GNC-OWNER-CUSTOMER)
-	       (gncOwnerInitCustomer
-		option-value
-		(gncCustomerLookupFlip (cdr pair) (gnc-get-current-book)))
-	       option-value)
-
-	       ((eqv? type GNC-OWNER-VENDOR)
-		(gncOwnerInitVendor
-		 option-value
-		 (gncVendorLookupFlip (cdr pair) (gnc-get-current-book)))
-		option-value)
-
-	       ((eqv? type GNC-OWNER-EMPLOYEE)
-		(gncOwnerInitEmployee
-		 option-value
-		 (gncEmployeeLookupFlip (cdr pair) (gnc-get-current-book)))
-		option-value)
-
-	       ((eqv? type GNC-OWNER-JOB)
-		(gncOwnerInitJob
-		 option-value
-		 (gncJobLookupFlip (cdr pair) (gnc-get-current-book)))
-		option-value)
-
-	       (else '())))
-	  pair))
-
-    (let* ((option (convert-to-pair (default-getter)))
-	   (option-set #f)
-	   (getter (lambda () (convert-to-owner
-			       (if option-set
-				   option
-				   (default-getter)))))
-	   (value->string (lambda ()
-			    (string-append
-			     "'" (gnc:value->string
-				  (if option-set option #f)))))
-	   (validator
-	    (if (not value-validator)
-		(lambda (owner)
-		  (let ((type (if (pair? owner)
-                                  (car owner)
-                                  (gncOwnerGetType owner))))
-		    (if (equal? type owner-type)
-			(list #t owner)
-			(list #f "Owner-Type Mismatch"))))
-		(lambda (owner)
-		  (value-validator (convert-to-owner owner))))))
-
-      (gnc:make-option
-       section name sort-tag 'owner documentation-string getter
-       (lambda (owner)
-	 (if (null? owner) (set! owner (default-getter)))
-	 (set! owner (convert-to-owner owner))
-	 (let* ((result (validator owner))
-		(valid (car result))
-		(value (cadr result)))
-	   (if valid
-	       (begin
-		 (set! option (convert-to-pair value))
-		 (set! option-set #t))
-	       (gnc:error "Illegal owner value set"))))
-       (lambda () (convert-to-owner (default-getter)))
-       (gnc:restore-form-generator value->string)
-       (lambda (f p)
-	 (kvp-frame-set-slot-path-gslist f (symbol->string (car option))
-				      (append p '("type")))
-	 (kvp-frame-set-slot-path-gslist f (cdr option)
-				      (append p '("value"))))
-       (lambda (f p)
-	 (let ((t (kvp-frame-get-slot-path-gslist f (append p '("type"))))
-	       (v (kvp-frame-get-slot-path-gslist f (append p '("value")))))
-	   (if (and t v (string? t) (string? v))
-	       (begin
-		 (set! option (cons (string->symbol t) v))
-		 (set! option-set #t)))))
-       validator
-       owner-type #f #f #f))))
-
-
-;; Internally, values are always a guid. Externally, both guids and
-;; taxtable pointers may be used to set the value of the option. The
-;; option always returns a single taxtable pointer.
-
-(define (gnc:make-taxtable-option
-	 section
-	 name
-	 sort-tag
-	 documentation-string
-	 default-getter
-	 value-validator)
-
-  (define (convert-to-guid item)
-    (if (string? item)
-        item
-        (gncTaxTableReturnGUID item)))
-
-  (define (convert-to-taxtable item)
-    (if (string? item)
-        (gncTaxTableLookupFlip item (gnc-get-current-book))
-        item))
-
-  (let* ((option (convert-to-guid (default-getter)))
-         (option-set #f)
-         (getter (lambda () (convert-to-taxtable
-			     (if option-set
-				 option
-				 (default-getter)))))
-         (value->string (lambda ()
-                          (string-append
-                           "'" (gnc:value->string (if option-set option #f)))))
-         (validator
-          (if (not value-validator)
-              (lambda (taxtable) (list #t taxtable))
-              (lambda (taxtable)
-                (value-validator (convert-to-taxtable taxtable))))))
-    (gnc:make-option
-     section name sort-tag 'taxtable documentation-string getter
-     (lambda (taxtable)
-       (if (null? taxtable) (set! taxtable (default-getter)))
-       (set! taxtable (convert-to-taxtable taxtable))
-       (let* ((result (validator taxtable))
-	      (valid (car result))
-	      (value (cadr result)))
-	 (if valid
-	     (begin
-	       (set! option (convert-to-guid value))
-	       (set! option-set #t))
-	     (gnc:error "Illegal taxtable value set"))))
-     (lambda () (convert-to-taxtable (default-getter)))
-     (gnc:restore-form-generator value->string)
-     (lambda (f p) (kvp-frame-set-slot-path-gslist f option p))
-     (lambda (f p)
-       (let ((v (kvp-frame-get-slot-path-gslist f p)))
-	 (if (and v (string? v))
-	     (begin
-	       (set! option v)
-	       (set! option-set #t)))))
-     validator
-     #f #f #f #f)))
-
-;; This defines an option to set a counter value. This is a slightly
-;; different kind of option: Unlike all other options, the values edited
-;; by this option are not saved in the "options"/<section> kvm slot, but
-;; in the "counters" slot. This is mostly due to backwards compatibility
-;; and partly because counters are a bit different from other options
-;; anyway.
-;;
-;; This is implemented by overriding the scm->kvp and kvp->scm methods
-;; to ignore the kvp path passed and replace it with a hardcoded
-;; "counters".
-(define (gnc:make-counter-option
-         section
-         name
-	 key
-         sort-tag
-         documentation-string
-         default-value)
-  (let ((option (gnc:make-number-range-option section name sort-tag documentation-string default-value 0 999999999 0 1)))
-     (gnc:set-option-scm->kvp option (lambda (f p) (kvp-frame-set-slot-path-gslist f (inexact->exact ((gnc:option-getter option))) (list "counters" key))))
-     (gnc:set-option-kvp->scm option (lambda (f p)
-                               (let ((v (kvp-frame-get-slot-path-gslist f (list "counters" key))))
-                                 (if (and v (integer? v))
-                                     ((gnc:option-setter option) v)))))
-     option))
-
-;; This defines an option to set a counter format, which has the same
-;; exception as gnc:make-counter-option above.
-(define (gnc:make-counter-format-option
-         section
-         name
-	 key
-         sort-tag
-         documentation-string
-         default-value)
-  (let ((option (gnc:make-string-option section name sort-tag documentation-string default-value)))
-     (gnc:set-option-scm->kvp option (lambda (f p) (kvp-frame-set-slot-path-gslist f ((gnc:option-getter option)) (list "counter_formats" key))))
-     (gnc:set-option-kvp->scm option (lambda (f p)
-                               (let ((v (kvp-frame-get-slot-path-gslist f (list "counter_formats" key))))
-                                 (if (and v (string? v))
-                                     ((gnc:option-setter option) v)))))
-     option))
-
-(export gnc:make-invoice-option)
-(export gnc:make-customer-option)
-(export gnc:make-vendor-option)
-(export gnc:make-employee-option)
-(export gnc:make-owner-option)
-(export gnc:make-taxtable-option)
-(export gnc:make-counter-option)
-(export gnc:make-counter-format-option)

Deleted: gnucash/trunk/src/business/business-utils/business-prefs.scm
===================================================================
--- gnucash/trunk/src/business/business-utils/business-prefs.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/business-utils/business-prefs.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -1,173 +0,0 @@
-;; Business Preferences
-;;
-;; Created by:	Derek Atkins <derek at ihtfp.com>
-;;
-;; This program 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.              
-;;                                                                  
-;; This program 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 this program; if not, contact:
-;;
-;; Free Software Foundation           Voice:  +1-617-542-5942
-;; 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
-;; Boston, MA  02110-1301,  USA       gnu at gnu.org
-
-(define gnc:*option-section-counters* (N_ "Counters"))
-
-;; This defines all available counter types to show options for. This a
-;; list that contains a sublist for each counter type, containing: The
-;; (untranslated) counter name, the format label, the previous number
-;; label, the format help text and the previous number help text.
-(define counter-types
-  (list (list "gncCustomer"     (N_ "Customer number format")
-                                (N_ "Customer number")
-                                (N_ "The format string to use for generating customer numbers. This is a printf-style format string.")
-                                (N_ "The previous customer number generated. This number will be incremented to generate the next customer number."))
-        (list "gncEmployee"     (N_ "Employee number format")
-                                (N_ "Employee number")
-                                (N_ "The format string to use for generating employee numbers. This is a printf-style format string.")
-                                (N_ "The previous employee number generated. This number will be incremented to generate the next employee number."))
-        (list "gncInvoice"      (N_ "Invoice number format")
-                                (N_ "Invoice number")
-                                (N_ "The format string to use for generating invoice numbers. This is a printf-style format string.")
-                                (N_ "The previous invoice number generated. This number will be incremented to generate the next invoice number."))
-        (list "gncBill"         (N_ "Bill number format")
-                                (N_ "Bill number")
-                                (N_ "The format string to use for generating bill numbers. This is a printf-style format string.")
-                                (N_ "The previous bill number generated. This number will be incremented to generate the next bill number."))
-        (list "gncExpVoucher"   (N_ "Expense voucher number format")
-                                (N_ "Expense voucher number")
-                                (N_ "The format string to use for generating expense voucher numbers. This is a printf-style format string.")
-                                (N_ "The previous expense voucher number generated. This number will be incremented to generate the next voucher number."))
-        (list "gncJob"          (N_ "Job number format")
-                                (N_ "Job number")
-                                (N_ "The format string to use for generating job numbers. This is a printf-style format string.")
-                                (N_ "The previous job number generated. This number will be incremented to generate the next job number."))
-        (list "gncOrder"        (N_ "Order number format")
-                                (N_ "Order number")
-                                (N_ "The format string to use for generating order numbers. This is a printf-style format string.")
-                                (N_ "The previous order number generated. This number will be incremented to generate the next order number."))
-        (list "gncVendor"       (N_ "Vendor number format")
-                                (N_ "Vendor number")
-                                (N_ "The format string to use for generating vendor numbers. This is a printf-style format string.")
-                                (N_ "The previous vendor number generated. This number will be incremented to generate the next vendor number."))
-))
-
-(define (book-options-generator options)
-  (define (reg-option new-option)
-    (gnc:register-option options new-option))
-
-  (reg-option
-   (gnc:make-string-option
-    gnc:*business-label* gnc:*company-name*
-    "a" (N_ "The name of your business") ""))
-
-  (reg-option
-   (gnc:make-text-option
-    gnc:*business-label* gnc:*company-addy*
-    "b1" (N_ "The address of your business") ""))
-
-  (reg-option
-   (gnc:make-string-option
-    gnc:*business-label* gnc:*company-contact*
-    "b2" (N_ "The contact person to print on invoices") ""))
-
-  (reg-option
-   (gnc:make-string-option
-    gnc:*business-label* gnc:*company-phone*
-    "c1" (N_ "The phone number of your business") ""))
-
-  (reg-option
-   (gnc:make-string-option
-    gnc:*business-label* gnc:*company-fax*
-    "c2" (N_ "The fax number of your business") ""))
-
-  (reg-option
-   (gnc:make-string-option
-    gnc:*business-label* gnc:*company-email*
-    "c3" (N_ "The email address of your business") ""))
-
-  (reg-option
-   (gnc:make-string-option
-    gnc:*business-label* gnc:*company-url*
-    "c4" (N_ "The URL address of your website") ""))
-
-  (reg-option
-   (gnc:make-string-option
-    gnc:*business-label* gnc:*company-id*
-    "c5" (N_ "The ID for your company (eg 'Tax-ID: 00-000000)")
-    ""))
- 
-  (reg-option
-   (gnc:make-taxtable-option
-    gnc:*business-label* (N_ "Default Customer TaxTable")
-    "e" (N_ "The default tax table to apply to customers.")
-    (lambda () '()) #f))
-
-  (reg-option
-   (gnc:make-taxtable-option
-    gnc:*business-label* (N_ "Default Vendor TaxTable")
-    "f" (N_ "The default tax table to apply to vendors.")
-    (lambda () '()) #f))
-
-  (reg-option
-   (gnc:make-dateformat-option
-    gnc:*business-label* (N_ "Fancy Date Format")
-    "g" (N_ "The default date format used for fancy printed dates")
-    #f))
-
-  ;; Accounts tab
-
-  (reg-option 
-   (gnc:make-simple-boolean-option
-    gnc:*option-section-accounts* gnc:*option-name-trading-accounts*
-    "a" (N_ "Check to have trading accounts used for transactions involving more than one currency or commodity")
-    #f))
-
-  ;; Budgeting Tab
-
-  (reg-option
-   (gnc:make-budget-option
-    gnc:*option-section-budgeting* gnc:*option-name-default-budget*
-    "a" (N_ "Budget to be used when none has been otherwise specified")))
-
-  ;; Counters Tab
-  (map (lambda (vals)
-               (let* (
-		      ; Unpack the list of strings for this counter type
-                      (key (car vals))
-                      (sort-string key)
-                      (format-label (cadr vals))
-                      (number-label (caddr vals))
-                      (format-description (cadddr vals))
-                      (number-description (cadddr (cdr vals)))
-                     )
-                     (begin
-		      ; For each counter-type we create an option for
-		      ; the last used number and the format string to
-		      ; use.
-                      (reg-option
-                       (gnc:make-counter-option
-                        gnc:*option-section-counters* number-label key
-                        (string-append sort-string "a") number-description 0))
-                      (reg-option
-                       (gnc:make-counter-format-option
-                        gnc:*option-section-counters* format-label key
-                        (string-append sort-string "b") format-description ""))
-                      )
-               )
-       )
-       ;; Make counter and format option for each defined counter
-       counter-types
-  )
-)
-
-
-(gnc-register-kvp-option-generator QOF-ID-BOOK-SCM book-options-generator)

Deleted: gnucash/trunk/src/business/business-utils/business-utils.scm
===================================================================
--- gnucash/trunk/src/business/business-utils/business-utils.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/business-utils/business-utils.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -1,31 +0,0 @@
-(define-module (gnucash business-utils))
-
-(use-modules (gnucash gnc-module))
-(gnc:module-load "gnucash/app-utils" 0)
-
-(define gnc:*business-label* (N_ "Business"))
-(define gnc:*company-name* (N_ "Company Name"))
-(define gnc:*company-addy* (N_ "Company Address"))
-(define gnc:*company-id* (N_ "Company ID"))
-(define gnc:*company-phone* (N_ "Company Phone Number"))
-(define gnc:*company-fax* (N_ "Company Fax Number"))
-(define gnc:*company-url* (N_ "Company Website URL"))
-(define gnc:*company-email* (N_ "Company Email Address"))
-(define gnc:*company-contact* (N_ "Company Contact Person"))
-
-(export gnc:*business-label* gnc:*company-name* gnc:*company-addy* gnc:*company-id*
-            gnc:*company-phone* gnc:*company-fax* gnc:*company-url*
-            gnc:*company-email* gnc:*company-contact*)
-
-(define gnc:*option-section-accounts* OPTION-SECTION-ACCOUNTS)
-(define gnc:*option-name-trading-accounts* OPTION-NAME-TRADING-ACCOUNTS)
-
-(export gnc:*option-section-accounts* gnc:*option-name-trading-accounts*)
-
-(define gnc:*option-section-budgeting* OPTION-SECTION-BUDGETING)
-(define gnc:*option-name-default-budget* OPTION-NAME-DEFAULT-BUDGET)
-
-(export gnc:*option-section-budgeting* gnc:*option-name-default-budget*)
-
-(load-from-path "business-options.scm")
-(load-from-path "business-prefs.scm")

Deleted: gnucash/trunk/src/business/business-utils/gncmod-business-utils.c
===================================================================
--- gnucash/trunk/src/business/business-utils/gncmod-business-utils.c	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/business/business-utils/gncmod-business-utils.c	2011-11-21 10:40:43 UTC (rev 21607)
@@ -1,78 +0,0 @@
-/*********************************************************************
- * gncmod-business-utils.c
- * module definition/initialization for the Business Utilitizes module
- *
- * Copyright (c) 2003 Derek Atkins <warlord at MIT.EDU>
- *
- * This program 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.
- *
- * This program 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 this program; if not, contact:
- *
- * Free Software Foundation           Voice:  +1-617-542-5942
- * 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
- * Boston, MA  02110-1301,  USA       gnu at gnu.org
- *********************************************************************/
-
-#include "config.h"
-#include <gmodule.h>
-#include <libguile.h>
-
-#include "gnc-module.h"
-#include "gnc-module-api.h"
-
-GNC_MODULE_API_DECL(libgncmod_business_utils)
-
-/* version of the gnc module system interface we require */
-int libgncmod_business_utils_gnc_module_system_interface = 0;
-
-/* module versioning uses libtool semantics. */
-int libgncmod_business_utils_gnc_module_current  = 0;
-int libgncmod_business_utils_gnc_module_revision = 0;
-int libgncmod_business_utils_gnc_module_age      = 0;
-
-
-char *
-libgncmod_business_utils_gnc_module_path(void)
-{
-    return g_strdup("gnucash/business-utils");
-}
-
-char *
-libgncmod_business_utils_gnc_module_description(void)
-{
-    return g_strdup("The GnuCash business utilities module");
-}
-
-int
-libgncmod_business_utils_gnc_module_init(int refcount)
-{
-    /* Load the application utils.. */
-    if (!gnc_module_load("gnucash/app-utils", 0))
-    {
-        return FALSE;
-    }
-
-    if (refcount == 0)
-    {
-        /* initialize known types */
-    }
-
-    scm_c_eval_string("(use-modules (gnucash business-utils))");
-
-    return TRUE;
-}
-
-int
-libgncmod_business_utils_gnc_module_end(int refcount)
-{
-    return TRUE;
-}

Modified: gnucash/trunk/src/report/business-reports/balsheet-eg.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/balsheet-eg.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/balsheet-eg.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -34,7 +34,7 @@
 (define-module (gnucash report balsheet-eg))
 (use-modules (gnucash main))
 (use-modules (gnucash gnc-module))
-(use-modules (gnucash business-utils))
+(use-modules (gnucash app-utils))
 (use-modules (gnucash report eguile-gnc))
 (use-modules (gnucash report eguile-utilities))
 

Modified: gnucash/trunk/src/report/business-reports/business-reports.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/business-reports.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/business-reports.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -26,7 +26,7 @@
 (define-module (gnucash report business-reports))
 (use-modules (gnucash gnc-module))
 (gnc:module-load "gnucash/report/standard-reports" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 ;; to define gnc-build-url
 (gnc:module-load "gnucash/html" 0)

Modified: gnucash/trunk/src/report/business-reports/customer-summary.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/customer-summary.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/customer-summary.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -34,7 +34,7 @@
 (use-modules (gnucash main))		; for gnc:debug
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))

Modified: gnucash/trunk/src/report/business-reports/easy-invoice.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/easy-invoice.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/easy-invoice.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -35,7 +35,7 @@
 (use-modules (gnucash gnc-module))
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))

Modified: gnucash/trunk/src/report/business-reports/fancy-invoice.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/fancy-invoice.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/fancy-invoice.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -53,7 +53,7 @@
 (use-modules (gnucash gnc-module))
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))

Modified: gnucash/trunk/src/report/business-reports/invoice.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/invoice.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/invoice.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -29,7 +29,7 @@
 (use-modules (gnucash gnc-module))
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))

Modified: gnucash/trunk/src/report/business-reports/job-report.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/job-report.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/job-report.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -32,7 +32,7 @@
 (use-modules (gnucash main))		; for gnc:debug
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 (gnc:module-load "gnucash/business-gnome" 0)
 
 (use-modules (gnucash report standard-reports))

Modified: gnucash/trunk/src/report/business-reports/owner-report.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/owner-report.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/owner-report.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -32,7 +32,7 @@
 (use-modules (gnucash main))        ; for gnc:debug
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))

Modified: gnucash/trunk/src/report/business-reports/payables.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/payables.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/payables.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -29,7 +29,7 @@
 (use-modules (gnucash gnc-module))
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 (use-modules (gnucash report aging))
 (use-modules (gnucash report standard-reports))

Modified: gnucash/trunk/src/report/business-reports/receivables.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/receivables.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/receivables.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -29,7 +29,7 @@
 (use-modules (gnucash gnc-module))
 
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 
 (use-modules (gnucash report aging))
 (use-modules (gnucash report standard-reports))

Modified: gnucash/trunk/src/report/business-reports/taxinvoice.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/taxinvoice.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/business-reports/taxinvoice.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -19,14 +19,13 @@
 ; put the (define-module... back when installing as a 'proper' report
 ; as opposed to referring to it from .gnucash/config.user
 ; (see http://wiki.gnucash.org/wiki/Custom_Reports )
-(define-module (gnucash report taxinvoice))        
+(define-module (gnucash report taxinvoice))
 
 (use-modules (gnucash main))
-(use-modules (gnucash gnc-module))        
+(use-modules (gnucash gnc-module))
 (use-modules (gnucash app-utils))
-(use-modules (gnucash business-utils))
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 (gnc:module-load "gnucash/html" 0)
 (gnc:module-load "gnucash/engine" 0)
 

Modified: gnucash/trunk/src/report/report-system/eguile-html-utilities.scm
===================================================================
--- gnucash/trunk/src/report/report-system/eguile-html-utilities.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/report-system/eguile-html-utilities.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -24,14 +24,13 @@
 
 (define-module (gnucash report eguile-html-utilities))
 
-; using all of these seems like overkill -- 
+; using all of these seems like overkill --
 ; not sure which are really required
 (use-modules (gnucash main))
-(use-modules (gnucash gnc-module))        
+(use-modules (gnucash gnc-module))
 (use-modules (gnucash app-utils))
-(use-modules (gnucash business-utils))
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))
 

Modified: gnucash/trunk/src/report/report-system/eguile-utilities.scm
===================================================================
--- gnucash/trunk/src/report/report-system/eguile-utilities.scm	2011-11-21 10:40:31 UTC (rev 21606)
+++ gnucash/trunk/src/report/report-system/eguile-utilities.scm	2011-11-21 10:40:43 UTC (rev 21607)
@@ -30,9 +30,8 @@
 (use-modules (gnucash gnc-module))
 (use-modules (gnucash app-utils))
 (use-modules (gnucash core-utils))
-(use-modules (gnucash business-utils))
 (gnc:module-load "gnucash/report/report-system" 0)
-(gnc:module-load "gnucash/business-utils" 0)
+(gnc:module-load "gnucash/app-utils" 0)
 (use-modules (gnucash report standard-reports))
 (use-modules (gnucash report business-reports))
 (use-modules (ice-9 syncase)) ; for define-syntax



More information about the gnucash-changes mailing list