From 49043f61099660670dfd31db561ea2c7895af6b9 Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Mon, 9 May 2011 11:49:44 +1200 Subject: [PATCH] bug_6190: BorrowerUnwantedField syspref and removing fields from the patron entry --- admin/systempreferences.pl | 1 + installer/data/mysql/en/mandatory/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 ++ .../prog/en/modules/admin/preferences/patrons.pref | 5 + .../prog/en/modules/help/members/memberentry.tt | 1 + .../prog/en/modules/members/memberentrygen.tt | 109 +++++++++++++++++++- members/memberentry.pl | 7 ++ 7 files changed, 128 insertions(+), 3 deletions(-) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 87ecac4..39a81e6 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -223,6 +223,7 @@ $tabsysprefs{intranetreadinghistory} = "Patrons"; $tabsysprefs{NotifyBorrowerDeparture} = "Patrons"; $tabsysprefs{memberofinstitution} = "Patrons"; $tabsysprefs{BorrowerMandatoryField} = "Patrons"; +$tabsysprefs{BorrowerUnwantedField} = "Patrons"; $tabsysprefs{borrowerRelationship} = "Patrons"; $tabsysprefs{BorrowersTitles} = "Patrons"; $tabsysprefs{patronimages} = "Patrons"; diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index f98b053..139ba38 100755 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -20,6 +20,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('autoMemberNum',1,'If ON, patron number is auto-calculated','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BiblioDefaultView','normal','Choose the default detail view in the catalog; choose between normal, marc or isbd','normal|marc|isbd','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerMandatoryField','zipcode|surname|cardnumber','Choose the mandatory fields for a patron\'s account',NULL,'free'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerUnwantedField','','Name the fields you don\'t need to store for a patron\'s account',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('borrowerRelationship','father|mother','Define valid relationships between a guarantor & a guarantee (separated by | or ,)','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowersLog',1,'If ON, log edit/create/delete actions on patron data',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('casAuthentication', '0', 'Enable or disable CAS authentication', '', 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 52951e7..b31c4d0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4332,6 +4332,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.05.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerUnwantedField','','Name the fields you don\'t need to store for a patron\'s account',NULL,'free')"); + print "Upgrade to $DBversion done (BorrowerUnwantedField syspref)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index ac3e1d2..6bfa0df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -32,6 +32,11 @@ Patrons: class: multi - (separate columns with |) - + - "The following database columns will not appear on the patron entry screen:" + - pref: BorrowerUnwantedField + class: multi + - (separate columns with |) + - - "Guarantors can be the following of those they guarantee:" - pref: borrowerRelationship class: multi diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt index b832f4c..9dcaf60 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt @@ -22,6 +22,7 @@
  • Enter the identifying information regarding your patron
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 497b9ac..9877b14 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -169,6 +169,7 @@ [% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity
      [% UNLESS ( I ) %] + [% UNLESS notitle %] [% IF ( title_cgipopup ) %]
    1. [% IF ( mandatorytitle ) %] @@ -182,6 +183,8 @@
    2. [% END %] [% END %] + [% END %] + [% UNLESS nosurname %]
    3. [% IF ( mandatorysurname ) %]
    4. + [% END %] [% UNLESS ( I ) %] + [% UNLESS nofirstname %]
    5. [% IF ( mandatoryfirstname ) %]
    6. + [% END %] + [% UNLESS nodateofbirth %]
    7. [% IF ( mandatorydateofbirth ) %]
    8. + [% END %] + [% UNLESS noinitials %]
    9. [% IF ( mandatoryinitials ) %]
    10. [% END %] + [% END %] + [% UNLESS noothernames %]
    11. [% IF ( mandatoryothernames ) %]
    12. + [% END %] [% UNLESS ( I ) %] + [% UNLESS nosex %]
    13. [% IF ( female ) %] @@ -276,6 +289,7 @@ [% END %]
    14. + [% END %] [% END %]
    @@ -310,6 +324,7 @@ [% END %] Patron #: [% IF ( guarantorid ) %] [% guarantorid %][% END %] + [% UNLESS nocontactname %]
  • [% IF ( guarantorid ) %] @@ -319,6 +334,8 @@ [% END %]
  • + [% END %] + [% UNLESS nocontactfirstname %]
  • [% IF ( guarantorid ) %] @@ -328,6 +345,7 @@ [% END %]
  • + [% END %] [% IF ( relshiploop ) %]
  • @@ -359,6 +377,7 @@ [% END %]
    Main address
      + [% UNLESS nostreetnumber %]
    1. [% IF ( mandatorystreetnumber ) %]
    2. + [% END %] + [% UNLESS nostreettype %] [% IF ( road_cgipopup ) %]
    3. [% IF ( mandatorystreettype ) %] @@ -381,6 +402,8 @@ [% IF ( mandatorystreettype ) %]Required[% END %]
    4. [% END %] + [% END %] + [% UNLESS noaddress %]
    5. [% IF ( mandatoryaddress ) %]
    6. + [% END %] + [% UNLESS noaddress2 %]
    7. [% IF ( mandatoryaddress2 ) %]
    8. + [% END %] + [% UNLESS nocity %]
    9. [% IF ( mandatorycity ) %]
    10. + [% END %] + [% UNLESS nostate %]
    11. [% IF ( mandatorystate ) %]
    12. + [% END %] + [% UNLESS nozipcode %]
    13. [% IF ( mandatoryzipcode ) %]
    14. - + [% END %] + [% UNLESS nocountry %]
    15. [% IF ( mandatorycountry ) %]
    16. - + [% END %]
    Contact
      + [% UNLESS nophone %]
    1. [% IF ( mandatoryphone ) %]
    2. + [% END %] + [% UNLESS nophonepro %]
    3. [% IF ( mandatoryphonepro ) %]
    4. + [% END %] + [% UNLESS nomobile %]
    5. [% IF ( mandatorymobile ) %]
    6. + [% END %] + [% UNLESS noemail %]
    7. [% IF ( mandatoryemail ) %]
    8. + [% END %] + [% UNLESS noemailpro %]
    9. [% IF ( mandatoryemailpro ) %]
    10. + [% END %] + [% UNLESS nofax %]
    11. [% IF ( mandatoryfax ) %]
    12. + [% END %]
    @@ -531,8 +575,10 @@ [% END %] [% IF ( step_6 ) %] + [% UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
    Alternate address
      + [% UNLESS noB_address %]
    1. [% IF ( mandatoryB_address ) %]
    2. + [% END %] + [% UNLESS noB_address2 %]
    3. [% IF ( mandatoryB_address2 ) %]
    4. + [% END %] + [% UNLESS noB_city %]
    5. [% IF ( mandatoryB_city ) %]
    6. + [% END %] + [% UNLESS noB_state %]
    7. [% IF ( mandatoryB_state ) %]
    8. + [% END %] + [% UNLESS noB_zipcode %]
    9. [% IF ( mandatoryB_zipcode ) %]
    10. + [% END %] + [% UNLESS noB_country %]
    11. [% IF ( mandatoryB_country ) %]
    12. + [% END %] + [% UNLESS noB_phone %]
    13. [% IF ( mandatoryB_phone ) %]
    14. + [% END %] + [% UNLESS noB_email %]
    15. [% IF ( mandatoryB_email ) %] [% IF ( mandatoryB_email ) %]Required[% END %]
    16. + [% END %] + [% UNLESS nocontactnote %]
    17. [% IF ( mandatorycontactnote ) %]
    18. + [% END %]
    + [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %] [% END %] [% IF ( step_2 ) %] + [% UNLESS noaltcontactsurname && noaltcontactfirstname %]
    Alternate Contact
      + [% UNLESS noaltcontactsurname %]
    1. [% IF ( mandatoryaltcontactsurname ) %]
    2. + [% END %] + [% UNLESS noaltcontactfirstname %]
    3. [% IF ( mandatoryaltcontactfirstname ) %]
    4. + [% END %] + [% UNLESS noaltcontactaddress1 %]
    5. [% IF ( mandatoryaltcontactaddress1 ) %]
    6. + [% END %] + [% UNLESS noaltcontactaddress2 %]
    7. [% IF ( mandatoryaltcontactaddress2 ) %]
    8. + [% END %] + [% UNLESS noaltcontactaddress3 %]
    9. [% IF ( mandatoryaltcontactaddress3 ) %]
    10. + [% END %] + [% UNLESS noaltcontactstate %]
    11. [% IF ( mandatoryaltcontactstate ) %]
    12. + [% END %] + [% UNLESS noaltcontactzipcode %]
    13. [% IF ( mandatoryaltcontactzipcode ) %]
    14. + [% END %] + [% UNLESS noaltcontactcountry %]
    15. [% IF ( mandatoryaltcontactcountry ) %]
    16. + [% END %] + [% UNLESS noaltcontactphone %]
    17. [% IF ( mandatoryaltcontactphone ) %]
    18. + [% END %]
    + [% END # UNLESS noaltcontactsurname && noaltcontactfirstname %] [% IF ( I ) %] @@ -746,6 +830,7 @@
    Library Management
      + [% UNLESS nocardnumber %]
    1. [% IF ( mandatorycardnumber ) %] [% IF ( mandatorycardnumber ) %]Required[% END %]
    2. + [% END %] + [% UNLESS nobranchcode %]
    3. [% IF ( mandatorybranchcode ) %]
    4. + [% END %]
    5. + [% UNLESS nosort1 %]
    6. [% IF ( mandatorysort1 ) %]
    7. + [% END %] + [% UNLESS nosort2 %]
    8. [% IF ( mandatorysort2 ) %]
    9. + [% END %]
    Library set-up
      + [% UNLESS nodateenrolled %]
    1. [% IF ( mandatorydateenrolled ) %]
    2. + [% END %] + [% UNLESS nodateexpiry %]
    3. [% IF ( mandatorydateexpiry ) %]
    4. + [% END %] + [% UNLESS noopacnote %]
    5. [% IF ( mandatoryopacnote ) %]
    6. + [% END %] + [% UNLESS noborrowernotes %]
    7. [% IF ( mandatoryborrowernotes ) %]
    8. + [% END %]
    OPAC login
      + [% UNLESS nouserid %]
    1. [% IF ( mandatoryuserid ) %]
    +
  • + [% END %] + [% UNLESS ( opadd ) %] diff --git a/members/memberentry.pl b/members/memberentry.pl index a8e764c..9fa7e0e 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -100,6 +100,13 @@ my @field_check=split(/\|/,$check_BorrowerMandatoryField); foreach (@field_check) { $template->param( "mandatory$_" => 1); } +# function to designate unwanted fields +my $check_BorrowerUnwantedField=C4::Context->preference("BorrowerUnwantedField"); +@field_check=split(/\|/,$check_BorrowerUnwantedField); +foreach (@field_check) { + next unless m/\w/o; + $template->param( "no$_" => 1); +} $template->param( "add" => 1 ) if ( $op eq 'add' ); $template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' ); $template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 ); -- 1.6.5