Merge remote-tracking branch 'origin/new/bug_2780'
[koha_gimpoz] / C4 / Creators / Batch.pm
index fabfdd7..f54e3da 100644 (file)
@@ -149,15 +149,14 @@ sub retrieve {
     };
     while (my $record = $sth->fetchrow_hashref) {
         $self->{'branch_code'} = $record->{'branch_code'};
+        $self->{'creator'} = $record->{'creator'};
         push (@{$self->{'items'}}, {$number_type => $record->{$number_type}, label_id => $record->{'label_id'}});
         $record_flag = 1;       # true if one or more rows were retrieved
     }
-    if ($record_flag == 0) {
-        return; # no such record exists return undef
-    }
+    return -2 if $record_flag == 0;     # a hackish sort of way of indicating no such record exists
     if ($sth->err) {
         warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
-        return;
+        return -1;
     }
     $self->{'batch_stat'} = 1;
     bless ($self, $type);
@@ -265,12 +264,12 @@ This module provides methods for creating, and otherwise manipulating batch obje
 
 =head2 C4::Labels::Batch->retrieve(batch_id => $batch_id)
 
-    Invoking the I<retrieve> method constructs a new batch object containing the current values for batch_id. The method returns a new object upon success and undefined upon failure.
+    Invoking the I<retrieve> method constructs a new batch object containing the current values for batch_id. The method returns a new object upon success and 1 upon failure.
     Errors are logged to the Apache log.
 
     examples:
 
-        my $batch = C4::Labels::Batch->(batch_id => 1); # Retrieves batch 1 and returns an object containing the record
+        my $batch = C4::Labels::Batch->retrieve(batch_id => 1); # Retrieves batch 1 and returns an object containing the record
 
 =head2 delete()