mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report] rewrite gnc:report-template-make-unique-name
This commit is contained in:
parent
3352b53491
commit
ad51c5e00a
@ -504,15 +504,12 @@ not found.")))
|
|||||||
;; If this string already exists as a custom template name, a
|
;; If this string already exists as a custom template name, a
|
||||||
;; number will be appended to it.
|
;; number will be appended to it.
|
||||||
(define (gnc:report-template-make-unique-name new-name)
|
(define (gnc:report-template-make-unique-name new-name)
|
||||||
(let* ((unique-name new-name)
|
(let loop ((name new-name)
|
||||||
(counter 0)
|
(counter 1))
|
||||||
(unique? (gnc:report-template-has-unique-name? #f unique-name)))
|
(if (gnc:report-template-has-unique-name? #f name)
|
||||||
(while (not unique?)
|
name
|
||||||
(begin
|
(loop (string-append new-name (number->string counter))
|
||||||
(set! counter (+ counter 1))
|
(1+ counter)))))
|
||||||
(set! unique-name (string-append new-name (number->string counter)))
|
|
||||||
(set! unique? (gnc:report-template-has-unique-name? #f unique-name))))
|
|
||||||
unique-name))
|
|
||||||
|
|
||||||
|
|
||||||
;; Load and save functions
|
;; Load and save functions
|
||||||
|
Loading…
Reference in New Issue
Block a user