View | Details | Raw Unified | Return to bug 7167
Collapse All | Expand All

(-)a/C4/Update/Database.pm (-3 / +3 lines)
Lines 202-208 sub list_versions_already_knows { Link Here
202
            CREATE TABLE  IF NOT EXISTS `updatedb_report` ( `version` text, `md5` varchar(50) DEFAULT NULL, `comment` text, `status` int(1) DEFAULT NULL ) ENGINE=InnoDB CHARSET=utf8;
202
            CREATE TABLE  IF NOT EXISTS `updatedb_report` ( `version` text, `md5` varchar(50) DEFAULT NULL, `comment` text, `status` int(1) DEFAULT NULL ) ENGINE=InnoDB CHARSET=utf8;
203
        });
203
        });
204
    
204
    
205
    my $query = qq/ SELECT version, comment, status FROM updatedb_report /;
205
    my $query = qq/ SELECT version, comment, status FROM updatedb_report ORDER BY version/;
206
    my $sth = $dbh->prepare( $query );
206
    my $sth = $dbh->prepare( $query );
207
    $sth->execute;
207
    $sth->execute;
208
    my $versions = $sth->fetchall_arrayref( {} );
208
    my $versions = $sth->fetchall_arrayref( {} );
Lines 214-225 sub list_versions_already_knows { Link Here
214
    } @$versions;
214
    } @$versions;
215
    $sth->finish;
215
    $sth->finish;
216
    for my $version ( @$versions ) {
216
    for my $version ( @$versions ) {
217
        $query = qq/ SELECT query FROM updatedb_query WHERE version = ? /;
217
        $query = qq/ SELECT query FROM updatedb_query WHERE version = ? ORDER BY version/;
218
        $sth = $dbh->prepare( $query );
218
        $sth = $dbh->prepare( $query );
219
        $sth->execute( $version->{version} );
219
        $sth->execute( $version->{version} );
220
        $version->{queries} = $sth->fetchall_arrayref( {} );
220
        $version->{queries} = $sth->fetchall_arrayref( {} );
221
        $sth->finish;
221
        $sth->finish;
222
        $query = qq/ SELECT error FROM updatedb_error WHERE version = ? /;
222
        $query = qq/ SELECT error FROM updatedb_error WHERE version = ? ORDER BY version/;
223
        $sth = $dbh->prepare( $query );
223
        $sth = $dbh->prepare( $query );
224
        $sth->execute( $version->{version} );
224
        $sth->execute( $version->{version} );
225
        $version->{errors} = $sth->fetchall_arrayref( {} );
225
        $version->{errors} = $sth->fetchall_arrayref( {} );
(-)a/about.pl (+31 lines)
Lines 47-58 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
47
);
47
);
48
48
49
my $kohaVersion   = C4::Context->preference("Version");
49
my $kohaVersion   = C4::Context->preference("Version");
50
# restore ., for display consistency
51
$kohaVersion =~ /(.)\.(..)(..)(...)/;
52
$kohaVersion = "$1.$2.$3.$4";
50
# the $kohaVersion is duplicated since 3.7: the 3.6 (that uses the old mechanism) and the 3.7 (new mechanism). 
53
# the $kohaVersion is duplicated since 3.7: the 3.6 (that uses the old mechanism) and the 3.7 (new mechanism). 
51
# Both versions reflects how the database has been upgraded
54
# Both versions reflects how the database has been upgraded
52
my $already_knows = C4::Update::Database::list_versions_already_knows();
55
my $already_knows = C4::Update::Database::list_versions_already_knows();
56
# $last_known contains the previous DBrev applied number (all . removed). It's used to have a . instead of a number in case of continuous updates
57
my $last_known=0;
58
# $last_known_sep contains the previous DBrev applied with the separator (used for display)
59
my $last_known_sep="";
53
for my $v ( @$already_knows ) {
60
for my $v ( @$already_knows ) {
61
    my $current = $v->{version};
62
    $current =~s/\.//g;
63
    # if the current number is the previous one +1, then just add a ., for a better display N.........N+10, for example 
64
    # (instead of N / N+1 / N+2 / ...)
65
    if ($current==$last_known+1) {
66
        $kohaVersion.=".";
67
    } else { # we're not N+1, start a new range
68
        # if version don't end by a ., no need to add the current loop number
69
        # this avoid having N...N (in case of an isolated BDrev number)
70
        if ($last_known & $kohaVersion =~ /\.$/) {
71
            $kohaVersion .= "...".$last_known_sep;
72
        }
73
        # start a new range
54
        $kohaVersion .= " / ".$v->{version};
74
        $kohaVersion .= " / ".$v->{version};
75
    }
76
    $last_known= $current;
77
    $last_known_sep=$v->{version};
78
}
79
# add the last DB rev number, we don't want to end with "..."
80
if ($kohaVersion =~ /\.$/) {
81
    $kohaVersion .= "...".$last_known_sep;
55
}
82
}
83
84
# remove any 0 just after a . for better readability (3.06.02.001 will become 3.6.2.1)
85
$kohaVersion =~ s/\.0+/\./g;
86
56
my $osVersion     = `uname -a`;
87
my $osVersion     = `uname -a`;
57
my $perl_path = $^X;
88
my $perl_path = $^X;
58
if ($^O ne 'VMS') {
89
if ($^O ne 'VMS') {
(-)a/admin/updatedatabase.pl (+2 lines)
Lines 16-21 Link Here
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
use strict;
19
use CGI;
20
use CGI;
20
use C4::Auth;
21
use C4::Auth;
21
use C4::Output;
22
use C4::Output;
Lines 92-97 if ( $op eq 'list' ) { Link Here
92
    my @v_availables = map { {version => $$_{version}} } @availables;
93
    my @v_availables = map { {version => $$_{version}} } @availables;
93
94
94
    $template->param(
95
    $template->param(
96
        dev_mode => $ENV{DEBUG},
95
        versions => \@sorted,
97
        versions => \@sorted,
96
        nb_availables => scalar @availables,
98
        nb_availables => scalar @availables,
97
        availables => [ map { {version => $$_{version}} } @availables ],
99
        availables => [ map { {version => $$_{version}} } @availables ],
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/updatedatabase.tt (-6 / +7 lines)
Lines 37-43 Link Here
37
[% INCLUDE 'header.inc' %]
37
[% INCLUDE 'header.inc' %]
38
[% INCLUDE 'cat-search.inc' %]
38
[% INCLUDE 'cat-search.inc' %]
39
39
40
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Update Database</div>
40
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; Database update</div>
41
41
42
<div id="doc3" class="yui-t2">
42
<div id="doc3" class="yui-t2">
43
43
Lines 45-51 Link Here
45
    <div id="yui-main">
45
    <div id="yui-main">
46
    <div class="yui-b">
46
    <div class="yui-b">
47
47
48
    <h2>Update Database</h2>
48
    <h2>Database update</h2>
49
    [% IF report_loop %]
49
    [% IF report_loop %]
50
    <div class="report" style="display:block; margin:1em;">
50
    <div class="report" style="display:block; margin:1em;">
51
        Report :
51
        Report :
Lines 66-72 Link Here
66
    [% END %]
66
    [% END %]
67
    <span class="infos" style="display:block; margin:1em;">
67
    <span class="infos" style="display:block; margin:1em;">
68
        [% IF nb_availables %]
68
        [% IF nb_availables %]
69
            [% nb_availables %] versions are availables [ <a href="/cgi-bin/koha/admin/updatedatabase.pl?op=update[% FOREACH av IN availables %]&version=[% av.version %][% END %]">UPDATE</a> ]
69
            [% nb_availables %] update(s) available [ <a href="/cgi-bin/koha/admin/updatedatabase.pl?op=update[% FOREACH av IN availables %]&version=[% av.version %][% END %]">UPDATE</a> ]
70
        [% ELSE %]
70
        [% ELSE %]
71
            Your database is up to date
71
            Your database is up to date
72
        [% END %]
72
        [% END %]
Lines 75-84 Link Here
75
    <table id="versionst">
75
    <table id="versionst">
76
        <thead>
76
        <thead>
77
            <tr>
77
            <tr>
78
                <th>Version</th>
78
                <th>DB revision</th>
79
                <th>Comments</th>
79
                <th>Comments</th>
80
                <th>Status</th>
80
                <th>Status</th>
81
                <th>Launch</th>
81
                <th>Availability</th>
82
                <th>Details</th>
82
                <th>Details</th>
83
            </tr>
83
            </tr>
84
        </thead>
84
        </thead>
Lines 110-116 Link Here
110
                <td>
110
                <td>
111
                    [% IF v.available %]
111
                    [% IF v.available %]
112
                        Available
112
                        Available
113
                        [% IF (dev_mode) %]
113
                        [<a href="/cgi-bin/koha/admin/updatedatabase.pl?op=update&version=[% v.version %]">Execute</a>]
114
                        [<a href="/cgi-bin/koha/admin/updatedatabase.pl?op=update&version=[% v.version %]">Execute</a>]
115
                        [% END %]
114
                    [% ELSE %]
116
                    [% ELSE %]
115
                        Already executed
117
                        Already executed
116
                    [% END %]
118
                    [% END %]
117
- 

Return to bug 7167