Koha/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-numberpatterns.tt
Jonathan Druart 8e364c4c6a Bug 11262: Don't require hardcoded translations for seasonal numbering pattern to work
This patch removes the use of POSIX::strftime which is based on the
locales of the system.

The DateTime module translates month and day name with success, without
any locale installed.

For the saesons, I use the way used in Koha: write the word in
templates. On this way the translate script will match them and allow
translators to translate them.

This patch adds a regression: the season names are not translated
following the locale selected.
This could be done when bug 8044 will be pushed.

Test plan:
0/ Update your po files and translate the season name.
1/ Create a numbering pattern using season.
example:
Name: Seasonal
Numbering formula: {X}
X: Season, Add=1, Every=1, Set back to 0 when more than 3, formatting
"name of season"
And test the prediction pattern with:
frequency: 1/3 month
First issue : 2013-09-21
length: 12 months
X begins with 2 (21th Septembre is Fall)
2/ Click on the test pattern button, you should get:
Fall       21/09/2013
Winter     21/12/2013
Spring     21/03/2014
Summer     21/06/2014

Change the locale and verify the season names are *not* translated.
Change the Koha language and verify the season names are translated.

3/ Create a numbering pattern using day or month name.
example:
Name: day
Numbering formula: {X}
X: day, Add=1, Every=1, Set back to 0 when more than 6, formatting "name
of day"
Frequency: 1/day
First issue: 2013-11-18
length: 1 month
X begins with 0
You should get:
Monday  18/11/2013
Tuesday     19/11/2013
Wednesday   20/11/2013
[...]
Sunday      15/12/2013
Monday      16/12/2013
Tuesday     17/12/2013

change the locale and verify the day names are translated.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described. No koha-qa errors

Tested on top of Bug 11265 and Bug 11263,
and solved merge conflict

Updating PO file gives seasons to translate.
Tested using seasons, day and month

Only note is different behavior
1) To use seasons you need to use staff in desired language
2) To use day and month only need to select locale

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
No regressions found. Passes koha-qa.pl, t and xt

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested this again on top of 11263 and it works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 05:05:54 +00:00

333 lines
14 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Serials &rsaquo; Number patterns</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript">
//<![CDATA[
[% IF (new or modify) %]
function testPattern() {
var frequencyid = $("#frequency").val();
var firstacquidate = $("#firstacquidate").val();
var error = 0;
var error_msg = "";
if(frequencyid == undefined || frequencyid == "") {
error_msg += _("- Frequency is not defined") + "\n";
error ++;
}
if(firstacquidate == undefined || firstacquidate == "") {
error_msg += _("- First publication date is not defined") + "\n";
error ++;
}
if(error){
alert(_("Cannot test prediction pattern for the following reason(s):") + "\n\n"
+ error_msg);
return false;
}
var ajaxData = {
'custompattern': true,
};
var ajaxParams = [
'firstacquidate', 'subtype', 'sublength', 'frequency', 'numberingmethod',
'lastvalue1', 'lastvalue2', 'lastvalue3', 'add1', 'add2', 'add3',
'every1', 'every2', 'every3', 'innerloop1', 'innerloop2', 'innerloop3',
'setto1', 'setto2', 'setto3', 'numbering1', 'numbering2', 'numbering3',
'whenmorethan1', 'whenmorethan2', 'whenmorethan3', 'locale'
];
for(i in ajaxParams) {
var param = ajaxParams[i];
var value = $("#"+param).val();
if(value.length > 0)
ajaxData[param] = value;
}
$.ajax({
url: "/cgi-bin/koha/serials/showpredictionpattern.pl",
data: ajaxData,
async: false,
dataType: "text",
success: function(data) {
$("#predictionpattern").html(data);
}
});
}
[% END %]
function show_blocking_subs() {
$("#blocking_subs").show();
}
//]]>
</script>
</head>
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'serials-search.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
<a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo;
<a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl">Numbering patterns</a>
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF (new or modify) %]
<div class="yui-g">
[% IF (new) %]
<h1>New number pattern</h1>
[% IF (error_existing_numberpattern) %]
<div class="dialog">
<p>A pattern with this name already exists.</p>
</div>
[% END %]
[% ELSE %]
<h1>Modify pattern: [% label %]</h1>
[% IF (error_existing_numberpattern) %]
<div class="dialog">
<p>Another pattern with this name already exists.</p>
</div>
[% END %]
[% END %]
</div>
<div class="yui-g">
<form action="/cgi-bin/koha/serials/subscription-numberpatterns.pl" method="post">
[% IF (new) %]
<input type="hidden" name="op" value="savenew" />
[% ELSE %]
<input type="hidden" name="op" value="savemod" />
<input type="hidden" name="id" value="[% id %]" />
[% END %]
<fieldset class="rows">
<ol>
<li>
<label for="label">Name:</label>
<input type="text" id="label" name="label" value="[% label %]" />
</li>
<li>
<label for="description">Description:</label>
<input type="text" id="description" name="description" value="[% description %]" />
</li>
<li>
<label for="numberingmethod">Numbering formula:</label>
<input type="text" id="numberingmethod" name="numberingmethod" value="[% numberingmethod %]" />
</li>
<li>
<label for="displayorder">Display order:</label>
<input type="text" id="displayorder" name="displayorder" value="[% displayorder %]" />
</li>
</ol>
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>X</th>
<th>Y</th>
<th>Z</th>
</tr>
</thead>
<tbody>
<tr>
<td>Label</td>
<td><input type="text" id="label1" name="label1" value="[% label1 %]" /></td>
<td><input type="text" id="label2" name="label2" value="[% label2 %]" /></td>
<td><input type="text" id="label3" name="label3" value="[% label3 %]" /></td>
</tr>
<tr>
<td>Add</td>
<td><input type="text" id="add1" name="add1" value="[% add1 %]" /></td>
<td><input type="text" id="add2" name="add2" value="[% add2 %]" /></td>
<td><input type="text" id="add3" name="add3" value="[% add3 %]" /></td>
</tr>
<tr>
<td>Every</td>
<td><input type="text" id="every1" name="every1" value="[% every1 %]" /></td>
<td><input type="text" id="every2" name="every2" value="[% every2 %]" /></td>
<td><input type="text" id="every3" name="every3" value="[% every3 %]" /></td>
</tr>
<tr>
<td>Set back to</td>
<td><input type="text" id="setto1" name="setto1" value="[% setto1 %]" /></td>
<td><input type="text" id="setto2" name="setto2" value="[% setto2 %]" /></td>
<td><input type="text" id="setto3" name="setto3" value="[% setto3 %]" /></td>
</tr>
<tr>
<td>When more than</td>
<td><input type="text" id="whenmorethan1" name="whenmorethan1" value="[% whenmorethan1 %]" /></td>
<td><input type="text" id="whenmorethan2" name="whenmorethan2" value="[% whenmorethan2 %]" /></td>
<td><input type="text" id="whenmorethan3" name="whenmorethan3" value="[% whenmorethan3 %]" /></td>
</tr>
<tr>
[% BLOCK numbering_select %]
<select id="[% name %]" name="[% name %]" />
<option value=""></option>
[% IF (value == "dayname") %]
<option selected="selected" value="dayname">Name of day</option>
[% ELSE %]
<option value="dayname">Name of day</option>
[% END %]
[% IF (value == "monthname") %]
<option selected="selected" value="monthname">Name of month</option>
[% ELSE %]
<option value="monthname">Name of month</option>
[% END %]
[% IF (value == "season") %]
<option selected="selected" value="season">Name of season</option>
[% ELSE %]
<option value="season">Name of season</option>
[% END %]
</select>
[% END %]
<td>Formatting</td>
<td>[% PROCESS numbering_select name="numbering1" value=numbering1 %]</td>
<td>[% PROCESS numbering_select name="numbering2" value=numbering2 %]</td>
<td>[% PROCESS numbering_select name="numbering3" value=numbering3 %]</td>
</tr>
</tbody>
</table>
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
<input type="reset" value="Reset" />
<input type="button" value="Cancel" onclick="window.location = '/cgi-bin/koha/serials/subscription-numberpatterns.pl';" />
</fieldset>
</form>
</div>
<div class="yui-g">
<form>
<fieldset class="rows">
<legend>Test prediction pattern</legend>
<ol>
<li>
<label for="frequency">Frequency:</label>
<select id="frequency">
[% FOREACH frequency IN frequencies_loop %]
<option value="[% frequency.id %]">[% frequency.description %]</option>
[% END %]
</select>
</li>
<li>
<label for="firstacquidate">First issue publication date</label>
<input type="text" id="firstacquidate" class="datepicker" size="10" />
</li>
<li>
<label for="sublength">Subscription length:</label>
<select id="subtype">
[% FOREACH subtype IN subtypes_loop %]
<option value="[% subtype.value %]">[% subtype.value %]</option>
[% END %]
</select>
<input type="text" id="sublength" size="3" />
</li>
<li>
<label for="locale">Locale:</label>
<select id="locale" name="locale">
<option value=""></option>
[% FOREACH locale IN locales %]
<option value="[% locale.language %]">[% locale.description %]</option>
[% END %]
</select>
<span class="hint">If empty, English is used</span>
</li>
</ol>
<table>
<thead>
<tr>
<th>&nbsp;</th>
<th>X</th>
<th>Y</th>
<th>Z</th>
</tr>
</thead>
<tbody>
<tr>
<td>Begins with</td>
<td><input type="text" id="lastvalue1" name="lastvalue1" value="[% lastvalue1 %]" /></td>
<td><input type="text" id="lastvalue2" name="lastvalue2" value="[% lastvalue2 %]" /></td>
<td><input type="text" id="lastvalue3" name="lastvalue3" value="[% lastvalue3 %]" /></td>
</tr>
<tr>
<td>Inner counter</td>
<td><input type="text" id="innerloop1" name="innerloop1" value="[% innerloop1 %]" /></td>
<td><input type="text" id="innerloop2" name="innerloop2" value="[% innerloop2 %]" /></td>
<td><input type="text" id="innerloop3" name="innerloop3" value="[% innerloop3 %]" /></td>
</tr>
</tbody>
</table>
<fieldset class="action">
<input type="button" value="Test pattern" onclick="testPattern();" />
</fieldset>
<div id="predictionpattern"></div>
</fieldset>
</form>
</div>
[% ELSE %]
<h1>Number patterns</h1>
[% IF still_used %]
<div class="dialog">
<p>
This pattern is still used by [% subscriptions.size %]
subscription(s). Do you still want to delete it?
</p>
<p><a href="#" onclick="show_blocking_subs(); return false;">Show subscriptions</a></p>
<ul id="blocking_subs" style="display:none">
[% FOREACH sub IN subscriptions %]
<li style="list-style-type:none">
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% sub.subscriptionid %]">[% sub.title %]</a>
</li>
[% END %]
</ul>
<form action="" method="get">
<input type="hidden" name="op" value="del" />
<input type="hidden" name="confirm" value="1" />
<input type="hidden" name="id" value="[% id %]" />
<input type="submit" class="approve" value="Yes, delete" />
</form>
<form action="" method="get">
<input type="submit" class="deny" value="No, don't delete" />
</form>
</div>
[% END %]
<a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=new">New numbering pattern</a>
[% IF (numberpatterns_loop.size) %]
<table id="numberpatternst">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Numbering formula</th>
<th>Display order</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH numberpattern IN numberpatterns_loop %]
<tr>
<td>[% numberpattern.label %]</td>
<td>[% numberpattern.description %]</td>
<td>[% numberpattern.numberingmethod %]</td>
<td>[% numberpattern.displayorder %]</td>
<td>
<a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=modify&id=[% numberpattern.id %]">Edit</a> |
<a href="/cgi-bin/koha/serials/subscription-numberpatterns.pl?op=del&id=[% numberpattern.id %]">Delete</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSE %]
<p>There is no existing patterns.</p>
[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'serials-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]