synch'ing 2.2 and head
authortipaul <tipaul>
Wed, 4 May 2005 08:45:03 +0000 (08:45 +0000)
committertipaul <tipaul>
Wed, 4 May 2005 08:45:03 +0000 (08:45 +0000)
acqui.simple/addbiblio-nomarc.pl
acqui.simple/addbiblio.pl
acqui.simple/addbooks.pl
acqui.simple/additem-nomarc.pl
acqui.simple/additem.pl
acqui.simple/isbnsearch.pl
acqui/basket.pl
acqui/newbasket2.pl
acqui/recieveorder.pl
acqui/suggestion-select.pl

index 51596a3..7859a60 100755 (executable)
 # Suite 330, Boston, MA  02111-1307 USA
 
 # $Log$
+# Revision 1.3  2005/05/04 08:45:22  tipaul
+# synch'ing 2.2 and head
+#
+# Revision 1.2.4.1  2005/03/25 12:52:42  tipaul
+# needs "editcatalogue" flag, not "catalogue"
+#
 # Revision 1.2  2003/05/09 23:47:22  rangi
 # This script is now templated
 # 3 more to go i think
@@ -45,7 +51,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
-        flagsrequired   => { catalogue => 1 },
+        flagsrequired   => { editcatalogue => 1 },
         debug           => 1,
     }
 );
index 9100055..ffbff99 100755 (executable)
@@ -197,14 +197,17 @@ sub create_input () {
                $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"50\" maxlength=\"255\" DISABLE READONLY>";
        # it's a standard field
        } else {
-               $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"50\" maxlength=\"255\">"; #"
+               if (length($value) >200) {
+                       $subfield_data{marc_value}="<textarea name=\"fieldvalue\" cols=\"50\" rows=\"5\" >$value</textarea>";
+               } else {
+                       $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\" value=\"$value\" size=\"50\">"; #"
+               }
        }
        return \%subfield_data;
 }
 
 sub build_tabs ($$$$) {
     my($template, $record, $dbh,$encoding) = @_;
-
     # fill arrays
     my @loop_data =();
     my $tag;
@@ -260,7 +263,7 @@ sub build_tabs ($$$$) {
                                                push (@loop_data, \%tag_data);
                                        }
 # If there is more than 1 field, add an empty hidden field as separator.
-                                       if ($#fields >=1) {
+                                       if ($#fields >1) {
                                                my @subfields_data;
                                                my %tag_data;
                                                push(@subfields_data, &create_input('','','',$i,$tabloop,$record,$authorised_values_sth));
index 18304b2..4222fe7 100755 (executable)
@@ -52,7 +52,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         query           => $query,
         type            => "intranet",
         authnotrequired => 0,
-        flagsrequired   => { catalogue => 1 },
+        flagsrequired   => { editcatalogue => 1 },
         debug           => 1,
     }
 );
index 8a126cb..6747c08 100755 (executable)
 # Suite 330, Boston, MA  02111-1307 USA
 
 # $Log$
+# Revision 1.5  2005/05/04 08:45:33  tipaul
+# synch'ing 2.2 and head
+#
+# Revision 1.4.2.1  2005/03/25 12:52:44  tipaul
+# needs "editcatalogue" flag, not "catalogue"
+#
 # Revision 1.4  2004/11/19 16:41:49  tipaul
 # improving behaviour when MARC=OFF
 #
@@ -95,7 +101,7 @@ else {
                 query           => $input,
                 type            => "intranet",
                 authnotrequired => 0,
-                flagsrequired   => { catalogue => 1 },
+                flagsrequired   => { editcatalogue => 1 },
                 debug           => 1,
             }
         );
index d8323b0..38cc1fa 100755 (executable)
@@ -120,6 +120,7 @@ if ($op eq "additem") {
        }
        my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators);
 # MARC::Record builded => now, record in DB
+# warn "R: ".$record->as_formatted;
        my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0);
        $itemnum="";
        $nextop="additem";
@@ -269,7 +270,7 @@ my ($template, $loggedinuser, $cookie)
                             query => $input,
                             type => "intranet",
                             authnotrequired => 0,
-                            flagsrequired => {parameters => 1},
+                            flagsrequired => {editcatalogue => 1},
                             debug => 1,
                             });
 
index d014cda..54619b1 100755 (executable)
@@ -21,34 +21,30 @@ use strict;
 use CGI;
 use C4::Auth;
 use C4::Biblio;
-use C4::Search;
+# use C4::Search;
+use C4::Breeding;
+use C4::SearchMarc;
 use C4::Output;
 use C4::Interface::CGI::Output;
 use HTML::Template;
 use C4::Koha;
 
 my $input      = new CGI;
-my $isbn       = $input->param('isbn');
-my $title      = $input->param('title');
 my $offset     = $input->param('offset');
 my $num        = $input->param('num');
-my $showoffset = $offset + 1;
-my $total;
-my $count;
-my @results;
+# my $total;
+# my $count;
+# my @results;
 my $marc_p = C4::Context->boolean_preference("marc");
+my $dbh = C4::Context->dbh;
 
-if ( !$isbn && !$title ) {
-    print $input->redirect('addbooks.pl');
-}
-else {
     my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
         {
             template_name   => "acqui.simple/isbnsearch.tmpl",
             query           => $input,
             type            => "intranet",
             authnotrequired => 0,
-            flagsrequired   => { catalogue => 1 },
+            flagsrequired   => { editcatalogue => 1 },
             debug           => 1,
         }
     );
@@ -56,10 +52,77 @@ else {
     # fill with books in ACTIVE DB (biblio)
     if ( !$offset ) {
         $offset     = 0;
-        $showoffset = 1;
     }
     if ( !$num ) { $num = 10 }
-    ( $count, @results ) = isbnsearch( $isbn, $title );
+       my @marclist = $input->param('marclist');
+       my @and_or = $input->param('and_or');
+       my @excluding = $input->param('excluding');
+       my @operator = $input->param('operator');
+       my @value = $input->param('value');
+       my $title= @value[0];
+       my $isbn = @value[1];
+       my $resultsperpage= $input->param('resultsperpage');
+       $resultsperpage = 5 if(!defined $resultsperpage);
+       my $startfrom=$input->param('startfrom');
+       $startfrom=0 if(!defined $startfrom);
+       my $orderby = $input->param('orderby');
+       my $desc_or_asc = $input->param('desc_or_asc');
+
+       # builds tag and subfield arrays
+       my @tags;
+
+       foreach my $marc (@marclist) {
+               if ($marc) {
+                       my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,$marc,'');
+                       if ($tag) {
+                               push @tags,$dbh->quote("$tag$subfield");
+                       } else {
+                               push @tags, $dbh->quote(substr($marc,0,4));
+                       }
+               } else {
+                       push @tags, "";
+               }
+       }
+       findseealso($dbh,\@tags);
+       my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or,
+                                                                               \@excluding, \@operator, \@value,
+                                                                               $startfrom, $resultsperpage,'biblio.title','ASC');
+#      @results = @$resultsref;
+
+#     my @loop_data = ();
+#     my $toggle;
+#     for ( my $i = $offset ; $i < $total ; $i++ ) {
+#         if ( $i % 2 ) {
+#             $toggle = 0;
+#         } else {
+#             $toggle = 1;
+#         }
+#         my %row_data;    # get a fresh hash for the row data
+#         $row_data{toggle}        = $toggle;
+#         $row_data{biblionumber}  = $results[$i]->{'biblionumber'};
+#         $row_data{title}         = $results[$i]->{'title'};
+#         $row_data{author}        = $results[$i]->{'author'};
+#         $row_data{copyrightdate} = $results[$i]->{'copyrightdate'};
+#              $row_data{classification} = $results[$i]->{'classification'};
+#         $row_data{NOTMARC}       = !$marc_p; 
+#         push ( @loop_data, \%row_data );
+#     }
+       # multi page display gestion
+       my $displaynext=0;
+       my $displayprev=$startfrom;
+       if(($total - (($startfrom+1)*($resultsperpage))) > 0 ) {
+               $displaynext = 1;
+       }
+
+       my @field_data = ();
+
+       for(my $i = 0 ; $i <= $#marclist ; $i++) {
+               push @field_data, { term => "marclist", val=>$marclist[$i] };
+               push @field_data, { term => "and_or", val=>$and_or[$i] };
+               push @field_data, { term => "excluding", val=>$excluding[$i] };
+               push @field_data, { term => "operator", val=>$operator[$i] };
+               push @field_data, { term => "value", val=>$value[$i] };
+       }
 
     if ( $count < ( $offset + $num ) ) {
         $total = $count;
@@ -130,9 +193,10 @@ else {
     }
 
     # fill with books in breeding farm
-    ( $count, @results ) = breedingsearch( $title, $isbn );
+       my $toggle=0;
+    my ( $countbr, @resultsbr ) = BreedingSearch( @value[0], @value[1] );
     my @breeding_loop = ();
-    for ( my $i = 0 ; $i <= $#results ; $i++ ) {
+    for ( my $i = 0 ; $i <= $#resultsbr ; $i++ ) {
         my %row_data;
         if ( $i % 2 ) {
             $toggle = 0;
@@ -141,16 +205,15 @@ else {
             $toggle = 1;
         }
         $row_data{toggle} = $toggle;
-        $row_data{id}     = $results[$i]->{'id'};
-        $row_data{isbn}   = $results[$i]->{'isbn'};
-        $row_data{file}   = $results[$i]->{'file'};
-        $row_data{title}  = $results[$i]->{'title'};
-        $row_data{author} = $results[$i]->{'author'};
+        $row_data{id}     = $resultsbr[$i]->{'id'};
+        $row_data{isbn}   = $resultsbr[$i]->{'isbn'};
+        $row_data{file}   = $resultsbr[$i]->{'file'};
+        $row_data{title}  = $resultsbr[$i]->{'title'};
+        $row_data{author} = $resultsbr[$i]->{'author'};
         $row_data{NOTMARC}= !$marc_p;  
         push ( @breeding_loop, \%row_data );
     }
 
-
        # get framework list
        my $frameworks = getframeworks;
        my @frameworkcodeloop;
@@ -162,16 +225,22 @@ else {
        }
 
     $template->param(
-        isbn          => $isbn,
-        title         => $title,
-        showoffset    => $showoffset,
+               title             => $title,
+               isbn              => $isbn,
+                                                       startfrom=> $startfrom,
+                                                       displaynext=> $displaynext,
+                                                       displayprev=> $displayprev,
+                                                       resultsperpage => $resultsperpage,
+                                                       startfromnext => $startfrom+1,
+                                                       startfromprev => $startfrom-1,
+                                                       searchdata=>\@field_data,
+                                                       numbers=>\@numbers,
+                                                       from => $from,
+                                                       to => $to,
         total         => $total,
-        offset        => $offset,
-        loop          => \@loop_data,
+        offset        => $offset,
+        loop          => $results,
         breeding_loop => \@breeding_loop,
-        numbers       => \@numbers,
-        term          => $term,
-        value         => $value,
         NOTMARC       => !$marc_p,
                frameworkcodeloop => \@frameworkcodeloop,
     );
@@ -180,5 +249,4 @@ else {
         -type   => guesstype( $template->output ),
         -cookie => $cookie
       ),
-      $template->output;
-}    # else
+      $template->output;
\ No newline at end of file
index 22c426f..515abfd 100755 (executable)
@@ -64,7 +64,6 @@ my $line_total; # total of each line
 my $sub_total; # total of line totals
 my $gist;      # GST
 my $grand_total; # $subttotal + $gist
-my $toggle=0;
 
 my @books_loop;
 for (my $i=0;$i<$count;$i++){
@@ -74,12 +73,10 @@ for (my $i=0;$i<$count;$i++){
        $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'};
        $sub_total+=$line_total;
        my %line;
-       if ($toggle==0){
-               $line{color}='#EEEEEE';
-               $toggle=1;
+       if ($i % 2){
+               $line{highlight}=1;
        } else {
-               $line{color}='white';
-               $toggle=0;
+               $line{highlight}=0;
        }
        $line{ordernumber} = $results[$i]->{'ordernumber'};
        $line{publishercode} = $results[$i]->{'publishercode'};
@@ -106,6 +103,7 @@ $template->param(basketno => $basketno,
                                authorisedby => $basket->{authorisedby},
                                authorisedbyname => $basket->{authorisedbyname},
                                closedate => format_date($basket->{closedate}),
+                               active => $booksellers[0]->{'active'},
                                booksellerid=> $booksellers[0]->{'id'},
                                name => $booksellers[0]->{'name'},
                                entrydate => format_date($results[0]->{'entrydate'}),
index 7fc0cb0..ab71007 100755 (executable)
@@ -71,7 +71,7 @@ my ($template, $loggedinuser, $cookie)
                             query => $input,
                             type => "intranet",
                             authnotrequired => 0,
-                            flagsrequired => {superlibrarian => 1},
+                            flagsrequired => {acquisition => 1},
                             debug => 1,
                             });
 
index 024c4f8..1c5f84c 100755 (executable)
@@ -32,7 +32,7 @@ use HTML::Template;
 use C4::Acquisition;
 
 my $input=new CGI;
-my $supplierid=$input->param('supplierid');
+my $supplierid=$input->param('id');
 my ($count,@booksellers)=bookseller($supplierid);
 
 my ($template, $loggedinuser, $cookie)
index 8eb405f..f32cb73 100755 (executable)
@@ -23,7 +23,7 @@ my $publicationyear = $input->param('publicationyear');
 my $place = $input->param('place');
 my $isbn = $input->param('isbn');
 my $status = 'ACCEPTED';
-my $suggestedbyme = 1;
+my $suggestedbyme = -1; # search ALL suggestors
 my $op = $input->param('op');
 $op = 'else' unless $op;
 
@@ -33,7 +33,7 @@ my ($template, $borrowernumber, $cookie)
                             type => "intranet",
                             query => $input,
                             authnotrequired => 1,
-                            flagsrequired => {borrow => 1},
+                            flagsrequired => {acquisition => 1},
                         });
 
 my $suggestions_loop= &searchsuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);