- my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,overduenoticerequired=?,category_type=? WHERE categorycode=?");
- $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type','categorycode'));
+ my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=? WHERE categorycode=?");
+ $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','categorycode'));
+ my @branches = $input->param("branches");
+ if ( @branches ) {
+ $sth = $dbh->prepare("DELETE FROM categories_branches WHERE categorycode = ?");
+ $sth->execute( $input->param( "categorycode" ) );
+ $sth = $dbh->prepare(
+ "INSERT INTO categories_branches
+ ( categorycode, branchcode )
+ VALUES ( ?, ? )"
+ );
+ for my $branchcode ( @branches ) {
+ next if not $branchcode;
+ $sth->bind_param( 1, $input->param( "categorycode" ) );
+ $sth->bind_param( 2, $branchcode );
+ $sth->execute;
+ }
+ }