# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
-$VERSION = "18.06.00.004";
+$VERSION = "18.06.00.005";
sub version {
return $VERSION;
default_value: 0
is_nullable: 0
+=head2 created_by
+
+ data_type: 'integer'
+ is_foreign_key: 1
+ is_nullable: 1
+
=head2 datecancellationprinted
data_type: 'date'
{ data_type => "decimal", is_nullable => 1, size => [28, 6] },
"quantityreceived",
{ data_type => "smallint", default_value => 0, is_nullable => 0 },
+ "created_by",
+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"datecancellationprinted",
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
"cancellationreason",
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
+=head2 created_by
+
+Type: belongs_to
+
+Related object: L<Koha::Schema::Result::Borrower>
+
+=cut
+
+__PACKAGE__->belongs_to(
+ "created_by",
+ "Koha::Schema::Result::Borrower",
+ { borrowernumber => "created_by" },
+ {
+ is_deferrable => 1,
+ join_type => "LEFT",
+ on_delete => "SET NULL",
+ on_update => "CASCADE",
+ },
+);
+
=head2 currency
Type: belongs_to
__PACKAGE__->many_to_many("borrowernumbers", "aqorder_users", "borrowernumber");
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:K0GnMGYtZUQ1WCesHKIxHw
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-07-06 14:12:40
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/CljC8eGYHoYM3506qYavg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
{ cascade_copy => 0, cascade_delete => 0 },
);
+=head2 aqorders
+
+Type: has_many
+
+Related object: L<Koha::Schema::Result::Aqorder>
+
+=cut
+
+__PACKAGE__->has_many(
+ "aqorders",
+ "Koha::Schema::Result::Aqorder",
+ { "foreign.created_by" => "self.borrowernumber" },
+ { cascade_copy => 0, cascade_delete => 0 },
+);
+
=head2 article_requests
Type: has_many
__PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
-# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-04-11 19:53:27
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/vLIMxDv4RcJOqKj6Mfg6w
+# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-07-06 14:12:40
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LaQWPXzF1Amzt8fgEEyHdg
__PACKAGE__->belongs_to(
"guarantor",
+++ /dev/null
-ALTER TABLE aqorders ADD COLUMN created_by int(11) NULL DEFAULT NULL AFTER quantityreceived;
-ALTER TABLE aqorders ADD CONSTRAINT aqorders_created_by FOREIGN KEY (created_by) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;
-UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.basketno = aqbasket.basketno;
print "Upgrade to $DBversion done (Bug 20980 - Manual credit offsets are stored as debits)\n";
}
+$DBversion = '18.06.00.005';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( "ALTER TABLE aqorders ADD COLUMN created_by int(11) NULL DEFAULT NULL AFTER quantityreceived;" );
+ $dbh->do( "ALTER TABLE aqorders ADD CONSTRAINT aqorders_created_by FOREIGN KEY (created_by) REFERENCES borrowers (borrowernumber) ON DELETE SET NULL ON UPDATE CASCADE;" );
+ $dbh->do( "UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.basketno = aqbasket.basketno;" );
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 12395 - Save order line's creator)\n";
+}
+
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.