| 
      
            Lines 1836-1852
          sub AddIssue {
      
      
        Link Here
      
     | 
  
        
          | 1836 | 
                              $item_unblessed->{charge} = $charge; | 
          1836 | 
                              $item_unblessed->{charge} = $charge; | 
        
        
          | 1837 | 
                          }  | 
          1837 | 
                          }  | 
        
        
          | 1838 | 
                      }  | 
          1838 | 
                      }  | 
        
          
            
              | 1839 | 
               | 
              1839 | 
                          _updateNotForLoanFromYaml( $item_object, 'UpdateNotForLoanStatusOnCheckout' );  | 
            
            
              | 1840 | 
                          my $rules = C4::Context->yaml_preference('UpdateNotForLoanStatusOnCheckout'); | 
               | 
               | 
            
            
              | 1841 | 
                          if ($rules) { | 
            
            
              | 1842 | 
                              foreach my $key ( keys %$rules ) { | 
            
            
              | 1843 | 
                                  if ( $item_object->notforloan eq $key ) { | 
            
            
              | 1844 | 
                                      $item_object->notforloan( $rules->{$key} ) | 
            
            
              | 1845 | 
                                          ->store( { log_action => 0, skip_record_index => 1 } ); | 
            
            
              | 1846 | 
                                      last;  | 
            
            
              | 1847 | 
                                  }  | 
            
            
              | 1848 | 
                              }  | 
            
            
              | 1849 | 
                          }  | 
            
        
          | 1850 | 
           | 
          1840 | 
           | 
        
        
          | 1851 | 
                      # Record the fact that this book was issued.  | 
          1841 | 
                      # Record the fact that this book was issued.  | 
        
        
          | 1852 | 
                      C4::Stats::UpdateStats(  | 
          1842 | 
                      C4::Stats::UpdateStats(  | 
        
  
    | 
      
            Lines 2175-2181
          sub AddReturn {
      
      
        Link Here
      
     | 
  
        
          | 2175 | 
              $branch = C4::Context->userenv->{'branch'} unless $branch;    # we trust userenv to be a safe fallback/default | 
          2165 | 
              $branch = C4::Context->userenv->{'branch'} unless $branch;    # we trust userenv to be a safe fallback/default | 
        
        
          | 2176 | 
              my $return_date_specified = !!$return_date;  | 
          2166 | 
              my $return_date_specified = !!$return_date;  | 
        
        
          | 2177 | 
              $return_date //= dt_from_string();  | 
          2167 | 
              $return_date //= dt_from_string();  | 
        
          
            
              | 2178 | 
                  my $messages;  | 
              2168 | 
                  my $messages = {}; | 
            
        
          | 2179 | 
              my $patron;  | 
          2169 | 
              my $patron;  | 
        
        
          | 2180 | 
              my $doreturn      = 1;  | 
          2170 | 
              my $doreturn      = 1;  | 
        
        
          | 2181 | 
              my $validTransfer = 1;  | 
          2171 | 
              my $validTransfer = 1;  | 
        
  
    | 
      
            Lines 2256-2287
          sub AddReturn {
      
      
        Link Here
      
     | 
  
        
          | 2256 | 
                  $messages->{$loc_msg_key} = $loc_messages->{$loc_msg_key}; | 
          2246 | 
                  $messages->{$loc_msg_key} = $loc_messages->{$loc_msg_key}; | 
        
        
          | 2257 | 
              }  | 
          2247 | 
              }  | 
        
        
          | 2258 | 
           | 
          2248 | 
           | 
        
          
            
              | 2259 | 
                  my $rules = C4::Context->yaml_preference('UpdateNotForLoanStatusOnCheckin'); | 
              2249 | 
                  _updateNotForLoanFromYaml( $item, 'UpdateNotForLoanStatusOnCheckin', $messages );  | 
            
            
              | 2260 | 
                  if ($rules) { | 
               | 
               | 
            
            
              | 2261 | 
                      if ( defined $rules->{ $item->itype } ) { | 
            
            
              | 2262 | 
                          foreach my $notloan_rule_key ( keys %{ $rules->{ $item->itype } } ) { | 
            
            
              | 2263 | 
                              if ( $item->notforloan eq $notloan_rule_key ) { | 
            
            
              | 2264 | 
                                  $messages->{'NotForLoanStatusUpdated'} = | 
            
            
              | 2265 | 
                                      { from => $item->notforloan, to => $rules->{ $item->itype }->{$notloan_rule_key} }; | 
            
            
              | 2266 | 
                                  $item->notforloan( $rules->{ $item->itype }->{$notloan_rule_key} ) | 
            
            
              | 2267 | 
                                      ->store( { log_action => 0, skip_record_index => 1, skip_holds_queue => 1 } ) | 
            
            
              | 2268 | 
                                      unless $rules->{ $item->itype }->{$notloan_rule_key} eq 'ONLYMESSAGE'; | 
            
            
              | 2269 | 
                                  last;  | 
            
            
              | 2270 | 
                              }  | 
            
            
              | 2271 | 
                          }  | 
            
            
              | 2272 | 
                      } elsif ( defined $rules->{'_ALL_'} ) { | 
            
            
              | 2273 | 
                          foreach my $notloan_rule_key ( keys %{ $rules->{'_ALL_'} } ) { | 
            
            
              | 2274 | 
                              if ( $item->notforloan eq $notloan_rule_key ) { | 
            
            
              | 2275 | 
                                  $messages->{'NotForLoanStatusUpdated'} = | 
            
            
              | 2276 | 
                                      { from => $item->notforloan, to => $rules->{'_ALL_'}->{$notloan_rule_key} }; | 
            
            
              | 2277 | 
                                  $item->notforloan( $rules->{'_ALL_'}->{$notloan_rule_key} ) | 
            
            
              | 2278 | 
                                      ->store( { log_action => 0, skip_record_index => 1, skip_holds_queue => 1 } ) | 
            
            
              | 2279 | 
                                      unless $rules->{'_ALL_'}->{$notloan_rule_key} eq 'ONLYMESSAGE'; | 
            
            
              | 2280 | 
                                  last;  | 
            
            
              | 2281 | 
                              }  | 
            
            
              | 2282 | 
                          }  | 
            
            
              | 2283 | 
                      }  | 
            
            
              | 2284 | 
                  }  | 
            
        
          | 2285 | 
           | 
          2250 | 
           | 
        
        
          | 2286 | 
              # check if the return is allowed at this branch  | 
          2251 | 
              # check if the return is allowed at this branch  | 
        
        
          | 2287 | 
              my ( $returnallowed, $message ) = CanBookBeReturned( $item->unblessed, $branch );  | 
          2252 | 
              my ( $returnallowed, $message ) = CanBookBeReturned( $item->unblessed, $branch );  | 
        
  
    | 
      
            Lines 4807-4812
          sub _CanBookBeAutoRenewed {
      
      
        Link Here
      
     | 
  
        
          | 4807 | 
              return "ok";  | 
          4772 | 
              return "ok";  | 
        
        
          | 4808 | 
          }  | 
          4773 | 
          }  | 
        
        
          | 4809 | 
           | 
          4774 | 
           | 
        
            
               | 
               | 
              4775 | 
              sub _updateNotForLoanFromYaml { | 
            
            
              | 4776 | 
                  my ( $item, $NotForLoanUpdatePreference, $messages ) = @_;  | 
            
            
              | 4777 | 
               | 
            
            
              | 4778 | 
                  my $rules = C4::Context->yaml_preference($NotForLoanUpdatePreference);  | 
            
            
              | 4779 | 
                  if ($rules) { | 
            
            
              | 4780 | 
                      if ( defined $rules->{ $item->itype } ) { | 
            
            
              | 4781 | 
                          foreach my $notloan_rule_key ( keys %{ $rules->{ $item->itype } } ) { | 
            
            
              | 4782 | 
                              if ( $item->notforloan eq $notloan_rule_key ) { | 
            
            
              | 4783 | 
                                  $messages->{'NotForLoanStatusUpdated'} = | 
            
            
              | 4784 | 
                                      { from => $item->notforloan, to => $rules->{ $item->itype }->{$notloan_rule_key} }; | 
            
            
              | 4785 | 
                                  $item->notforloan( $rules->{ $item->itype }->{$notloan_rule_key} ) | 
            
            
              | 4786 | 
                                      ->store( { log_action => 0, skip_record_index => 1, skip_holds_queue => 1 } ) | 
            
            
              | 4787 | 
                                      unless $rules->{ $item->itype }->{$notloan_rule_key} eq 'ONLYMESSAGE'; | 
            
            
              | 4788 | 
                                  last;  | 
            
            
              | 4789 | 
                              }  | 
            
            
              | 4790 | 
                          }  | 
            
            
              | 4791 | 
                      } elsif ( defined $rules->{'_ALL_'} ) { | 
            
            
              | 4792 | 
                          foreach my $notloan_rule_key ( keys %{ $rules->{'_ALL_'} } ) { | 
            
            
              | 4793 | 
                              if ( $item->notforloan eq $notloan_rule_key ) { | 
            
            
              | 4794 | 
                                  $messages->{'NotForLoanStatusUpdated'} = | 
            
            
              | 4795 | 
                                      { from => $item->notforloan, to => $rules->{'_ALL_'}->{$notloan_rule_key} }; | 
            
            
              | 4796 | 
                                  $item->notforloan( $rules->{'_ALL_'}->{$notloan_rule_key} ) | 
            
            
              | 4797 | 
                                      ->store( { log_action => 0, skip_record_index => 1, skip_holds_queue => 1 } ) | 
            
            
              | 4798 | 
                                      unless $rules->{'_ALL_'}->{$notloan_rule_key} eq 'ONLYMESSAGE'; | 
            
            
              | 4799 | 
                                  last;  | 
            
            
              | 4800 | 
                              }  | 
            
            
              | 4801 | 
                          }  | 
            
            
              | 4802 | 
                      }  | 
            
            
              | 4803 | 
                  }  | 
            
            
              | 4804 | 
              }  | 
            
            
              | 4805 | 
               | 
            
        
          | 4810 | 
          1;  | 
          4806 | 
          1;  | 
        
        
          | 4811 | 
           | 
          4807 | 
           | 
        
        
          | 4812 | 
          __END__  | 
          4808 | 
          __END__  | 
        
            
              | 4813 | 
              -   | 
               | 
               |