def process_request(self, req): req.perm.require(self.BILLING_PERMISSION) messages = [] def addMessage(s): messages.extend([s]); if req.method == 'POST': if req.args.has_key('setbillingtime'): self.set_bill_date(req.authname) addMessage("All tickets last bill date updated") mgr = CustomReportManager(self.env, self.log) data = {}; data["statuses"] = get_statuses(self) data["reports"] = mgr.get_reports_by_group(CustomReportManager.TimingAndEstimationKey); #self.log.debug("DEBUG got %s, %s" % (data["reports"], type(data["reports"]))); data["billing_info"] = {"messages": messages, "href": req.href.Billing(), "report_base_href": req.href.report(), "usermanual_href": req.href.wiki(user_manual_wiki_title), "usermanual_title": user_manual_title } self.set_request_billing_dates(data) add_stylesheet(req, "Billing/billingplugin.css") add_script(req, "Billing/date.js") add_script(req, "Billing/linkifyer.js") return 'billing.html', data, None
def process_request(self, req): messages = [] def addMessage(s): messages.extend([s]) if not re.search('/Billing', req.path_info): return None if req.method == 'POST': if req.args.has_key('setbillingtime'): self.set_bill_date(req.authname) addMessage("All tickets last bill date updated") mgr = CustomReportManager(self.env, self.log) req.hdf["billing_info"] = { "messages": messages, "href": req.href.Billing(), "report_base_href": req.href.report(), "reports": mgr.get_reports_by_group("Timing and Estimation Plugin"), "usermanual_href": req.href.wiki(user_manual_wiki_title), "usermanual_title": user_manual_title } self.set_request_billing_dates(req) add_stylesheet(req, "Billing/billingplugin.css") add_script(req, "Billing/linkifyer.js") return 'billing.cs', 'text/html'
def reports_need_upgrade(self): mgr = CustomReportManager(self.env, self.log) db_report_hash = mgr.get_reports_by_group( CustomReportManager.TimingAndEstimationKey) db_reports = Set() py_reports = Set() for report_group in all_reports: for report in report_group['reports']: py_reports.add((report['uuid'], report['version'])) for key, report_group in db_report_hash.items(): for report in report_group['reports']: db_reports.add((report['uuid'], report['version'])) #diff = db_reports.symmetric_difference(py_reports) # the things in the python reports that are not in the database diff = py_reports.difference(db_reports) for py in diff.copy(): for db in db_reports: #if we have the same report and the db has a higher version # remove it from the difference if db[0] == py[0] and db[1] >= py[1]: diff.remove(py) if len(diff) > 0: self.log.debug("T&E needs upgrades for the following reports: %s" % diff) return len(diff) > 0
def do_reports_upgrade(self): mgr = CustomReportManager(self.env, self.log) r = __import__('reports', globals(), locals(), ['reports']) for report_group in r.reports: rlist = report_group['reports'] group_title = report_group['title'] for report in rlist: title = report['title'] new_version = report['version'] mgr.add_report(report["title"], 'Clients Plugin', report['description'], report['sql'], report['uuid'], report['version'], 'Timing and Estimation Plugin', group_title)
def reports_need_upgrade(self): mgr = CustomReportManager(self.env, self.log) db_reports = mgr.get_version_hash_by_group(CustomReportManager.TimingAndEstimationKey) py_reports = {} for report_group in all_reports: for report in report_group['reports']: py_reports[report['uuid']]= report['version'] diff = [(uuid, version) for (uuid, version) in py_reports.items() if not db_reports.has_key(uuid) or int(db_reports[uuid]) < int(version)] if len(diff) > 0: self.log.debug ("T&E needs upgrades for the following reports: %s" % (diff, )) return len(diff) > 0
def do_reports_upgrade(self): self.log.debug("Beginning Reports Upgrade") mgr = CustomReportManager(self.env, self.log) r = __import__("reports", globals(), locals(), ["all_reports"]) for report_group in r.all_reports: rlist = report_group["reports"] group_title = report_group["title"] for report in rlist: title = report["title"] new_version = report["version"] mgr.add_report(report["title"], "Timing and Estimation Plugin", \ "", report["sql"], \ report["uuid"], report["version"], "Timing and Estimation Plugin", group_title)
def process_request(self, req): req.perm.require(self.BILLING_PERMISSION) messages = [] def addMessage(s): messages.extend([s]) if req.method == 'POST': if req.args.has_key('setbillingtime'): self.set_bill_date(req.authname, req.args.get('newbilltime')) addMessage("All tickets last bill date updated") mgr = CustomReportManager(self.env, self.log) data = {} data["statuses"] = get_statuses(self.env) data["reports"] = mgr.get_reports_by_group( CustomReportManager.TimingAndEstimationKey) # Handle pulling in report_descriptions # Could be added to custom report stuff, but that requires # coordinating with too many people for me to care right now report_descriptions = {} for h in reports.all_reports: report_descriptions[h["title"]] = h["description"] for key in data["reports"]: if report_descriptions.has_key(key): data["reports"][key]["description"] = report_descriptions[key] #self.log.debug("DEBUG got %s, %s" % (data["reports"], type(data["reports"]))); data["billing_info"] = { "messages": messages, "href": req.href.billing(), "report_base_href": req.href.report(), "usermanual_href": req.href.wiki(user_manual_wiki_title), "usermanual_title": user_manual_title } self.set_request_billing_dates(data) add_stylesheet(req, "billing/billingplugin.css") add_script(req, "billing/date.js") add_script(req, "billing/linkifyer.js") if hasattr(Chrome(self.env), 'jenv'): return 'billing_jinja.html', data else: return 'billing.html', data, None
def do_reports_upgrade(self, force=False): self.log.debug("Beginning Reports Upgrade") mgr = CustomReportManager(self.env, self.log) statuses = get_statuses(self) stat_vars = status_variables(statuses) for report_group in all_reports: rlist = report_group["reports"] group_title = report_group["title"] for report in rlist: title = report["title"] new_version = report["version"] sql = report["sql"].replace('#STATUSES#', stat_vars) mgr.add_report(report["title"], "Timing and Estimation Plugin", \ "Reports Must Be Accessed From the Management Screen", sql, report["uuid"], report["version"], CustomReportManager.TimingAndEstimationKey, group_title, force)