Skip to content

Commit b1cec45

Browse files
committed
create a record for material copy when a material is created from form
1 parent 0270825 commit b1cec45

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/com/github/creme332/controller/librarian/MaterialFormController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.github.creme332.model.Book;
66
import com.github.creme332.model.Journal;
77
import com.github.creme332.model.Material;
8+
import com.github.creme332.model.MaterialCopy;
89
import com.github.creme332.model.MaterialType;
910
import com.github.creme332.model.Publisher;
1011
import com.github.creme332.model.Video;
@@ -120,6 +121,11 @@ private void saveToDatabase(Material data) {
120121
if (data instanceof Video)
121122
Video.save((Video) data);
122123

124+
// create a physical copy
125+
// TODO: Request user for the number of copies to create or fetch number from order
126+
MaterialCopy physical = new MaterialCopy(data.getMaterialId());
127+
MaterialCopy.save(physical);
128+
123129
JOptionPane.showMessageDialog(null, "Material data was saved successfully!", "Success",
124130
JOptionPane.INFORMATION_MESSAGE);
125131
materialForm.clearForm();

0 commit comments

Comments
 (0)