Lines 129-135
if ( not $fromcat && $tocat ) { #make sure we've specified the info we need.
Link Here
|
129 |
|
129 |
|
130 |
cronlogaction(); |
130 |
cronlogaction(); |
131 |
|
131 |
|
132 |
my $dbh = C4::Context->dbh; |
132 |
my $dbh = C4::Context->dbh; |
|
|
133 |
my $database = Koha::Database->new(); |
134 |
my $schema = $database->schema; |
133 |
|
135 |
|
134 |
#get today's date, format it and subtract upperagelimit |
136 |
#get today's date, format it and subtract upperagelimit |
135 |
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = |
137 |
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = |
Lines 166-172
my $itsyourbirthday = "$year-$mon-$mday";
Link Here
|
166 |
|
168 |
|
167 |
if ( not $noaction ) { |
169 |
if ( not $noaction ) { |
168 |
# Start a transaction since we need to delete from relationships and update borrowers atomically |
170 |
# Start a transaction since we need to delete from relationships and update borrowers atomically |
169 |
$dbh->{AutoCommit} = 0; |
|
|
170 |
|
171 |
|
171 |
my $success = 1; |
172 |
my $success = 1; |
172 |
if ($mybranch) { #yep, we received a specific branch to work on. |
173 |
if ($mybranch) { #yep, we received a specific branch to work on. |
Lines 183-188
if ( not $noaction ) {
Link Here
|
183 |
) |
184 |
) |
184 |
|; |
185 |
|; |
185 |
|
186 |
|
|
|
187 |
$schema->storage->txn_begin; |
188 |
|
186 |
my $query = qq| |
189 |
my $query = qq| |
187 |
DELETE relationships FROM relationships |
190 |
DELETE relationships FROM relationships |
188 |
LEFT JOIN borrowers ON ( borrowers.borrowernumber = relationships.guarantee_id ) |
191 |
LEFT JOIN borrowers ON ( borrowers.borrowernumber = relationships.guarantee_id ) |
Lines 202-210
if ( not $noaction ) {
Link Here
|
202 |
or $success = 0; |
205 |
or $success = 0; |
203 |
|
206 |
|
204 |
if ( $success ) { |
207 |
if ( $success ) { |
205 |
$dbh->commit; |
208 |
$schema->storage->txn_commit; |
206 |
} else { |
209 |
} else { |
207 |
$dbh->rollback; |
210 |
$schema->storage->txn_rollback; |
208 |
die "can't execute"; |
211 |
die "can't execute"; |
209 |
} |
212 |
} |
210 |
|
213 |
|
211 |
- |
|
|