681 lines
38 KiB
Plaintext
681 lines
38 KiB
Plaintext
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Koha %]
|
|
[% USE KohaDates %]
|
|
[% USE Branches %]
|
|
[% USE Categories %]
|
|
[% USE TablesSettings %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title
|
|
>[% FILTER collapse %]
|
|
[% IF ( op == 'show' or op == 'show_results' ) %]
|
|
[% IF ( op == 'show' ) %]
|
|
[% t("Modifications") | html %]
|
|
›
|
|
[% ELSE %]
|
|
[% t("Results") | html %]
|
|
›
|
|
[% END %]
|
|
[% END %]
|
|
[% t("Batch patron modification") | html %]
|
|
› [% t("Tools") | html %] › [% t("Koha") | html %]
|
|
[% END %]</title
|
|
>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="tools_modborrowers" class="tools">
|
|
[% WRAPPER 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
[% END %]
|
|
|
|
[% WRAPPER 'sub-header.inc' %]
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
|
|
[% END %]
|
|
[% IF ( op == 'show' or op == 'show_results' ) %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/tools/modborrowers.pl">Batch patron modification</a>
|
|
[% END %]
|
|
[% IF ( op == 'show' ) %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
[% t("Modifications") | html %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
[% t("Results")| html %]
|
|
[% END %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Batch patron modification</span>
|
|
[% END %]
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
[% END #/ WRAPPER sub-header.inc %]
|
|
|
|
[% WRAPPER 'main-container.inc' aside='tools-menu' %]
|
|
|
|
[% IF ( op == 'show_form' ) %]
|
|
<h1>Batch patron modification</h1>
|
|
<form id="patron_batchmod_form" method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/modborrowers.pl">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<input type="hidden" name="op" value="cud-show" />
|
|
|
|
[% WRAPPER tabs id= "batch_patron_options" %]
|
|
[% WRAPPER tabs_nav %]
|
|
[% WRAPPER tab_item tabname= "usecardnumber" bt_active= 1 %]<span>By card number</span>[% END %]
|
|
[% WRAPPER tab_item tabname= "useborrowernumber" %]<span>By borrowernumber</span>[% END %]
|
|
[% IF patron_lists %]
|
|
[% WRAPPER tab_item tabname= "uselist" %]<span>By patron list</span>[% END %]
|
|
[% END %]
|
|
[% END # /WRAPPER tabs_nav %]
|
|
|
|
[% WRAPPER tab_panels %]
|
|
[% WRAPPER tab_panel tabname="usecardnumber" bt_active= 1 %]
|
|
<fieldset class="rows">
|
|
<legend>Use a file of card numbers</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="cardnumberuploadfile">File: </label> <input type="file" id="cardnumberuploadfile" name="cardnumberuploadfile" />
|
|
<div class="hint">File must contain one card number per line.</div>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="rows">
|
|
<legend>Or list card numbers one by one</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="cardnumberlist">Card number list (one card number per line): </label>
|
|
<textarea rows="10" cols="30" id="cardnumberlist" name="cardnumberlist">[% cardnumberlist | html %]</textarea>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" class="btn btn-primary" value="Continue" />
|
|
<a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
|
|
</fieldset>
|
|
[% END # /tab_panel# %]
|
|
|
|
[% WRAPPER tab_panel tabname="useborrowernumber" %]
|
|
<fieldset class="rows">
|
|
<legend>Use a file of borrowernumbers</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="borrowernumberuploadfile">File: </label> <input type="file" id="borrowernumberuploadfile" name="borrowernumberuploadfile" />
|
|
<div class="hint">File must contain one borrowernumber per line.</div>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="rows">
|
|
<legend>List borrowernumbers one by one</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="borrowernumberlist">Borrowernumber list (one number per line): </label>
|
|
<textarea rows="10" cols="30" id="borrowernumberlist" name="borrowernumberlist">[% borrowernumberlist | html %]</textarea>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" class="btn btn-primary" value="Continue" />
|
|
<a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
|
|
</fieldset>
|
|
[% END # /tab_panel# %]
|
|
|
|
[% IF patron_lists %]
|
|
[% WRAPPER tab_panel tabname="uselist" %]
|
|
<fieldset class="rows">
|
|
<legend>Use a patron list</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="patron_list_id">Patron list: </label>
|
|
<select id="patron_list_id" name="patron_list_id">
|
|
<option value=""> -- Choose a patron list -- </option>
|
|
[% FOREACH pl IN patron_lists %]
|
|
<option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" class="btn btn-primary" value="Continue" />
|
|
<a class="cancel" href="/cgi-bin/koha/tools/tools-home.pl">Cancel</a>
|
|
</fieldset>
|
|
[% END # /tab_panel# %]
|
|
[% END %]
|
|
[% END # /WRAPPER tab_panels %]
|
|
[% END # /WRAPPER tabs %]
|
|
</form>
|
|
[% END %]
|
|
|
|
[% IF ( op == 'show') && (!borrowers) && (!notfoundcardnumbers) # Alert if no patrons given %]
|
|
[% op = 'noshow' # Change op to prevent display in code below %]
|
|
<h1>Batch patrons modification</h1>
|
|
<div class="alert alert-warning">
|
|
<p>No patron card numbers or borrowernumbers given.</p>
|
|
<form action="/cgi-bin/koha/tools/modborrowers.pl" method="get">
|
|
<button type="submit" class="btn btn-default approve"><i class="fa fa-fw fa-check"></i> OK</button>
|
|
</form>
|
|
</div>
|
|
[% END #Alert if no patrons %]
|
|
|
|
[% IF ( op == 'show' or op == 'show_results' ) %]
|
|
<h1>Batch patron modification</h1>
|
|
[% UNLESS ( op == 'show' ) %]
|
|
<h2>Results</h2>
|
|
[% END %]
|
|
[% IF ( notfoundcardnumbers ) %]
|
|
[% IF ( useborrowernumbers ) -%]
|
|
<div class="alert alert-warning"><p>Warning, the following borrowernumbers were not found:</p></div>
|
|
[% ELSE -%]
|
|
<div class="alert alert-warning"><p>Warning, the following card numbers were not found:</p></div>
|
|
[% END %]
|
|
|
|
<div class="page-section">
|
|
<table style="margin:auto;">
|
|
<thead>
|
|
[% IF ( useborrowernumbers ) -%]
|
|
<tr><th>Borrowernumbers not found</th></tr>
|
|
[% ELSE -%]
|
|
<tr><th>Card numbers not found</th></tr>
|
|
[% END %]
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH notfoundcardnumber IN notfoundcardnumbers %]
|
|
<tr><td>[% notfoundcardnumber.cardnumber | html %]</td></tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- /.page-section -->
|
|
[% END %]
|
|
|
|
[% IF ( op == 'show_results' ) %]
|
|
[% IF ( errors ) %]
|
|
<div class="alert alert-warning">
|
|
<h4>Errors occurred:</h4>
|
|
<ul class="warnings">
|
|
[% FOREACH error IN errors %]
|
|
[% IF ( error.error == 'can_not_update' ) %]
|
|
<li>Can not update patron. [% IF ( error.cardnumber ) %]Card number: [% error.cardnumber | html %][% END %] (Borrowernumber: [% error.borrowernumber | html %]) </li>
|
|
[% ELSE %]
|
|
<li>[% error.error | html %]</li>
|
|
[% END %]
|
|
[% END %]
|
|
</ul>
|
|
</div>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% BLOCK show_patron_list %]
|
|
[% IF borrowers %]
|
|
<div id="cataloguing_additem_itemlist" class="page-section">
|
|
<table id="borrowerst">
|
|
<thead>
|
|
<tr>
|
|
<th data-colname="batch_patron_edit_selections" class="no-sort"> </th>
|
|
<th data-colname="batch_patron_edit_cardnumber">Card number</th>
|
|
<th data-colname="batch_patron_edit_surname">Surname</th>
|
|
<th data-colname="batch_patron_edit_firstname">First name</th>
|
|
<th data-colname="batch_patron_edit_branchcode">Library</th>
|
|
<th data-colname="batch_patron_edit_categorycode">Patron category</th>
|
|
<th data-colname="batch_patron_edit_streetnumber">Street number</th>
|
|
<th data-colname="batch_patron_edit_address">Address</th>
|
|
<th data-colname="batch_patron_edit_address2">Address 2</th>
|
|
<th data-colname="batch_patron_edit_city">City</th>
|
|
<th data-colname="batch_patron_edit_state">State</th>
|
|
<th data-colname="batch_patron_edit_zipcode">ZIP/Postal code</th>
|
|
<th data-colname="batch_patron_edit_country">Country</th>
|
|
<th data-colname="batch_patron_edit_email">Primary email</th>
|
|
<th data-colname="batch_patron_edit_phone">Primary phone</th>
|
|
<th data-colname="batch_patron_edit_mobile">Other phone</th>
|
|
<th data-colname="batch_patron_edit_fax">Fax</th>
|
|
<th data-colname="batch_patron_edit_dateenrolled">Registration date</th>
|
|
<th data-colname="batch_patron_edit_dateexpiry">Expiry date</th>
|
|
<th data-colname="batch_patron_edit_password_expiration_date">Password expiration date</th>
|
|
<th data-colname="batch_patron_edit_protected">Protected</th>
|
|
<th data-colname="batch_patron_edit_borrowernotes">Circulation note</th>
|
|
<th data-colname="batch_patron_edit_opacnote">OPAC note</th>
|
|
<th data-colname="batch_patron_edit_messages">Message</th>
|
|
<th data-colname="batch_patron_edit_debarred">Restriction expiration</th>
|
|
<th data-colname="batch_patron_edit_debarredcomment">Restriction comment</th>
|
|
[% FOREACH attrh IN attributes_header %]
|
|
<th>[% attrh.attribute | html %]</th>
|
|
[% END %]
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH borrower IN borrowers %]
|
|
<tr>
|
|
<td>
|
|
<input type="checkbox" name="borrowernumber" value="[% borrower.borrowernumber | html %]" checked="checked" />
|
|
</td>
|
|
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber | uri %]">[% borrower.cardnumber | html %]</a></td>
|
|
<td>[% borrower.surname | html %]</td>
|
|
<td>[% borrower.firstname | html %]</td>
|
|
<td>[% Branches.GetName( borrower.branchcode ) | html %]</td>
|
|
<td>[% Categories.GetName(borrower.categorycode) | html %]</td>
|
|
<td>[% borrower.streetnumber | html %]</td>
|
|
<td>[% borrower.address | html %]</td>
|
|
<td>[% borrower.address2 | html %]</td>
|
|
<td>[% borrower.city | html %]</td>
|
|
<td>[% borrower.state | html %]</td>
|
|
<td>[% borrower.zipcode | html %]</td>
|
|
<td>[% borrower.country | html %]</td>
|
|
<td>[% borrower.email | html %]</td>
|
|
<td>[% borrower.phone | html %]</td>
|
|
<td>[% borrower.mobile | html %]</td>
|
|
<td>[% borrower.fax | html %]</td>
|
|
<td data-order="[% borrower.dateenrolled | html %]">[% borrower.dateenrolled | $KohaDates %]</td>
|
|
<td data-order="[% borrower.dateexpiry | html %]">[% borrower.dateexpiry | $KohaDates %]</td>
|
|
[% IF CanUpdatePasswordExpiration %]
|
|
[% IF borrower.password_expiration_date %]
|
|
<td data-order="[% borrower.password_expiration_date | html %]"> [% borrower.password_expiration_date | $KohaDates %] </td>
|
|
[% ELSE %]
|
|
<td data-order="9999-99-99">Never</td>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<td></td>
|
|
[% END %]
|
|
[% IF CanUpdateProtectPatron %]
|
|
<td>
|
|
[% IF borrower.protected %]
|
|
Yes
|
|
[% ELSE %]
|
|
No
|
|
[% END %]
|
|
</td>
|
|
[% ELSE %]
|
|
<td></td>
|
|
[% END %]
|
|
<td>[% borrower.borrowernotes | $raw | html_line_break %]</td>
|
|
<td>[% borrower.opacnote | html %]</td>
|
|
<td>
|
|
[% FOREACH patron_message IN borrower.patron_messages %]
|
|
[% patron_message.message | html %] <br />
|
|
<strong>
|
|
[% IF (patron_message.message_type == 'B') %]
|
|
( OPAC )
|
|
[% ELSE %]
|
|
( Staff )
|
|
[% END %] </strong
|
|
><br /><br />
|
|
[% END %]
|
|
</td>
|
|
<td data-order="[% borrower.debarred | html %]">[% borrower.debarred | $KohaDates %]</td>
|
|
<td>[% borrower.debarredcomment | html %]</td>
|
|
[% FOREACH pa IN borrower.patron_attributes %]
|
|
[% IF ( pa.code ) %]
|
|
[%# Replace pa.attribute with pa.description if we prefer to display the description %]
|
|
<td>[% pa.code | html %]=[% pa.attribute | html %]</td>
|
|
[% ELSE %]
|
|
<td></td>
|
|
[% END %]
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
[% END %]
|
|
[% END %]
|
|
[% IF ( op == 'show' ) %]
|
|
<form name="f" action="modborrowers.pl" method="post" id="batchmod-borrowers-form">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<input type="hidden" name="op" value="cud-do" />
|
|
[% IF ( borrowers ) %]
|
|
<div class="btn-toolbar selections-toolbar"
|
|
><a id="selectallbutton" href="#"><i class="fa fa-check"></i> Select all</a> | <a id="clearallbutton" href="#"><i class="fa fa-times"></i> Clear all</a></div
|
|
>
|
|
[% PROCESS show_patron_list %]
|
|
<div id="cataloguing_additem_newitem">
|
|
<h2>Edit patrons</h2>
|
|
<div class="hint">Checking the box right next to the label will disable the entry and delete the values of that field on all selected patrons</div>
|
|
<fieldset class="rows" id="fields_list">
|
|
<ol>
|
|
[% FOREACH field IN fields %]
|
|
<li>
|
|
<label for="[% field.name | html %]" [% IF field.mandatory %]class="required"[% END %]>
|
|
[% SWITCH ( field.name ) %]
|
|
[% CASE 'surname' %]
|
|
<span>Surname:</span>
|
|
[% CASE 'firstname' %]
|
|
<span>First name:</span>
|
|
[% CASE 'branchcode' %]
|
|
<span>Library:</span>
|
|
[% CASE 'categorycode' %]
|
|
<span>Patron category:</span>
|
|
[% CASE 'streetnumber' %]
|
|
<span>Street number:</span>
|
|
[% CASE 'address' %]
|
|
<span>Address:</span>
|
|
[% CASE 'address2' %]
|
|
<span>Address 2:</span>
|
|
[% CASE 'city' %]
|
|
<span>City:</span>
|
|
[% CASE 'state' %]
|
|
<span>State:</span>
|
|
[% CASE 'zipcode' %]
|
|
<span>ZIP/Postal code:</span>
|
|
[% CASE 'country' %]
|
|
<span>Country:</span>
|
|
[% CASE 'email' %]
|
|
<span>Primary email:</span>
|
|
[% CASE 'phone' %]
|
|
<span>Primary phone:</span>
|
|
[% CASE 'mobile' %]
|
|
<span>Other phone:</span>
|
|
[% CASE 'fax' %]
|
|
<span>Fax:</span>
|
|
[% CASE 'sort1' %]
|
|
<span>Sort 1:</span>
|
|
[% CASE 'sort2' %]
|
|
<span>Sort 2:</span>
|
|
[% CASE 'dateenrolled' %]
|
|
<span>Registration date:</span>
|
|
[% CASE 'dateexpiry' %]
|
|
<span>Expiry date:</span>
|
|
[% CASE 'borrowernotes' %]
|
|
<span>Circulation note:</span>
|
|
[% CASE 'opacnote' %]
|
|
<span>OPAC note:</span>
|
|
[% CASE "message" %]
|
|
<span>Message:</span>
|
|
[% CASE 'debarred' %]
|
|
<span>Restriction expiration:</span>
|
|
[% CASE 'debarredcomment' %]
|
|
<span>Restriction comment:</span>
|
|
[% CASE 'password_expiration_date' %]
|
|
<span>Password expiration date:</span>
|
|
[% CASE 'protected' %]
|
|
<span>Protected:</span>
|
|
[% END %]
|
|
</label>
|
|
[% IF ( field.type == 'text' ) %]
|
|
<input type="text" id="[% field.name | html %]" name="[% field.name | html %]" value="" />
|
|
[% END %]
|
|
[% IF ( field.type == 'message_type' ) %]
|
|
<input type="text" name="[% field.name | html %]" value="" />
|
|
<select name="add_message_type" id="message_type">
|
|
<option value="L">Staff - Internal note</option>
|
|
<option value="B">OPAC</option>
|
|
</select>
|
|
[% END %]
|
|
[% IF ( field.type == 'select' ) %]
|
|
[% IF field.option.size %]
|
|
<select id="[% field.name | html %]" name="[% field.name | html %]">
|
|
[% FOREACH opt IN field.option %]
|
|
<option value="[% opt.value | html %]">[% opt.lib | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
[% ELSE %]
|
|
There is no value defined for [% field.name | html %]
|
|
[% END %]
|
|
[% END %]
|
|
[% IF ( field.type == 'bool' ) %]
|
|
<select name="[% field.name | html %]">
|
|
<option value=""></option>
|
|
<option value="1">Yes</option>
|
|
<option value="0">No</option>
|
|
</select>
|
|
[% END %]
|
|
[% IF ( field.type == 'date' ) %]
|
|
<input type="text" name="[% field.name | html %]" id="[% field.name | html %]" value="" size="10" maxlength="10" class="flatpickr" />
|
|
<a href="#" class="clear-date" id="clear-date-[% field.name | html %]"><i class="fa fa-fw fa-trash-can"></i> Clear</a>
|
|
[% END %]
|
|
[% IF field.mandatory %]
|
|
<input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name | html %]" disabled="disabled" readonly="readonly" />
|
|
<span class="required">Required fields cannot be cleared</span>
|
|
[% ELSE %]
|
|
<input type="checkbox" title="Check to delete this field" name="disable_input" value="[% field.name | html %]" />
|
|
[% IF ( field.type == 'message_type' ) %]
|
|
<span class="hint">NOTE: Checking this box will remove ALL messages</span>
|
|
[% END %]
|
|
[% END %]
|
|
</li>
|
|
[% END %]
|
|
[% IF ( patron_attributes_codes ) %]
|
|
<li class="attributes">
|
|
<label for="patron_attributes" style="width:auto;">
|
|
<span>Patron attribute:</span>
|
|
</label>
|
|
<select id="patron_attributes" name="patron_attributes">
|
|
<option value=""></option>
|
|
[% FOREACH pac IN patron_attributes_codes %]
|
|
<option value="[% pac.attribute_code | html %]" data-type="[% pac.type | html %]" data-category="[% pac.category_lib | html %]">[% pac.attribute_lib | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
|
|
<input type="checkbox" title="check to delete this field" name="disable_input" value="attr0_value" />
|
|
<span class="patron_attributes_value"><input type="hidden" name="patron_attributes_value" /></span>
|
|
<a href="#" class="add_attributes" title="Add an attribute"><i class="fa fa-fw fa-plus"></i> New</a>
|
|
<span class="information_category hint" style="width:25%;float:right;"></span>
|
|
</li>
|
|
<div class="hint">NOTE: Attributes set here will replace all attributes of the same type in the patron record.</div>
|
|
[% END %]
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" name="mainformsubmit" class="btn btn-primary" value="Save" />
|
|
<a href="/cgi-bin/koha/tools/modborrowers.pl" class="cancel">Cancel</a>
|
|
[% PROCESS 'members-patron-selections.inc' id="batchmod-borrowers-form" %]
|
|
</fieldset>
|
|
</div>
|
|
[% END %]
|
|
</form>
|
|
[% ELSIF ( op == 'show_results' ) %]
|
|
[% PROCESS show_patron_list %]
|
|
<p>
|
|
<a href="/cgi-bin/koha/tools/modborrowers.pl" title="New batch patrons modification">New batch patron modification</a>
|
|
</p>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% Asset.js("js/tools-menu.js") | $raw %]
|
|
[% Asset.js("js/members-patron-selections.js") | $raw %]
|
|
<script>
|
|
var patron_attributes_lib = new Array();
|
|
var patron_attributes_values = new Array();
|
|
|
|
$(document).ready(function() {
|
|
[% IF borrowers %]
|
|
|
|
var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'batch_patron_modification', 'borrowerst', 'json' ) | $raw %];
|
|
|
|
[% FOREACH attrh IN attributes_header %]
|
|
table_settings["columns"].push({
|
|
columname: "[% attrh.attribute | html %]",
|
|
cannot_be_modified: 0,
|
|
cannot_be_toggled: 0,
|
|
is_hidden: 0
|
|
});
|
|
[% END %]
|
|
|
|
let selections_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_selections');
|
|
selections_column.cannot_be_modified = 1;
|
|
selections_column.cannot_be_toggled = 1;
|
|
selections_column.force_visibility = 1;
|
|
[% IF op == 'show' %]
|
|
selections_column.is_hidden = 0;
|
|
[% ELSE %]
|
|
selections_column.is_hidden = 1;
|
|
[% END %]
|
|
|
|
[% UNLESS CanUpdatePasswordExpiration %]
|
|
let password_expiration_date_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_password_expiration_date');
|
|
password_expiration_date_column.is_hidden = 1;
|
|
password_expiration_date_column.cannot_be_modified = 1;
|
|
password_expiration_date_column.cannot_be_toggled = 1;
|
|
password_expiration_date_column.force_visibility = 1;
|
|
[% END %]
|
|
|
|
[% UNLESS CanUpdateProtectPatron %]
|
|
let protected_column = table_settings.columns.find(c => c.columnname == 'batch_patron_edit_protected');
|
|
protected_column.is_hidden = 1;
|
|
protected_column.cannot_be_modified = 1;
|
|
protected_column.cannot_be_toggled = 1;
|
|
protected_column.force_visibility = 1;
|
|
[% END %]
|
|
|
|
let patron_table = $("#borrowerst").kohaTable(
|
|
{
|
|
order: [[1, "asc"]],
|
|
autoWidth: true,
|
|
bKohaColumnsUseNames: true,
|
|
},
|
|
table_settings
|
|
);
|
|
|
|
$("#selectallbutton").click(function() {
|
|
$("#borrowerst").find("input:checkbox").each(function() {
|
|
$(this).prop("checked", true);
|
|
});
|
|
return false;
|
|
});
|
|
$("#clearallbutton").click(function() {
|
|
$("#borrowerst").find("input:checkbox").each(function() {
|
|
$(this).prop("checked", false);
|
|
});
|
|
return false;
|
|
});
|
|
[% END %]
|
|
|
|
var values = new Array();
|
|
var lib = new Array();
|
|
[% FOREACH pav IN patron_attributes_values %]
|
|
values = new Array();
|
|
lib = new Array();
|
|
[% FOREACH option IN pav.options %]
|
|
values.push("[% option.lib | html %]");
|
|
lib.push("[% option.authorised_value | html %]");
|
|
[% END %]
|
|
patron_attributes_lib["[% pav.attribute_code | html %]"] = values;
|
|
patron_attributes_values["[% pav.attribute_code | html %]"] = lib;
|
|
[% END %]
|
|
|
|
$('select[name="patron_attributes"]').change(function() {
|
|
updateAttrValues(this);
|
|
} );
|
|
|
|
$('select[name="patron_attributes"]').change();
|
|
|
|
$(".clear-date").on("click",function(e){
|
|
e.preventDefault();
|
|
var fieldID = this.id.replace("clear-date-","");
|
|
$("#" + fieldID).val("");
|
|
});
|
|
$("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){
|
|
e.preventDefault();
|
|
add_attributes();
|
|
});
|
|
$("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){
|
|
e.preventDefault();
|
|
del_attributes(this);
|
|
});
|
|
$("#patron_batchmod_form").on("submit", function(){
|
|
/* Reset form fields on inactive tabs */
|
|
var tab = $(this).find('ul.nav-tabs li a.active').attr('href');
|
|
if ( tab == '#usecardnumber_panel' ) {
|
|
$("#borrowernumberuploadfile, #patron_list_id, #borrowernumberlist").val("");
|
|
} else if ( tab == '#useborrowernumber_panel' ) {
|
|
$("#cardnumberuploadfile, #cardnumberlist, #patron_list_id").val("");
|
|
} else { // uselist_panel
|
|
$("#borrowernumberuploadfile, #cardnumberuploadfile, #borrowernumberlist, #cardnumberlist").val("");
|
|
}
|
|
});
|
|
|
|
$('form[name="f"]').on("submit", function(){
|
|
// Add the checkboxes to the DOM before we submit the form
|
|
var form = this;
|
|
var checkboxes = $(patron_table).find('input:checkbox:checked').serializeArray();
|
|
$.each(checkboxes, function(){
|
|
let borrowernumber = this.value;
|
|
if(!$(form).find('input[name="borrowernumber"][value="'+borrowernumber+'"]').length){
|
|
$(form).append(
|
|
$('<input>')
|
|
.attr('type', 'hidden')
|
|
.attr('name', 'borrowernumber')
|
|
.val(borrowernumber)
|
|
);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
function updateAttrValues (select_attr) {
|
|
var attr_code = $(select_attr).val();
|
|
var selected_option = $(select_attr).find("option:selected");
|
|
var type = $(selected_option).attr('data-type');
|
|
var category = $(selected_option).attr('data-category');
|
|
var li_node = $(select_attr).parent();
|
|
var span = $(li_node).find('span.patron_attributes_value');
|
|
var information_category_node = $(li_node).find('span.information_category');
|
|
information_category_node.html("");
|
|
|
|
if ( category && category.length > 0 ) {
|
|
information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category));
|
|
}
|
|
var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']");
|
|
if ( type == 'select' ) {
|
|
var options = '<option value = ""></option>';
|
|
for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) {
|
|
options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>';
|
|
}
|
|
span.html('<select name="patron_attributes_value">' + options + '</select>');
|
|
$(disable_input_node).show();
|
|
} else if ( $(selected_option).val() != "" ) {
|
|
span.html('<input type="text" name="patron_attributes_value"/>');
|
|
$(disable_input_node).show();
|
|
} else {
|
|
span.html('<input type="hidden" name="patron_attributes_value" />');
|
|
$(disable_input_node).hide();
|
|
}
|
|
}
|
|
|
|
function add_attributes() {
|
|
var count = $("li.attributes").length;
|
|
var li_node = $("li.attributes:last");
|
|
var li_clone = $(li_node).clone();
|
|
if ( $(li_clone).find("a.del_attributes").length == 0 ) {
|
|
var add_attributes = $(li_clone).find("a.add_attributes")
|
|
$(add_attributes).after('<a href="#" title="' + _("Delete") + '" class="del_attributes"><i class="fa fa-fw fa-trash-can"></i> ' + _("Delete") + '</a>');
|
|
}
|
|
li_node.find("label").attr("for", li_node.find("label").attr("for") + "_" + count );
|
|
li_node.find("input, select").attr("id", li_node.find("select").attr("id") + "_" + count );
|
|
|
|
$(li_clone).find('select[name="patron_attributes"]').change(function() {
|
|
updateAttrValues(this);
|
|
} );
|
|
|
|
$(li_clone).find('select[name="patron_attributes"]').change();
|
|
|
|
$("#fields_list>ol").append(li_clone);
|
|
update_attr_values();
|
|
}
|
|
|
|
function del_attributes(a_node) {
|
|
$(a_node).parent('li').remove();
|
|
update_attr_values();
|
|
}
|
|
|
|
function update_attr_values() {
|
|
$("li.attributes").each(function(i) {
|
|
$(this).find("input:checkbox").val("attr"+i+"_value");
|
|
});
|
|
}
|
|
function clearDate(nodeid) {
|
|
$("#"+nodeid).val("");
|
|
}
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|