Bug 12508: adding an error message if a contract cannot be removed
[koha_fer] / admin / itemtypes.pl
index 3c33073..87af801 100755 (executable)
@@ -91,6 +91,9 @@ if ($op) {
 
 my $dbh = C4::Context->dbh;
 
+my $sip_media_type = $input->param('sip_media_type');
+undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$/;
+
 ################## ADD_FORM ##################################
 # called by default. Used to create form to add or  modify a record
 if ( $op eq 'add_form' ) {
@@ -121,6 +124,7 @@ if ( $op eq 'add_form' ) {
         checkinmsgtype  => $data->{'checkinmsgtype'},
         imagesets       => $imagesets,
         remote_image    => $remote_image,
+        sip_media_type  => $data->{sip_media_type},
     );
 
     # END $OP eq ADD_FORM
@@ -145,6 +149,7 @@ elsif ( $op eq 'add_validate' ) {
                  , summary = ?
                  , checkinmsg = ?
                  , checkinmsgtype = ?
+                 , sip_media_type = ?
             WHERE itemtype = ?
         ';
         $sth = $dbh->prepare($query2);
@@ -162,15 +167,16 @@ elsif ( $op eq 'add_validate' ) {
             $input->param('summary'),
             $input->param('checkinmsg'),
             $input->param('checkinmsgtype'),
+            $sip_media_type,
             $input->param('itemtype')
         );
     }
     else {    # add a new itemtype & not modif an old
         my $query = "
             INSERT INTO itemtypes
-                (itemtype,description,rentalcharge, notforloan, imageurl, summary, checkinmsg, checkinmsgtype)
+                (itemtype,description,rentalcharge, notforloan, imageurl, summary, checkinmsg, checkinmsgtype, sip_media_type)
             VALUES
-                (?,?,?,?,?,?,?,?);
+                (?,?,?,?,?,?,?,?,?);
             ";
         my $sth = $dbh->prepare($query);
                my $image = $input->param('image');
@@ -185,6 +191,7 @@ elsif ( $op eq 'add_validate' ) {
             $input->param('summary'),
             $input->param('checkinmsg'),
             $input->param('checkinmsgtype'),
+            $sip_media_type,
         );
     }