"flesh" => 2,
"flesh_fields" => {
"srlu" => [qw/reader stream/],
- "au" => [qw/card home_ou/],
+ "au" => [qw/card home_ou mailing_address billing_address/],
"sstr" => ["distribution"]
}
}
</div>
<ol name="users">
<li id="user_template">
- <span class="hidden" name="reader_container">
+ <div class="hidden" name="reader_container">
[% l('Reader: [_1] / [_2] ([_3])', '<span name="barcode"></span>',
'<span name="name"></span>',
'<span name="ou"></span>') %]
- </span>
+ <!-- XXX i18n? This template can be customized for
+ other address layouts if needed. -->
+ <div name="mailing_address_container" class="hidden">
+ <span name="mailing_address_street1"></span>
+ <span name="mailing_address_street2"></span><br />
+ <span name="mailing_address_city"></span>,
+ <!-- <span name="mailing_address_county"></span> -->
+ <span name="mailing_address_state"></span>
+ <span name="mailing_address_post_code"></span><br />
+ <span name="mailing_address_country"></span>
+ </div>
+ <div name="billing_address_container" class="hidden">
+ <span name="billing_address_street1"></span>
+ <span name="billing_address_street2"></span><br />
+ <span name="billing_address_city"></span>,
+ <!-- <span name="billing_address_county"></span> -->
+ <span name="billing_address_state"></span>
+ <span name="billing_address_post_code"></span><br />
+ <span name="billing_address_country"></span>
+ </div>
+ </div>
<span class="hidden" name="department_container">
[% l('Department: [_1]', '<span name="department"></span>') %]
</span>
return this; /* for chaining */
};
+ this._render_reader_addresses = function(reader, node) {
+ ["mailing", "billing"].forEach(
+ function(addr_type) {
+ var addr = reader[addr_type + "_address"]();
+ if (!addr || !addr.valid())
+ return;
+
+ var prefix = addr_type + "_address_";
+ var container = n(prefix + "container", node);
+ if (container)
+ openils.Util.show(container);
+
+ ["street1", "street2", "city", "county", "state",
+ "country", "post_code"].forEach(
+ function(f) {
+ var field = prefix + f;
+ var target = n(field, node);
+ if (target)
+ target.innerHTML = addr[f]();
+ }
+ );
+ }
+ );
+ };
+
this.render_users = function(stream, list) {
for (var i = 0; i < this.users_by_stream[stream.id()].length; i++) {
var user = this.users_by_stream[stream.id()][i];
].map(function(n) { return n || ""; })
);
n("ou", node).innerHTML = user.reader().home_ou().shortname();
+
+ this._render_reader_addresses(user.reader(), node);
+
openils.Util.show(n("reader_container", node), "inline");
} else if (user.department()) {
n("department", node).innerHTML = user.department();