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