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 124-130 BEGIN { Link Here
124
    push @EXPORT, qw(
123
    push @EXPORT, qw(
125
        &AddMember
124
        &AddMember
126
        &AddMember_Opac
125
        &AddMember_Opac
127
        &add_member_orgs
128
        &MoveMemberToDeleted
126
        &MoveMemberToDeleted
129
        &ExtendMemberSubscriptionTo
127
        &ExtendMemberSubscriptionTo
130
    );
128
    );
Lines 1670-1720 sub GetAge{ Link Here
1670
    return $age;
1668
    return $age;
1671
}    # sub get_age
1669
}    # sub get_age
1672
1670
1673
=head2 get_institutions
1674
1675
  $insitutions = get_institutions();
1676
1677
Just returns a list of all the borrowers of type I, borrownumber and name
1678
1679
=cut
1680
1681
#'
1682
sub get_institutions {
1683
    my $dbh = C4::Context->dbh();
1684
    my $sth =
1685
      $dbh->prepare(
1686
"SELECT borrowernumber,surname FROM borrowers WHERE categorycode=? ORDER BY surname"
1687
      );
1688
    $sth->execute('I');
1689
    my %orgs;
1690
    while ( my $data = $sth->fetchrow_hashref() ) {
1691
        $orgs{ $data->{'borrowernumber'} } = $data;
1692
    }
1693
    return ( \%orgs );
1694
1695
}    # sub get_institutions
1696
1697
=head2 add_member_orgs
1698
1699
  add_member_orgs($borrowernumber,$borrowernumbers);
1700
1701
Takes a borrowernumber and a list of other borrowernumbers and inserts them into the borrowers_to_borrowers table
1702
1703
=cut
1704
1705
#'
1706
sub add_member_orgs {
1707
    my ( $borrowernumber, $otherborrowers ) = @_;
1708
    my $dbh   = C4::Context->dbh();
1709
    my $query =
1710
      "INSERT INTO borrowers_to_borrowers (borrower1,borrower2) VALUES (?,?)";
1711
    my $sth = $dbh->prepare($query);
1712
    foreach my $otherborrowernumber (@$otherborrowers) {
1713
        $sth->execute( $borrowernumber, $otherborrowernumber );
1714
    }
1715
1716
}    # sub add_member_orgs
1717
1718
=head2 GetCities
1671
=head2 GetCities
1719
1672
1720
  $cityarrayref = GetCities();
1673
  $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 7953-7958 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
7953
    SetVersion($DBversion);
7953
    SetVersion($DBversion);
7954
}
7954
}
7955
7955
7956
$DBversion = "3.15.00.XXX";
7957
if (CheckVersion($DBversion)) {
7958
    $dbh->do(q|
7959
        DELETE FROM systempreferences WHERE variable="memberofinstitution"
7960
    |);
7961
    print "Upgrade to $DBversion done (Bug XXXXX: Remove memberofinstitytion system preference)\n";
7962
    SetVersion($DBversion);
7963
}
7964
7956
=head1 FUNCTIONS
7965
=head1 FUNCTIONS
7957
7966
7958
=head2 TableExists($table)
7967
=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 401-411 if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ Link Here
401
            }
401
            }
402
        }
402
        }
403
403
404
		if ($data{'organisations'}){            
405
			# need to add the members organisations
406
			my @orgs=split(/\|/,$data{'organisations'});
407
			add_member_orgs($borrowernumber,\@orgs);
408
		}
409
        if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
404
        if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
410
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
405
            C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
411
        }
406
        }
Lines 629-656 if($no_categories){ Link Here
629
    $template->param(no_categories => 1);
624
    $template->param(no_categories => 1);
630
}
625
}
631
$template->param(no_add => $no_add);
626
$template->param(no_add => $no_add);
632
my $CGIorganisations;
633
my $member_of_institution;
634
if (C4::Context->preference("memberofinstitution")){
635
    my $organisations=get_institutions();
636
    my @orgs;
637
    my %org_labels;
638
    foreach my $organisation (keys %$organisations) {
639
        push @orgs,$organisation;
640
        $org_labels{$organisation}=$organisations->{$organisation}->{'surname'};
641
    }
642
    $member_of_institution=1;
643
644
    $CGIorganisations = CGI::scrolling_list( -id => 'organisations',
645
        -name     => 'organisations',
646
        -labels   => \%org_labels,
647
        -values   => \@orgs,
648
        -size     => 5,
649
        -multiple => 'true'
650
651
    );
652
}
653
654
# --------------------------------------------------------------------------------------------------------
627
# --------------------------------------------------------------------------------------------------------
655
628
656
my $CGIsort = buildCGIsort("Bsort1","sort1",$data{'sort1'});
629
my $CGIsort = buildCGIsort("Bsort1","sort1",$data{'sort1'});
Lines 739-746 $template->param( Link Here
739
  category_type =>$category_type,
712
  category_type =>$category_type,
740
  modify          => $modify,
713
  modify          => $modify,
741
  nok     => $nok,#flag to konw if an error 
714
  nok     => $nok,#flag to konw if an error 
742
  memberofinstution => $member_of_institution,
743
  CGIorganisations => $CGIorganisations,
744
  NoUpdateLogin =>  $NoUpdateLogin
715
  NoUpdateLogin =>  $NoUpdateLogin
745
  );
716
  );
746
717
747
- 

Return to bug 11751