Adds support to the invoice linking dialog for linking sets of lineitems
or POs instead of just one.
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
this.linkFoundInvoice = function(r) {
self.inv = openils.Util.readResponse(r);
- location.href = oilsBasePath + "/acq/invoice/view/" + self.inv.id() +
- "?attach_" + self.which + "=" + self.target.id();
+ var path = oilsBasePath + "/acq/invoice/view/" + self.inv.id();
+ if (!dojo.isArray(self.target)) self.target = [self.target];
+ dojo.forEach(self.target, function(target, idx) {
+ id = (typeof target != 'object') ? target : target.id();
+ var join = (idx == 0) ? '?' : '&';
+ path += join + "attach_" + self.which + "=" + id;
+ });
+ location.href = path;
};
this.which = which;