summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/sched_item.html
blob: 335f81360dbae4f0fced2e609c8b8c1ce47364a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%if ( $error ) {
%  $cgi->param('error', $error );
<% $cgi->redirect(popurl(2). "sched_item.html?". $cgi->query_string ) %>
%} else {
<% $cgi->redirect(popurl(3). "browse/sched_item.html") %>
%}
<%init>

#XXX more specific AccessRight for scheduling
die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $itemnum = $cgi->param('itemnum');

my $sched_item = qsearchs('sched_item', { 'itemnum' => $itemnum })
  or die "unknown itemnum $itemnum";

my @sched_avail = ();
foreach my $wday (0..6) {
  if ( $cgi->param("sched_avail$wday") eq 'Y' ) {
    push @sched_avail, new FS::sched_avail {
      'itemnum' => $itemnum,
      'wday'    => $wday,
      'stime'   => scalar($cgi->param("sched_avail$wday".'_stime')),
      'etime'   => scalar($cgi->param("sched_avail$wday".'_etime')),
    };
  }
}

my $error = $sched_item->replace_sched_avail(@sched_avail);

</%init>