|
19 | 19 | /** |
20 | 20 | * Add sequential signing support |
21 | 21 | * - Adds 'signing_order', 'status', and 'released_at' columns to libresign_sign_request table |
| 22 | + * - Adds 'signature_flow' column to libresign_file table |
22 | 23 | */ |
23 | 24 | class Version15000Date20251209000000 extends SimpleMigrationStep { |
24 | 25 | public function __construct( |
@@ -81,13 +82,20 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array |
81 | 82 | $qb->executeStatement(); |
82 | 83 |
|
83 | 84 | // Second: Update status = 1 for able_to_sign requests (status = 0 AND signed IS NULL AND file.status = 1) |
84 | | - $qb = $this->db->getQueryBuilder(); |
85 | | - $qb->update('libresign_sign_request', 'sr') |
86 | | - ->innerJoin('sr', 'libresign_file', 'f', $qb->expr()->eq('sr.file_id', 'f.id')) |
87 | | - ->set('sr.status', $qb->createNamedParameter(1, IQueryBuilder::PARAM_INT)) |
88 | | - ->where($qb->expr()->eq('sr.status', $qb->createNamedParameter(0, IQueryBuilder::PARAM_INT))) |
89 | | - ->andWhere($qb->expr()->isNull('sr.signed')) |
90 | | - ->andWhere($qb->expr()->eq('f.status', $qb->createNamedParameter(1, IQueryBuilder::PARAM_INT))); |
91 | | - $qb->executeStatement(); |
| 85 | + $qbSelect = $this->db->getQueryBuilder(); |
| 86 | + $qbSelect->select('id') |
| 87 | + ->from('libresign_file') |
| 88 | + ->where($qbSelect->expr()->eq('status', $qbSelect->createNamedParameter(1, IQueryBuilder::PARAM_INT))); |
| 89 | + $fileIds = $qbSelect->executeQuery()->fetchAll(\PDO::FETCH_COLUMN); |
| 90 | + |
| 91 | + if (!empty($fileIds)) { |
| 92 | + $qbUpdate = $this->db->getQueryBuilder(); |
| 93 | + $qbUpdate->update('libresign_sign_request') |
| 94 | + ->set('status', $qbUpdate->createNamedParameter(1, IQueryBuilder::PARAM_INT)) |
| 95 | + ->where($qbUpdate->expr()->eq('status', $qbUpdate->createNamedParameter(0, IQueryBuilder::PARAM_INT))) |
| 96 | + ->andWhere($qbUpdate->expr()->isNull('signed')) |
| 97 | + ->andWhere($qbUpdate->expr()->in('file_id', $qbUpdate->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY))); |
| 98 | + $qbUpdate->executeStatement(); |
| 99 | + } |
92 | 100 | } |
93 | 101 | } |
0 commit comments