% if ($message) {
<% $message %>

% } Add an issue

Journal :
Date :
Expected Arrival :
(YYYY-MM-DD)
Issue :
Volume :
Supplements :
Status :

Issue Table % while(my $issue = $issue_list->next) { % if ($issue->status){ % } % else{ % } % }
id Journal Date Expected Arrival Issue Volume Supplements Recieved
<% $issue->id %> <% $issue->journal->title %> <% $issue->date %> <% $issue->arrival_date %> <% $issue->issue %> <% $issue->volume %> <% $issue->supplements %>YesNo
<%args> $action => '' $journal => '' $date => '' $arrival_date => '' $issue => '' $volume => '' $supplements => '' $status => '' <%init> my $message = ''; if ($action =~ /issue/){ if (not $journal or not $date or not $arrival_date or not $issue or not $volume or not $supplements or $status eq '' ){ $message = "Oops - please fill in all fields."; } elsif ($arrival_date !~ /^\d{4}-\d{2}-\d{2}$/){ $message = "Oops - please enter estimated arrival date using YYYY-MM-DD format."; } else { periodicals::issue->find_or_create({journal => $journal, date => $date, arrival_date => $arrival_date, issue => $issue, volume => $volume, supplements => $supplements, status => $status, }); $message = "OK, '$journal, issue $issue, volume $volume' has been added to the database."; $journal = ''; $date = ''; $arrival_date = ''; $issue = ''; $volume = ''; $supplements = ''; $status = ''; } } my $journal_list = periodicals::journal->retrieve_all; my $issue_list = periodicals::issue->retrieve_all;