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

(-)a/clubs/clubs-add-modify.pl (-1 / +4 lines)
Lines 44-50 my $schema = Koha::Database->new()->schema(); Link Here
44
44
45
my $id = $cgi->param('id');
45
my $id = $cgi->param('id');
46
my $club = $id ? Koha::Clubs->find($id) : Koha::Club->new();
46
my $club = $id ? Koha::Clubs->find($id) : Koha::Club->new();
47
$template->param( stored => $id ? 'updated' : 'stored' ) if $cgi->param('name');
47
my $stored = $cgi->param('name') ? $id ? 'updated' : 'stored' : undef;
48
48
49
my $club_template_id = $cgi->param('club_template_id');
49
my $club_template_id = $cgi->param('club_template_id');
50
my $club_template = $club->club_template() || Koha::Club::Templates->find($club_template_id);
50
my $club_template = $club->club_template() || Koha::Club::Templates->find($club_template_id);
Lines 92-97 if ( $cgi->param('name') ) { # Update or create club Link Here
92
    }
92
    }
93
93
94
    $id ||= $club->id();
94
    $id ||= $club->id();
95
96
    print $cgi->redirect("/cgi-bin/koha/clubs/clubs.pl?stored=$stored&club_id=$id");
97
    exit;
95
}
98
}
96
99
97
$club = Koha::Clubs->find($id);
100
$club = Koha::Clubs->find($id);
(-)a/clubs/clubs.pl (+10 lines)
Lines 39-48 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
39
    }
39
    }
40
);
40
);
41
41
42
my $stored = $cgi->param('stored');
43
my $club_template_id = $cgi->param('club_template_id');
44
my $club_id = $cgi->param('club_id');
45
46
my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef;
47
my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef;
48
42
my @club_templates = Koha::Club::Templates->search();
49
my @club_templates = Koha::Club::Templates->search();
43
my @clubs          = Koha::Clubs->search();
50
my @clubs          = Koha::Clubs->search();
44
51
45
$template->param(
52
$template->param(
53
    stored         => $stored,
54
    club_template  => $club_template,
55
    club           => $club,
46
    club_templates => \@club_templates,
56
    club_templates => \@club_templates,
47
    clubs          => \@clubs,
57
    clubs          => \@clubs,
48
);
58
);
(-)a/clubs/templates-add-modify.pl (-5 / +7 lines)
Lines 47-61 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
47
my $id = $cgi->param('id');
47
my $id = $cgi->param('id');
48
48
49
my $club_template;
49
my $club_template;
50
my $stored;
50
51
51
if ( $cgi->param('name') ) {    # Update or create club
52
if ( $cgi->param('name') ) {    # Update or create club
52
    if ($id) {
53
    if ($id) {
53
        $club_template = Koha::Club::Templates->find($id);
54
        $club_template = Koha::Club::Templates->find($id);
54
        $template->param( stored => 'updated' );
55
        $stored        = 'updated';
55
    }
56
    }
56
    else {
57
    else {
57
        $club_template = Koha::Club::Template->new();
58
        $club_template = Koha::Club::Template->new();
58
        $template->param( stored => 'created' );
59
        $stored = 'created';
59
    }
60
    }
60
61
61
    $club_template->set(
62
    $club_template->set(
Lines 66-74 if ( $cgi->param('name') ) { # Update or create club Link Here
66
            branchcode  => $cgi->param('branchcode')  || undef,
67
            branchcode  => $cgi->param('branchcode')  || undef,
67
            date_updated            => dt_from_string(),
68
            date_updated            => dt_from_string(),
68
            is_email_required       => $cgi->param('is_email_required') ? 1 : 0,
69
            is_email_required       => $cgi->param('is_email_required') ? 1 : 0,
69
            is_enrollable_from_opac => $cgi->param('is_enrollable_from_opac')
70
            is_enrollable_from_opac => $cgi->param('is_enrollable_from_opac') ? 1 : 0,
70
            ? 1
71
            : 0,
72
        }
71
        }
73
    )->store();
72
    )->store();
74
73
Lines 142-147 if ( $cgi->param('name') ) { # Update or create club Link Here
142
            )->store();
141
            )->store();
143
        }
142
        }
144
    }
143
    }
144
145
    print $cgi->redirect("/cgi-bin/koha/clubs/clubs.pl?stored=$stored&club_template_id=$id");
146
    exit;
145
}
147
}
146
148
147
$club_template ||= Koha::Club::Templates->find($id);
149
$club_template ||= Koha::Club::Templates->find($id);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt (-11 lines)
Lines 15-31 Link Here
15
15
16
<div class="yui-t7">
16
<div class="yui-t7">
17
    <div class="yui-main">
17
    <div class="yui-main">
18
        [% IF stored %]
19
            <div class="alert">
20
                [% IF stored == 'updated' %]
21
                    <p>Your club was updated</p>
22
                [% ELSE %]
23
                    <p>Your club was created</p>
24
                [% END %]
25
                <a href="clubs.pl">Return to patron clubs</a>
26
            </div>
27
        [% END %]
28
29
        <form method="post" class="validated">
18
        <form method="post" class="validated">
30
            <input type="hidden" name="id" value="[% club.id %]" />
19
            <input type="hidden" name="id" value="[% club.id %]" />
31
            <input type="hidden" name="club_template_id" value="[% club_template.id %]" />
20
            <input type="hidden" name="club_template_id" value="[% club_template.id %]" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt (+18 lines)
Lines 78-83 Link Here
78
            <div class="yui-b">
78
            <div class="yui-b">
79
                <h1>Patron clubs</h1>
79
                <h1>Patron clubs</h1>
80
80
81
                [% IF club_template %]
82
                    <div class="dialog message">
83
                        [% IF stored == 'updated' %]
84
                            <p>Club template <i>[% club_template.name %]</i> was updated.</p>
85
                        [% ELSE %]
86
                            <p>Club template <i>[% club_template.name %]</i> was saved.</p>
87
                        [% END %]
88
                    </div>
89
                [% ELSIF club %]
90
                    <div class="dialog message">
91
                        [% IF stored == 'updated' %]
92
                            <p>Club <i>[% club.name %]</i> was updated.</p>
93
                        [% ELSE %]
94
                            <p>Club <i>[% club.name %]</i> was saved.</p>
95
                        [% END %]
96
                    </div>
97
                [% END %]
98
81
                <h3>Club templates</h3>
99
                <h3>Club templates</h3>
82
100
83
                [% IF CAN_user_clubs_edit_templates %]
101
                [% IF CAN_user_clubs_edit_templates %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt (-8 lines)
Lines 12-24 Link Here
12
12
13
<div class="yui-t7">
13
<div class="yui-t7">
14
    <div class="yui-main">
14
    <div class="yui-main">
15
        [% IF stored %]
16
            <div class="alert">
17
                <p>Your club template was [% IF stored == 'updated' %] updated [% ELSE %] saved [% END %]</p>
18
                <a href="clubs.pl">Return to patron clubs</a>
19
            </div>
20
        [% END %]
21
22
        <form method="post" class="validated">
15
        <form method="post" class="validated">
23
            <input type="hidden" name="id" value="[% club_template.id %]" />
16
            <input type="hidden" name="id" value="[% club_template.id %]" />
24
17
25
- 

Return to bug 12461