View | Details | Raw Unified | Return to bug 11751
Collapse All | Expand All

(-)a/C4/Members.pm (-47 lines)
Lines 62-68 BEGIN { Link Here
62
        &GetPendingIssues
62
        &GetPendingIssues
63
        &GetAllIssues
63
        &GetAllIssues
64
64
65
        &get_institutions
66
        &getzipnamecity
65
        &getzipnamecity
67
        &getidcity
66
        &getidcity
68
67
Lines 122-128 BEGIN { Link Here
122
    push @EXPORT, qw(
121
    push @EXPORT, qw(
123
        &AddMember
122
        &AddMember
124
        &AddMember_Opac
123
        &AddMember_Opac
125
        &add_member_orgs
126
        &MoveMemberToDeleted
124
        &MoveMemberToDeleted
127
        &ExtendMemberSubscriptionTo
125
        &ExtendMemberSubscriptionTo
128
    );
126
    );
Lines 1668-1718 sub GetAge{ Link Here
1668
    return $age;
1666
    return $age;
1669
}    # sub get_age
1667
}    # sub get_age
1670
1668
1671
=head2 get_institutions
1672
1673
  $insitutions = get_institutions();
1674
1675
Just returns a list of all the borrowers of type I, borrownumber and name
1676
1677
=cut
1678
1679
#'
1680
sub get_institutions {
1681
    my $dbh = C4::Context->dbh();
1682
    my $sth =
1683
      $dbh->prepare(
1684
"SELECT borrowernumber,surname FROM borrowers WHERE categorycode=? ORDER BY surname"
1685
      );
1686
    $sth->execute('I');
1687
    my %orgs;
1688
    while ( my $data = $sth->fetchrow_hashref() ) {
1689
        $orgs{ $data->{'borrowernumber'} } = $data;
1690
    }
1691
    return ( \%orgs );
1692
1693
}    # sub get_institutions
1694
1695
=head2 add_member_orgs
1696
1697
  add_member_orgs($borrowernumber,$borrowernumbers);
1698
1699
Takes a borrowernumber and a list of other borrowernumbers and inserts them into the borrowers_to_borrowers table
1700
1701
=cut
1702
1703
#'
1704
sub add_member_orgs {
1705
    my ( $borrowernumber, $otherborrowers ) = @_;
1706
    my $dbh   = C4::Context->dbh();
1707
    my $query =
1708
      "INSERT INTO borrowers_to_borrowers (borrower1,borrower2) VALUES (?,?)";
1709
    my $sth = $dbh->prepare($query);
1710
    foreach my $otherborrowernumber (@$otherborrowers) {
1711
        $sth->execute( $borrowernumber, $otherborrowernumber );
1712
    }
1713
1714
}    # sub add_member_orgs
1715
1716
=head2 GetCities
1669
=head2 GetCities
1717
1670
1718
  $cityarrayref = GetCities();
1671
  $cityarrayref = GetCities();
(-)a/circ/circulation.pl (-22 lines)
Lines 133-139 my $stickyduedate = $query->param('stickyduedate') || $session->param('stickydu Link Here
133
my $duedatespec    = $query->param('duedatespec')   || $session->param('stickyduedate');
133
my $duedatespec    = $query->param('duedatespec')   || $session->param('stickyduedate');
134
my $issueconfirmed = $query->param('issueconfirmed');
134
my $issueconfirmed = $query->param('issueconfirmed');
135
my $cancelreserve  = $query->param('cancelreserve');
135
my $cancelreserve  = $query->param('cancelreserve');
136
my $organisation   = $query->param('organisations');
137
my $print          = $query->param('print') || q{};
136
my $print          = $query->param('print') || q{};
138
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
137
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
139
my $charges        = $query->param('charges') || q{};
138
my $charges        = $query->param('charges') || q{};
Lines 658-682 if ( $borrower->{'category_type'} eq 'C') { Link Here
658
    $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
657
    $template->param( 'catcode' =>    $catcodes->[0])  if $cnt == 1;
659
}
658
}
660
659
661
my $CGIorganisations;
662
my $member_of_institution;
663
if ( C4::Context->preference("memberofinstitution") ) {
664
    my $organisations = get_institutions();
665
    my @orgs;
666
    my %org_labels;
667
    foreach my $organisation ( keys %$organisations ) {
668
        push @orgs, $organisation;
669
        $org_labels{$organisation} = $organisations->{$organisation}->{'surname'};
670
    }
671
    $member_of_institution = 1;
672
    $CGIorganisations      = CGI::popup_menu(
673
        -id     => 'organisations',
674
        -name   => 'organisations',
675
        -labels => \%org_labels,
676
        -values => \@orgs,
677
    );
678
}
679
680
my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch );
660
my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch );
681
if($lib_messages_loop){ $template->param(flagged => 1 ); }
661
if($lib_messages_loop){ $template->param(flagged => 1 ); }
682
662
Lines 747-754 $template->param( Link Here
747
    relprevissues		=> \@relprevissues,
727
    relprevissues		=> \@relprevissues,
748
    displayrelissues		=> $displayrelissues,
728
    displayrelissues		=> $displayrelissues,
749
    inprocess         => $inprocess,
729
    inprocess         => $inprocess,
750
    memberofinstution => $member_of_institution,
751
    CGIorganisations  => $CGIorganisations,
752
    is_child          => ($borrower->{'category_type'} eq 'C'),
730
    is_child          => ($borrower->{'category_type'} eq 'C'),
753
    circview => 1,
731
    circview => 1,
754
    soundon           => C4::Context->preference("SoundOn"),
732
    soundon           => C4::Context->preference("SoundOn"),
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 181-187 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
181
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
181
('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
182
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
182
('maxRecordsForFacets','20',NULL,NULL,'Integer'),
183
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
183
('maxreserves','50','','Define maximum number of holds a patron can place','Integer'),
184
('memberofinstitution','0',NULL,'If ON, patrons can be linked to institutions','YesNo'),
185
('minPasswordLength','3',NULL,'Specify the minimum length of a patron/staff password','free'),
184
('minPasswordLength','3',NULL,'Specify the minimum length of a patron/staff password','free'),
186
('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''),
185
('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''),
187
('noissuescharge','5','','Define maximum amount withstanding before check outs are blocked','Integer'),
186
('noissuescharge','5','','Define maximum amount withstanding before check outs are blocked','Integer'),
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 8005-8010 if ( CheckVersion($DBversion) ) { Link Here
8005
    $dbh->{RaiseError} = 0;
8005
    $dbh->{RaiseError} = 0;
8006
}
8006
}
8007
8007
8008
$DBversion = "3.15.00.XXX";
8009
if (CheckVersion($DBversion)) {
8010
    $dbh->do(q|
8011
        DELETE FROM systempreferences WHERE variable= "memberofinstitution"
8012
    |);
8013
    print "Upgrade to $DBversion done (Bug 11751: Remove memberofinstitytion system preference)\n";
8014
    SetVersion($DBversion);
8015
}
8016
8008
=head1 FUNCTIONS
8017
=head1 FUNCTIONS
8009
8018
8010
=head2 TableExists($table)
8019
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-6 lines)
Lines 80-91 Patrons: Link Here
80
         - '[% local_currency %].'
80
         - '[% local_currency %].'
81
         - Empty value means no limit. Single item caps are specified in the circulation rules matrix.
81
         - Empty value means no limit. Single item caps are specified in the circulation rules matrix.
82
     -
82
     -
83
         - pref: memberofinstitution
84
           choices:
85
               yes: Do
86
               no: "Don't"
87
         - allow patrons to be linked to institutions (which must be set up as Institution patrons).
88
     -
89
         - Login passwords for staff and patrons must be at least
83
         - Login passwords for staff and patrons must be at least
90
         - pref: minPasswordLength
84
         - pref: minPasswordLength
91
           class: integer
85
           class: integer
(-)a/members/memberentry.pl (-30 lines)
Lines 400-410 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
400
            }
400
            }
401
        }
401
        }
402
402
403
		if ($data{'organisations'}){            
404
			# need to add the members organisations
405
			my @orgs=split(/\|/,$data{'organisations'});
406
			add_member_orgs($borrowernumber,\@orgs);
407
		}
408
        if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
403
        if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
409
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
404
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
410
        }
405
        }
Lines 619-646 if($no_categories){ Link Here
619
    $template->param(no_categories => 1);
614
    $template->param(no_categories => 1);
620
}
615
}
621
$template->param(no_add => $no_add);
616
$template->param(no_add => $no_add);
622
my $CGIorganisations;
623
my $member_of_institution;
624
if (C4::Context->preference("memberofinstitution")){
625
    my $organisations=get_institutions();
626
    my @orgs;
627
    my %org_labels;
628
    foreach my $organisation (keys %$organisations) {
629
        push @orgs,$organisation;
630
        $org_labels{$organisation}=$organisations->{$organisation}->{'surname'};
631
    }
632
    $member_of_institution=1;
633
634
    $CGIorganisations = CGI::scrolling_list( -id => 'organisations',
635
        -name     => 'organisations',
636
        -labels   => \%org_labels,
637
        -values   => \@orgs,
638
        -size     => 5,
639
        -multiple => 'true'
640
641
    );
642
}
643
644
# --------------------------------------------------------------------------------------------------------
617
# --------------------------------------------------------------------------------------------------------
645
618
646
my $CGIsort = buildCGIsort("Bsort1","sort1",$data{'sort1'});
619
my $CGIsort = buildCGIsort("Bsort1","sort1",$data{'sort1'});
Lines 728-735 $template->param( Link Here
728
  category_type =>$category_type,
701
  category_type =>$category_type,
729
  modify          => $modify,
702
  modify          => $modify,
730
  nok     => $nok,#flag to konw if an error 
703
  nok     => $nok,#flag to konw if an error 
731
  memberofinstution => $member_of_institution,
732
  CGIorganisations => $CGIorganisations,
733
  NoUpdateLogin =>  $NoUpdateLogin
704
  NoUpdateLogin =>  $NoUpdateLogin
734
  );
705
  );
735
706
736
- 

Return to bug 11751