- Timestamp:
- 11/13/19 19:37:12 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r2288 r2296 2107 2107 }); 2108 2108 $sth->execute($self->id); 2109 warn $self->id; 2109 2110 my @values; 2110 2111 my $prevContrat = ':'; … … 2117 2118 my $curContrat = $Emp->get_attributes('contratType') || ''; 2118 2119 my $DTfirstday = DateTime::Format::Pg->parse_datetime( $Emp->get_attributes('firstday') ); 2120 2121 warn $DTfirstday->ymd('-'); 2119 2122 2120 2123 if ($curContrat ne $prevContrat) { … … 2150 2153 2151 2154 @values 2155 } 2156 2157 =head2 StoreEmployementSummary 2158 2159 Store into database the employment summary 2160 2161 =cut 2162 2163 sub StoreEmployementSummary { 2164 my ( $self ) = @_; 2165 2166 my $stu = $self->base->db->prepare_cached(q{ 2167 UPDATE employmentsum set 2168 "user" = ?, 2169 firstday = ?, 2170 lastday = ?, 2171 contrattype = ?, 2172 nodelete = 't' 2173 WHERE name = ? 2174 }); 2175 my $sti = $self->base->db->prepare_cached(q{ 2176 INSERT INTO employmentsum 2177 ("user", firstday, lastday, contrattype, name, nodelete) 2178 VALUES 2179 (?, ?, ?, ?, ?, 1) 2180 }); 2181 2182 my @values = $self->EmploymentSummary; 2183 2184 my @names; 2185 2186 foreach (@values) { 2187 my $name = $self->id . '-' . $_->{firstday}; 2188 my $res = $stu->execute($self->id, $_->{firstday}, $_->{lastday}, $_->{contrattype}, $name); 2189 if ($res == 0) { 2190 $sti->execute($self->id, $_->{firstday}, $_->{lastday}, $_->{contrattype}, $name); 2191 } 2192 push(@names, $name); 2193 } 2194 2195 my $std = $self->base->db->prepare_cached(q{ 2196 DELETE FROM employmentsum WHERE "user" = ? AND name != ALL (?) 2197 }); 2198 $std->execute($self->id, \@names); 2152 2199 } 2153 2200
Note: See TracChangeset
for help on using the changeset viewer.