removed unconditional warn introduced in previous patch
[koha.git] / cataloguing / value_builder / unimarc_field_4XX.pl
index 4cdc4ec..91c4361 100755 (executable)
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
 use strict;
+#use warnings; FIXME - Bug 2505
 
 use CGI;
 use C4::Output;
@@ -31,6 +32,7 @@ use C4::Biblio;
 use C4::Koha;
 use MARC::Record;
 use C4::Branch;    # GetBranches
+use C4::ItemType;
 
 sub plugin_parameters {
     my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
@@ -52,7 +54,7 @@ sub plugin_javascript {
 
         function Clic$function_name(i) {
             defaultvalue=document.getElementById(\"$field_number\").value;
-            window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
+            window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_4XX.pl&index=\" + i + \"&result=\"+defaultvalue,\"unimarc field 4\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes');
 
         }
     </script>
@@ -94,7 +96,7 @@ sub plugin {
                 query           => $query,
                 type            => "intranet",
                 authnotrequired => 0,
-                flagsrequired   => { editcatalogue => 1 },
+                flagsrequired   => { editcatalogue => '*' },
                 debug           => 1,
             }
         );
@@ -327,9 +329,11 @@ sub plugin {
     }
     elsif ( $op eq "do_search" ) {
         my $search         = $query->param('search');
+        my $itype          = $query->param('itype');
         my $startfrom      = $query->param('startfrom');
         my $resultsperpage = $query->param('resultsperpage') || 20;
         my $orderby;
+        $search = 'kw,wrdl='.$search.' and mc-itemtype='.$itype if $itype;
         my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom * $resultsperpage, $resultsperpage );
         my $total = scalar(@$results);
 
@@ -530,10 +534,13 @@ sub plugin {
 #         }
 #         $sth->finish;
 
+        my @itemtypes = C4::ItemType->all;
+
         $template->param(    #classlist => $classlist,
             CGIitemtype  => $CGIitemtype,
             CGIbranch    => $CGIbranch,
             CGIPublisher => $CGIpublisher,
+            itypeloop    => \@itemtypes,
             index        => $query->param('index'),
             Search       => 1,
         );