batchRebuildBiblioTables.pl doesn't crash anymore when GetMarcBiblio fails.
[koha.git] / members / messaging.pl
index d7dd5bb..c3479f4 100755 (executable)
@@ -100,7 +100,7 @@ if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) {
             }
         }
 
-        warn( 'calling SetMessaginPreferencse with ' . Data::Dumper->Dump( [ $updater ], [ 'updater' ] ) );
+        #warn( 'calling SetMessaginPreferencse with ' . Data::Dumper->Dump( [ $updater ], [ 'updater' ] ) );
         C4::Members::Messaging::SetMessagingPreference( $updater );
     }
 
@@ -112,7 +112,7 @@ if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) {
 PREF: foreach my $option ( @$messaging_options ) {
     my $pref = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber     => $borrower->{'borrowernumber'},
                                                                   message_name       => $option->{'message_name'} } );
-    warn( Data::Dumper->Dump( [ $pref ], [ 'pref' ] ) );
+    #warn( Data::Dumper->Dump( [ $pref ], [ 'pref' ] ) );
     # make a hashref of the days, selecting one.
     if ( $option->{'takes_days'} ) {
         @{$option->{'select_days'}} = map {; { day        => $_,
@@ -124,6 +124,15 @@ PREF: foreach my $option ( @$messaging_options ) {
     $option->{'digest'} = 'CHECKED' if $pref->{'wants_digest'};
 }
 
+    if ( $borrower->{'category_type'} eq 'C') {
+        my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
+        my $cnt = scalar(@$catcodes);
+        $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1;
+        $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
+    }
+       
+my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'});
+$template->param( picture => 1 ) if $picture;
 
 # get some recent messages sent to this borrower for display:
 my $message_queue = C4::Letters::GetQueuedMessages( { borrowernumber => $query->param('borrowernumber') } );
@@ -133,7 +142,8 @@ $template->param( messagingview               => 1,
                   message_queue               => $message_queue,
                   DHTMLcalendar_dateformat    => C4::Dates->DHTMLcalendar(), 
                   borrowernumber              => $borrowernumber,
-                  branch                      => $branch,        
+                  branchcode                  => $borrower->{'branchcode'},
+                 branchname                  => GetBranchName($borrower->{'branchcode'}),
                   dateformat                  => C4::Context->preference("dateformat"),
                   categoryname                => $borrower->{'description'},
                   $borrower->{'categorycode'} => 1,
@@ -145,6 +155,7 @@ $messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnu
 $template->param( BORROWER_INFO         => [ $borrower ],
                   messagingview         => 1,
                   messaging_preferences => $messaging_options,
+                                 is_child        => ($borrower->{'category_type'} eq 'C'),
                   SMSnumber             => defined $borrower->{'smsalertnumber'} ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'} );
 
 output_html_with_http_headers $query, $cookie, $template->output;