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

(-)a/C4/Members.pm (-2 / +2 lines)
Lines 276-282 sub GetAllIssues { Link Here
276
'SELECT issues.*, items.*, biblio.*, biblioitems.*, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp,borrowers.firstname,borrowers.surname
276
'SELECT issues.*, items.*, biblio.*, biblioitems.*, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp,borrowers.firstname,borrowers.surname
277
  FROM issues
277
  FROM issues
278
  LEFT JOIN items on items.itemnumber=issues.itemnumber
278
  LEFT JOIN items on items.itemnumber=issues.itemnumber
279
  LEFT JOIN borrowers on borrowers.borrowernumber=issues.issuer
279
  LEFT JOIN borrowers on borrowers.borrowernumber=issues.issuer_id
280
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
280
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
281
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
281
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
282
  WHERE issues.borrowernumber=?
282
  WHERE issues.borrowernumber=?
Lines 284-290 sub GetAllIssues { Link Here
284
  SELECT old_issues.*, items.*, biblio.*, biblioitems.*, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp,borrowers.firstname,borrowers.surname
284
  SELECT old_issues.*, items.*, biblio.*, biblioitems.*, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp,borrowers.firstname,borrowers.surname
285
  FROM old_issues
285
  FROM old_issues
286
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
286
  LEFT JOIN items on items.itemnumber=old_issues.itemnumber
287
  LEFT JOIN borrowers on borrowers.borrowernumber=old_issues.issuer
287
  LEFT JOIN borrowers on borrowers.borrowernumber=old_issues.issuer_id
288
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
288
  LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
289
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
289
  LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
290
  WHERE old_issues.borrowernumber=? AND old_issues.itemnumber IS NOT NULL
290
  WHERE old_issues.borrowernumber=? AND old_issues.itemnumber IS NOT NULL
(-)a/installer/data/mysql/atomicupdate/bug_23916_add_issues_issuer.perl (-4 / +3 lines)
Lines 1-17 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    if( !column_exists( 'issues', 'issuer' ) ) {
3
    if( !column_exists( 'issues', 'issuer_id' ) ) {
4
        $dbh->do( q| ALTER TABLE issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | );
4
        $dbh->do( q| ALTER TABLE issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | );
5
    }
5
    }
6
    if (!foreign_key_exists( 'issues', 'issues_ibfk_borrowers_borrowernumber' )) {
6
    if (!foreign_key_exists( 'issues', 'issues_ibfk_borrowers_borrowernumber' )) {
7
        $dbh->do( q| ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | );
7
        $dbh->do( q| ALTER TABLE issues ADD CONSTRAINT `issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | );
8
    }
8
    }
9
    if( !column_exists( 'old_issues', 'issuer' ) ) {
9
    if( !column_exists( 'old_issues', 'issuer_id' ) ) {
10
        $dbh->do( q| ALTER TABLE old_issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | );
10
        $dbh->do( q| ALTER TABLE old_issues ADD issuer_id INT(11) DEFAULT NULL AFTER borrowernumber | );
11
    }
11
    }
12
    if (!foreign_key_exists( 'old_issues', 'old_issues_ibfk_borrowers_borrowernumber' )) {
12
    if (!foreign_key_exists( 'old_issues', 'old_issues_ibfk_borrowers_borrowernumber' )) {
13
        $dbh->do( q| ALTER TABLE old_issues ADD CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | );
13
        $dbh->do( q| ALTER TABLE old_issues ADD CONSTRAINT `old_issues_ibfk_borrowers_borrowernumber` FOREIGN KEY (`issuer_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE | );
14
    }
14
    }
15
15
16
    NewVersion( $DBversion, 23916, "Add issues.issuer";
16
    NewVersion( $DBversion, 23916, "Add issues.issuer_id";
17
}
17
}
18
- 

Return to bug 23916