From cb70712d2b8ea7b1519a074799a70129a4056176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Delaune?= <stephane.delaune@biblibre.com> Date: Tue, 21 Sep 2010 12:58:26 +0200 Subject: [PATCH] Bug 5432 : (MT #4584b)Add duplicate support for borrowers --- .../prog/en/includes/members-toolbar.inc | 4 +- .../prog/en/modules/members/memberentrygen.tmpl | 117 ++++++++++---------- members/memberentry.pl | 39 ++++--- 3 files changed, 84 insertions(+), 76 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 6f22d46..98c6d07 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -82,6 +82,7 @@ function update_child() { new YAHOO.widget.Button("editpatron"); new YAHOO.widget.Button("addnote"); new YAHOO.widget.Button("changepassword"); + new YAHOO.widget.Button("duplicate"); new YAHOO.widget.Button("printslip"); new YAHOO.widget.Button("printpage"); new YAHOO.widget.Button("renewpatron"); @@ -110,7 +111,8 @@ function update_child() { <!-- TMPL_IF name="adultborrower" --><li><a id="addchild" href="/cgi-bin/koha/members/memberentry.pl?op=add&guarantorid=<!-- TMPL_VAR NAME="borrowernumber" -->&category_type=C">Add child</a></li><!-- /TMPL_IF --> <!-- <li><a id="addnote" href="/cgi-bin/koha/members/addnotes.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Add Note</a></li> --> <li><a id="changepassword" href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Change Password</a></li> - <li id="printmenuc"><a id="printpage" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&print=page">Print Page</a></li> + <li><a id="duplicate" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&category_type=<!-- TMPL_VAR NAME="category_type"-->">Duplicate</a></li> + <li id="printmenuc"><a id="printpage" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&print=page">Print Page</a></li> <li><a id="printslip" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&print=slip">Print Slip</a></li> <li id="moremenuc"><a id="renewpatron" href="/cgi-bin/koha/members/moremember.pl?reregistration=y&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">Renew Account</a></li><!-- TMPL_IF NAME="CAN_user_permissions" --><li><a id="patronflags" href="/cgi-bin/koha/members/member-flags.pl?member=<!-- TMPL_VAR NAME="borrowernumber" -->">Set Permissions</a></li><!-- /TMPL_IF --><li><a id="deletepatron" href="javascript:confirm_deletion();">Delete</a></li> </ul></div> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl index a746307..67ac528 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl @@ -1,6 +1,6 @@ <!-- TMPL_INCLUDE NAME="doc-head-open.inc" --> <title>Koha › Patrons › -<!-- TMPL_IF NAME="opadd" -->Add<!-- TMPL_ELSE --> Modify<!--/TMPL_IF--> <!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --><!--TMPL_UNLESS Name="opadd"--> <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR name="firstname" --><!--/TMPL_UNLESS--></title> +<!-- TMPL_IF NAME="opadd" -->Add<!-- TMPL_ELSIF NAME="opduplicate" -->Duplicate<!-- TMPL_ELSE --> Modify<!--/TMPL_IF--> <!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --><!--TMPL_UNLESS Name="opadd"--> <!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR name="firstname" --><!--/TMPL_UNLESS--></title> <!-- TMPL_INCLUDE NAME="doc-head-close.inc" --> <!-- TMPL_INCLUDE NAME="calendar.inc" --> <script type="text/JavaScript" language="JavaScript"> @@ -71,9 +71,9 @@ Add<!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --> <!-- TMPL_VAR NAME="surname" --> <!-- TMPL_VAR name="firstname" --> <!-- TMPL_ELSE --> -<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR NAME="surname" --></a> › <strong>Modify<!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --> +<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR NAME="surname" --></a> › <strong><!-- TMPL_IF NAME="opduplicate" -->Duplicate<!-- TMPL_ELSE -->Modify<!--/TMPL_IF --><!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --> </strong><!-- /TMPL_IF --></div> - +<!-- TMPL_IF NAME="opduplicate" -->tast<!-- /TMPL_IF --> <!-- TMPL_IF NAME="opadd" --><div id="doc" class="yui-t7"><!-- TMPL_ELSE --><div id="doc3" class="yui-t2"><!-- /TMPL_IF --> <div id="bd"> @@ -91,7 +91,7 @@ </h1> <!-- TMPL_ELSE --> <h1> - Modify<!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --> + <!-- TMPL_IF NAME="opduplicate" -->Duplicate<!-- TMPL_ELSE -->Modify<!--/TMPL_IF --><!--TMPL_IF Name="categoryname"--> <!--TMPL_VAR Name="categoryname"--> patron<!-- TMPL_ELSE --><!--TMPL_IF Name="I"--> Organization patron<!--/TMPL_IF --><!--TMPL_IF Name="A"--> Adult patron<!--/TMPL_IF --><!--TMPL_IF Name="C"--> Child patron<!--/TMPL_IF --><!--TMPL_IF Name="P"--> Professional patron<!--/TMPL_IF --><!--TMPL_IF Name="S"--> Staff patron<!--/TMPL_IF --><!--/TMPL_IF --> <!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR NAME="surname" --> </h1> <!-- /TMPL_IF --> @@ -149,8 +149,8 @@ </ul> </div> <!-- /TMPL_IF --> - - + + <!-- TMPL_UNLESS NAME="check_member" --><form name="form" id="entryform" action="/cgi-bin/koha/members/memberentry.pl" method="post"> <input type="hidden" name="nodouble" value="<!-- TMPL_VAR NAME="nodouble" -->" /> <!-- /TMPL_UNLESS --> <!-- field always hidden in different form (1,2,3) --> @@ -160,9 +160,10 @@ <input type="hidden" name="select_roadtype" value="<!-- TMPL_VAR NAME="select_roadtype" -->" /> <input type="hidden" name="destination" value="<!-- TMPL_VAR NAME="destination" -->" /> <input type="hidden" name="check_member" value="<!-- TMPL_VAR NAME="check_member" -->" /> -<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" /> +<input type="hidden" name="borrowernumber" value="<!-- TMPL_IF NAME="opduplicate" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="borrowernumber" --><!-- /TMPL_IF -->" /> +<input type="hidden" name="nodouble" value="<!-- TMPL_IF NAME="opduplicate" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="nodouble" --><!-- /TMPL_IF -->" /> <!--TMPL_IF Name="step"--><input type="hidden" name="step" value="<!-- TMPL_VAR NAME="step" -->" /><!--/TMPL_IF--> -<!-- TMPL_IF NAME="opadd" --><input type="hidden" name="op" value="insert" /><!-- TMPL_ELSE --><input type="hidden" name="op" value="save" /><!-- /TMPL_IF --> +<!-- TMPL_IF NAME="opadd" --><input type="hidden" name="op" value="insert" /><!-- TMPL_ELSIF NAME="opduplicate" --><input type="hidden" name="op" value="insert" /><!-- TMPL_ELSE --><input type="hidden" name="op" value="save" /><!-- /TMPL_IF --> <!--TMPL_IF Name="step_1"--> <fieldset class="rows" id="memberentry_identity"> @@ -190,9 +191,9 @@ <!-- /TMPL_IF--> Surname: </label> <!-- TMPL_IF NAME="uppercasesurnames" --> - <input style="text-transform:uppercase;" type="text" id="surname" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->" /> + <input style="text-transform:uppercase;" type="text" id="surname" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_ELSE --> - <input type="text" id="surname" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->" /> + <input type="text" id="surname" name="surname" size="20" value="<!-- TMPL_VAR NAME="surname" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- /TMPL_IF --> <!-- TMPL_IF NAME="mandatorysurname" --><span class="required">Required</span><!-- /TMPL_IF --> </li> @@ -204,7 +205,7 @@ <label for="firstname"> <!-- /TMPL_IF--> First name: </label> - <input type="text" id="firstname" name="firstname" size="20" value="<!-- TMPL_VAR NAME="firstname" -->" /> + <input type="text" id="firstname" name="firstname" size="20" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="firstname" --><!-- /TMPL_IF -->" /> <!-- TMPL_IF NAME="mandatoryfirstname" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -216,9 +217,9 @@ Date of birth: </label> <!-- TMPL_IF NAME="metric" --> - <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CheckDate(document.form.dateofbirth);" value="<!-- TMPL_VAR NAME="dateofbirth" -->" /> + <input type="text" id="dateofbirth" name="dateofbirth" size="20" onchange="CheckDate(document.form.dateofbirth);" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="dateofbirth" --><!-- /TMPL_IF -->" /> <!-- TMPL_ELSE --> - <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="<!-- TMPL_VAR NAME="dateofbirth" -->" /> + <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="dateofbirth" --><!-- /TMPL_IF -->" /> <!-- /TMPL_IF --> <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="dateofbirth_button" alt="Show Calendar" /> @@ -242,7 +243,7 @@ <label for="initials"> <!-- /TMPL_IF--> Initials: </label> - <input type="text" id="initials" name="initials" size="20" value="<!-- TMPL_VAR NAME="initials" -->" /> + <input type="text" id="initials" name="initials" size="20" value="<!-- TMPL_VAR NAME="initials" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryinitials" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <!-- /TMPL_UNLESS --> @@ -253,7 +254,7 @@ <label for="othernames"> <!-- /TMPL_IF--> Other name: </label> - <input type="text" id="othernames" name="othernames" size="20" value="<!-- TMPL_VAR NAME="othernames" -->" /> + <input type="text" id="othernames" name="othernames" size="20" value="<!-- TMPL_VAR NAME="othernames" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryothernames" --><span class="required">Required</span><!-- /TMPL_IF --> <!-- TMPL_IF NAME="I" --><input type="hidden" name="sex" value="N" /><!-- /TMPL_IF --> </li> @@ -298,7 +299,7 @@ <span><!-- TMPL_VAR NAME="contactname" --></span> <input name="contactname" id="contactname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" /> <!-- TMPL_ELSE --> - <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" /> + <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- /TMPL_IF --> </li> <!-- TMPL_ELSE --> @@ -316,7 +317,7 @@ <span><!-- TMPL_VAR NAME="contactname" --></span> <input name="contactname" id="contactname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" /> <!-- TMPL_ELSE --> - <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->" /> + <input name="contactname" id="contactname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactname" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- /TMPL_IF --> </li> <li> @@ -325,7 +326,7 @@ <span><!-- TMPL_VAR NAME="contactfirstname" --></span> <input name="contactfirstname" id="contactfirstname" type="hidden" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" /> <!-- TMPL_ELSE --> - <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->" /> + <input name="contactfirstname" id="contactfirstname" type="text" size="20" value="<!-- TMPL_VAR NAME="contactfirstname" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- /TMPL_IF --> </li> <!-- TMPL_IF name="relshiploop" --> @@ -366,7 +367,7 @@ <label for="streetnumber"> <!-- /TMPL_IF--> Street number: </label> - <input type="text" id="streetnumber" name="streetnumber" size="5" value="<!-- TMPL_VAR NAME="streetnumber" -->" /> + <input type="text" id="streetnumber" name="streetnumber" size="5" value="<!-- TMPL_VAR NAME="streetnumber" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatorystreetnumber" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <!-- TMPL_IF NAME="road_cgipopup" --> @@ -388,7 +389,7 @@ <label for="address"> <!--/TMPL_IF--> Address: </label> - <input type="text" id="address" name="address" size="35" value="<!-- TMPL_VAR NAME="address" -->" /> + <input type="text" id="address" name="address" size="35" value="<!-- TMPL_VAR NAME="address" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryaddress" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -398,7 +399,7 @@ <label for="address2"> <!-- /TMPL_IF--> Address 2: </label> - <input type="text" id="address2" name="address2" size="35" value="<!-- TMPL_VAR NAME="address2" -->" /> + <input type="text" id="address2" name="address2" size="35" value="<!-- TMPL_VAR NAME="address2" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryaddress2" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -409,7 +410,7 @@ <!-- /TMPL_IF--> City, State: </label> - <input type="text" id="city" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->" /> + <input type="text" id="city" name="city" size="20" value="<!-- TMPL_VAR NAME="city" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="city_cgipopup" -->or <strong>choose</strong> <select id="select_city" name="select_city"> <!-- TMPL_LOOP NAME="city_loop" --> @@ -432,7 +433,7 @@ <label for="zipcode"> <!-- /TMPL_IF--> Zip/Postal code: </label> - <input type="text" name="zipcode" id="zipcode" size="10" value="<!-- TMPL_VAR NAME="zipcode" -->" /> + <input type="text" name="zipcode" id="zipcode" size="10" value="<!-- TMPL_VAR NAME="zipcode" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryzipcode" --><span class="required">Required</span><!-- /TMPL_IF --> </li> @@ -443,7 +444,7 @@ <label for="country"> <!-- /TMPL_IF--> Country: </label> - <input type="text" name="country" id="country" size="20" value="<!-- TMPL_VAR NAME="country" -->" /> + <input type="text" name="country" id="country" size="20" value="<!-- TMPL_VAR NAME="country" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatorycountry" --><span class="required">Required</span><!-- /TMPL_IF --> </li> @@ -458,7 +459,7 @@ <label for="phone"> <!-- /TMPL_IF--> Phone (home): </label> - <input type="text" id="phone" name="phone" value="<!-- TMPL_VAR NAME="phone" -->" /> + <input type="text" id="phone" name="phone" value="<!-- TMPL_VAR NAME="phone" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryphone" --><span class="required">Required</span><!-- /TMPL_IF --><div class="hint">Shows on transit slips</div> </li> @@ -469,7 +470,7 @@ <label for="phonepro"> <!-- /TMPL_IF--> Phone (work): </label> - <input type="text" id="phonepro" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->" /> + <input type="text" id="phonepro" name="phonepro" value="<!-- TMPL_VAR NAME="phonepro" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryphonepro" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -479,7 +480,7 @@ <label for="mobile"> <!-- /TMPL_IF--> Phone (cell): </label> - <input type="text" id="mobile" name="mobile" value="<!-- TMPL_VAR NAME="mobile" -->" /> + <input type="text" id="mobile" name="mobile" value="<!-- TMPL_VAR NAME="mobile" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatorymobile" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -488,8 +489,8 @@ <!--TMPL_ELSE--> <label for="email"> <!-- /TMPL_IF--> - Email (home): </label> - <input type="text" id="email" name="email" size="45" value="<!-- TMPL_VAR NAME="email" -->" /> + Primary Email: </label> + <input type="text" id="email" name="email" size="45" value="<!-- TMPL_VAR NAME="email" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryemail" --><span class="required">Required</span><!-- /TMPL_IF --><div class="hint">Shows on transit slips</div> </li> @@ -499,8 +500,8 @@ <!--TMPL_ELSE--> <label for="emailpro"> <!-- /TMPL_IF--> - Email (work): </label> - <input type="text" id="emailpro" name="emailpro" size="45" value="<!-- TMPL_VAR NAME="emailpro" -->" /> + Secondary Email: </label> + <input type="text" id="emailpro" name="emailpro" size="45" value="<!-- TMPL_VAR NAME="emailpro" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryemailpro" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -510,7 +511,7 @@ <label for="fax"> <!-- /TMPL_IF--> Fax: </label> - <input type="text" id="fax" name="fax" value="<!-- TMPL_VAR NAME="fax" -->" /> + <input type="text" id="fax" name="fax" value="<!-- TMPL_VAR NAME="fax" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryfax" --><span class="required">Required</span><!-- /TMPL_IF --> </li> </ol> @@ -530,7 +531,7 @@ <label for="B_address"> <!-- /TMPL_IF--> Address: </label> - <input type="text" id="B_address" name="B_address" size="40" value="<!-- TMPL_VAR NAME="B_address" -->" /> + <input type="text" id="B_address" name="B_address" size="40" value="<!-- TMPL_VAR NAME="B_address" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryB_address" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -540,9 +541,9 @@ <label for="B_address2"> <!-- /TMPL_IF--> Address 2: </label> - <input type="text" id="B_address2" name="B_address2" size="40" value="<!-- TMPL_VAR NAME="B_address2" -->" /> + <input type="text" id="B_address2" name="B_address2" size="40" value="<!-- TMPL_VAR NAME="B_address2" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryB_address2" --><span class="required">Required</span><!-- /TMPL_IF --> - </li> + </li> <li> <!-- TMPL_IF NAME="mandatoryB_city" --> <label for="B_city" class="required" > @@ -550,7 +551,7 @@ <label for="B_city"> <!-- /TMPL_IF--> City, State: </label> - <input type="text" id="B_city" name="B_city" size="20" value="<!-- TMPL_VAR NAME="B_city" -->" /> + <input type="text" id="B_city" name="B_city" size="20" value="<!-- TMPL_VAR NAME="B_city" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryB_city" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -560,7 +561,7 @@ <label for="B_zipcode"> <!-- /TMPL_IF--> Zip/Postal code: </label> - <input type="text" id="B_zipcode" name="B_zipcode" maxlength="10" size="10" value="<!-- TMPL_VAR NAME="B_zipcode" -->" /> + <input type="text" id="B_zipcode" name="B_zipcode" maxlength="10" size="10" value="<!-- TMPL_VAR NAME="B_zipcode" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryB_zipcode" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -570,7 +571,7 @@ <label for="B_country"> <!-- /TMPL_IF--> Country: </label> - <input type="text" id="B_country" name="B_country" size="20" value="<!-- TMPL_VAR NAME="B_country" -->" /> + <input type="text" id="B_country" name="B_country" size="20" value="<!-- TMPL_VAR NAME="B_country" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryB_country" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -580,7 +581,7 @@ <label for="B_phone"> <!-- /TMPL_IF--> Phone: </label> - <input type="text" id="B_phone" name="B_phone" value="<!-- TMPL_VAR NAME="B_phone" -->" /> + <input type="text" id="B_phone" name="B_phone" value="<!-- TMPL_VAR NAME="B_phone" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryB_phone" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -590,7 +591,7 @@ <label for="B_email"> <!-- /TMPL_IF--> Email: </label> - <input type="text" id="B_email" name="B_email" size="45" value="<!-- TMPL_VAR NAME="B_email" -->" /> + <input type="text" id="B_email" name="B_email" size="45" value="<!-- TMPL_VAR NAME="B_email" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryB_email" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> <!-- TMPL_IF NAME="mandatorycontactnote" --> @@ -615,7 +616,7 @@ <label for="altcontactsurname"> <!-- /TMPL_IF --> Surname:</label> - <input type="text" name="altcontactsurname" id="altcontactsurname" value="<!-- TMPL_VAR NAME="altcontactsurname" -->" /> + <input type="text" name="altcontactsurname" id="altcontactsurname" value="<!-- TMPL_VAR NAME="altcontactsurname" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryaltcontactsurname" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -625,7 +626,7 @@ <label for="altcontactfirstname"> <!-- /TMPL_IF --> First name:</label> - <input type="text" name="altcontactfirstname" id="altcontactfirstname" value="<!-- TMPL_VAR NAME="altcontactfirstname" -->" /> + <input type="text" name="altcontactfirstname" id="altcontactfirstname" value="<!-- TMPL_VAR NAME="altcontactfirstname" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryaltcontactfirstname" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -635,7 +636,7 @@ <label for="altcontactaddress1"> <!-- /TMPL_IF --> Address:</label> - <input type="text" name="altcontactaddress1" id="altcontactaddress1" value="<!-- TMPL_VAR NAME="altcontactaddress1" -->" size="40" /> + <input type="text" name="altcontactaddress1" id="altcontactaddress1" value="<!-- TMPL_VAR NAME="altcontactaddress1" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> size="40" /> <!-- TMPL_IF NAME="mandatoryaltcontactaddress1" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -645,7 +646,7 @@ <label for="altcontactaddress2"> <!-- /TMPL_IF --> Address 2:</label> - <input type="text" name="altcontactaddress2" id="altcontactaddress2" value="<!-- TMPL_VAR NAME="altcontactaddress2" -->" size="40" /> + <input type="text" name="altcontactaddress2" id="altcontactaddress2" value="<!-- TMPL_VAR NAME="altcontactaddress2" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> size="40" /> <!-- TMPL_IF NAME="mandatoryaltcontactaddress2" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -655,7 +656,7 @@ <label for="altcontactaddress3"> <!-- /TMPL_IF --> City, State:</label> - <input type="text" name="altcontactaddress3" id="altcontactaddress3" value="<!-- TMPL_VAR NAME="altcontactaddress3" -->" size="40" /> + <input type="text" name="altcontactaddress3" id="altcontactaddress3" value="<!-- TMPL_VAR NAME="altcontactaddress3" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> size="40" /> <!-- TMPL_IF NAME="mandatoryaltcontactaddress3" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -665,7 +666,7 @@ <label for="altcontactzipcode"> <!-- /TMPL_IF --> Zip/Postal code:</label> - <input type="text" name="altcontactzipcode" id="altcontactzipcode" value="<!-- TMPL_VAR NAME="altcontactzipcode" -->" size="5" /> + <input type="text" name="altcontactzipcode" id="altcontactzipcode" value="<!-- TMPL_VAR NAME="altcontactzipcode" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> size="5" /> <!-- TMPL_IF NAME="mandatoryaltcontactzipcode" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -675,7 +676,7 @@ <label for="altcontactcountry"> <!-- /TMPL_IF --> Country:</label> - <input type="text" name="altcontactcountry" id="altcontactcountry" value="<!-- TMPL_VAR NAME="altcontactcountry" -->" size="20" /> + <input type="text" name="altcontactcountry" id="altcontactcountry" value="<!-- TMPL_VAR NAME="altcontactcountry" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> size="20" /> <!-- TMPL_IF NAME="mandatoryaltcontactcountry" --><span class="required">Required</span><!-- /TMPL_IF --> </li> <li> @@ -685,7 +686,7 @@ <label for="altcontactphone"> <!-- /TMPL_IF --> Phone:</label> - <input type="text" name="altcontactphone" id="altcontactphone" value="<!-- TMPL_VAR NAME="altcontactphone" -->" /> + <input type="text" name="altcontactphone" id="altcontactphone" value="<!-- TMPL_VAR NAME="altcontactphone" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatoryaltcontactphone" --><span class="required">Required</span><!-- /TMPL_IF --> </li> </ol> @@ -722,7 +723,7 @@ <label for="cardnumber"> <!-- /TMPL_IF--> Card number: </label> - <input type="text" id="cardnumber" name="cardnumber" size="20" value="<!-- TMPL_VAR NAME="cardnumber" -->" /> + <input type="text" id="cardnumber" name="cardnumber" size="20" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="cardnumber" --><!-- /TMPL_IF -->" /> <!-- TMPL_IF NAME="mandatorycardnumber" --><span class="required">Required</span><!-- /TMPL_IF --></li> <li> <!-- TMPL_IF NAME="mandatorybranchcode" --> @@ -783,7 +784,7 @@ <!--TMPL_IF NAME="CGIsort2" --> <!-- TMPL_VAR NAME="CGIsort2" --> <!--TMPL_ELSE--> - <input type="text" id="sort2" name="sort2" size="20" value="<!-- TMPL_VAR NAME="sort2" -->" /> + <input type="text" id="sort2" name="sort2" size="20" value="<!-- TMPL_VAR NAME="sort2" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- TMPL_IF NAME="mandatorysort2" --><span class="required">Required</span><!-- /TMPL_IF --> <!-- /TMPL_IF --> </li> @@ -870,9 +871,9 @@ OPAC Login: </label> <!-- TMPL_IF NAME="NoUpdateLogin" --> -<input type="text" id="userid" name="userid" size="20" disabled="disabled" value="<!-- TMPL_VAR NAME="userid" -->" /> +<input type="text" id="userid" name="userid" size="20" disabled="disabled" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="userid" --><!-- /TMPL_IF -->" /> <!-- TMPL_ELSE --> -<input type="text" id="userid" name="userid" size="20" value="<!-- TMPL_VAR NAME="userid" -->" /> +<input type="text" id="userid" name="userid" size="20" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="userid" --><!-- /TMPL_IF -->" /> <!-- /TMPL_IF --> <!-- TMPL_IF NAME="mandatoryuserid" --><span class="required">Required</span><!-- /TMPL_IF --> @@ -886,16 +887,16 @@ Password: </label> <!--TMPL_IF NAME="opadd"--> <!-- TMPL_IF NAME="NoUpdateLogin" --> - <input type="text" id="password" name="password" size="20" disabled="disabled" value="<!-- TMPL_VAR NAME="password" -->" /> + <input type="text" id="password" name="password" size="20" disabled="disabled" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="password" --><!-- /TMPL_IF -->" /> <!-- TMPL_ELSE --> - <input type="text" id="password" name="password" size="20" value="<!-- TMPL_VAR NAME="password" -->" /> + <input type="text" id="password" name="password" size="20" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE--><!-- TMPL_VAR NAME="password" --><!-- /TMPL_IF -->" /> <!-- /TMPL_IF --> <!--TMPL_ELSE--> <!--TMPL_IF NAME="password"--> <!-- TMPL_IF NAME="NoUpdateLogin" --> <input type="text" id="password" name="password" size="20" disabled="disabled" value="****" /> <!-- TMPL_ELSE --> - <input type="text" id="password" name="password" size="20" value="****" /> + <input type="text" id="password" name="password" size="20" value="<!-- TMPL_IF NAME="opduplicate" --><!--TMPL_ELSE-->****<!-- /TMPL_IF -->" /> <!-- /TMPL_IF --> <!--TMPL_ELSE--> <!-- TMPL_IF NAME="NoUpdateLogin" --> @@ -920,14 +921,12 @@ <!-- TMPL_IF EXPR="key eq 'debarred'" -->Debarred:<!-- /TMPL_IF --> <!-- TMPL_IF EXPR="key eq 'lost'" -->Lost Card:<!-- /TMPL_IF --> </label> - <label for="yes<!-- TMPL_VAR NAME="name" -->">Yes </label> <!-- TMPL_IF NAME="yes" --> <input type="radio" id="yes<!-- TMPL_VAR NAME="name" -->" name="<!-- TMPL_VAR NAME="name" -->" value="1" checked="checked" /> <!-- TMPL_ELSE --> <input type="radio" id="yes<!-- TMPL_VAR NAME="name" -->" name="<!-- TMPL_VAR NAME="name" -->" value="1" /> <!-- /TMPL_IF --> - <label for="no<!-- TMPL_VAR NAME="name" -->">No </label> <!-- TMPL_IF NAME="no" --> <input type="radio" id="no<!-- TMPL_VAR NAME="name" -->" name="<!-- TMPL_VAR NAME="name" -->" value="0" checked="checked"/> @@ -975,7 +974,7 @@ </select> <!-- TMPL_ELSE --> <input type="text" maxlength="64" value="<!-- TMPL_VAR NAME="value" -->" - id="<!-- TMPL_VAR NAME="form_id" -->" name="<!-- TMPL_VAR NAME="form_id" -->" /> + id="<!-- TMPL_VAR NAME="form_id" -->" name="<!-- TMPL_VAR NAME="form_id" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> <!-- /TMPL_IF --> <!-- TMPL_IF NAME="password_allowed" --> (Password: <input type="password" maxlength="64" value="<!-- TMPL_VAR NAME="password" -->" @@ -1047,7 +1046,7 @@ <!-- TMPL_INCLUDE NAME="messaging-preference-form.inc" --> <!-- TMPL_IF NAME="SMSSendDriver" --> <p><label for="SMSnumber">SMS number:</label> - <input type="text" id="SMSnumber" name="SMSnumber" value="<!-- TMPL_VAR NAME="SMSnumber" -->" /> + <input type="text" id="SMSnumber" name="SMSnumber" value="<!-- TMPL_VAR NAME="SMSnumber" -->"<!--TMPL_IF NAME="opduplicate"--> onclick="this.value=''"<!-- /TMPL_IF --> /> </p> <!-- /TMPL_IF --> </fieldset> diff --git a/members/memberentry.pl b/members/memberentry.pl index 063e489..cefbc7f 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -70,14 +70,15 @@ my $destination = $input->param('destination'); my $cardnumber = $input->param('cardnumber'); my $check_member = $input->param('check_member'); my $nodouble = $input->param('nodouble'); -$nodouble = 1 if $op eq 'modify'; # FIXME hack to represent fact that if we're - # modifying an existing patron, it ipso facto - # isn't a duplicate. Marking FIXME because this - # script needs to be refactored. -my $select_city = $input->param('select_city'); -my $nok = $input->param('nok'); -my $guarantorinfo = $input->param('guarantorinfo'); -my $step = $input->param('step') || 0; +my $duplicate = $input->param('duplicate'); +$nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're + # modifying an existing patron, it ipso facto + # isn't a duplicate. Marking FIXME because this + # script needs to be refactored. +my $select_city = $input->param('select_city'); +my $nok = $input->param('nok'); +my $guarantorinfo = $input->param('guarantorinfo'); +my $step = $input->param('step') || 0; my @errors; my $default_city; # $check_categorytype contains the value of duplicate borrowers category type to redirect in good template in step =2 @@ -98,9 +99,10 @@ my @field_check=split(/\|/,$check_BorrowerMandatoryField); foreach (@field_check) { $template->param( "mandatory$_" => 1); } -$template->param("add"=>1) if ($op eq 'add'); -$template->param("checked" => 1) if (defined($nodouble) && $nodouble eq 1); -($borrower_data = GetMember( 'borrowernumber'=>$borrowernumber )) if ($op eq 'modify' or $op eq 'save'); +$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 ); +( $borrower_data = GetMember( 'borrowernumber' => $borrowernumber ) ) if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ); my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; my $category_type = $input->param('category_type'); my $new_c_type = $category_type; #if we have input param, then we've already chosen the cat_type. @@ -116,9 +118,9 @@ $category_type="A" unless $category_type; # FIXME we should display a error mess %data = %$borrower_data if ($borrower_data); # initialize %newdata -my %newdata; # comes from $input->param() -if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') { - my @names= ($borrower_data && $op ne 'save') ? keys %$borrower_data : $input->param(); +my %newdata; # comes from $input->param() +if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) { + my @names = ( $borrower_data && $op ne 'save' ) ? keys %$borrower_data : $input->param(); foreach my $key (@names) { if (defined $input->param($key)) { $newdata{$key} = $input->param($key); @@ -275,8 +277,8 @@ if ($op eq 'save' || $op eq 'insert'){ } } -if ( ($op eq 'modify' || $op eq 'insert' || $op eq 'save') and ($step == 0 or $step == 3 )){ - if (exists ($newdata{'dateexpiry'}) && !($newdata{'dateexpiry'})){ +if ( ($op eq 'modify' || $op eq 'insert' || $op eq 'save'|| $op eq 'duplicate') and ($step == 0 or $step == 3 )){ + unless ($newdata{'dateexpiry'}){ my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso'); $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2); } @@ -384,6 +386,11 @@ if ($op eq "modify") { $template->param( updtype => 'M',modify => 1 ); $template->param( step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1, step_6 => 1) unless $step; } +if ( $op eq "duplicate" ) { + $template->param( updtype => 'I' ); + $template->param( step_1 => 1, step_2 => 1, step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1 ) unless $step; +} + # my $cardnumber=$data{'cardnumber'}; $data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add'; if(!defined($data{'sex'})){ -- 1.7.1